Here are the results for the onRealtime data dump with a max num points = 2. See how the second variable doesn’t show up? It isn’t in the result, those are the two samples from the first variable.
As near as I can tell, the ONLY way to solve this problem of gathering data from multiple sensors that the SAME variable name is to:
Assume I have 16 different sensors all monitoring water moisture in soil.
make an analysis triggered on your incoming devices.
Translate the device(s) into a SINGLE mutable device store
each device would get a name, like a nickname.
variable: (nickname for the device) - in my case I did a tree name “A1” or “D3”
value: (value of the actual variable) - this was the value like 22.3% - in my case soil moisture
If you get the ORIGINAL deviceid, life will be better. I think this has to be put in metadata. I didn’t do that.
In my MUTABLE, the variables keep adding to the store. I haven’t figured out how to just keep one “chirp” from each device. That would make life MUCH simpler.
Once you do this, then you can setup to get all 16 of these different “variables” which are actually the same variables from different sensors from the MUTABLE data store.
Now you go into OPTIONS and limit the data to 16 points.
This works because I get all 16 sensors as the last data point before a new datapoint comes in and over writes.
The DATA will show up in the onRealtime as data->Result -
The filtering and control over the variables to be queried from TAGO and sent to the browser system could stand to have MUCH better control and better explanations. I would argue a much better overall setup and control pane would go a long way.
ASSUME that you could get the “latest” point from all LISTED devices in the setup. Assume they all have the same name. I think you have to make an iterator to do that, but that would be a VERY nice thing.
ASSUME that you might want to control the points from EACH variable, even with different or same variables names, even if they come from different devices.
ASSUME that in the onStart you might like to get all the data the first time to setup. Then when you paint you paint with the most current. Then when you hit onRealTime, you only need to send the last chirp in the data. Much faster.
Otherwise, to manage between onStart and onRealtime, you can’t use onStart for data, and in onRealtime you need to figure out how to tell if it was the first call of onRealtime or subsequent.
It would be super nice to figure out how to OVERWRITE variables in MUTABLE datastores with only an option. Right now, I think I have to read, edit, update. Yuk. I may be wrong.
By having the better control over the data that the widget sends to the onRealtime an onStart commands you can avoid writing analysis scripts.