tom
November 13, 2018, 10:50am
1
Hi
I have a device that reports a bunch of true/false alerts.
What is the best way to record those in ubidots?
"alarms": {
"low_flow_rate" : true,
"high_flow_rate": true,
"watchdog_reboot" : false,
"power_problem" : true,
"sensor_problem" : false,
"selftest_problem": false,
"reserved7" : false,
"reserved8": false
}
is my best option using raw variables?
Greetings, you should use the variable’s context (please refer to our REST API for more information), find a reference example below:
"variable-label" : {
"value": 1,
"context": {
"low_flow_rate" : true,
"high_flow_rate": true,
"watchdog_reboot" : false,
"power_problem" : true,
"sensor_problem" : false,
"selftest_problem": false,
"reserved7" : false,
"reserved8": false
}
}
All the best
tom
November 14, 2018, 10:57am
3
jotathebest:
“variable-label” : { “value”: 1, “context”: { “low_flow_rate” : true, “high_flow_rate”: true, “watchdog_reboot” : false, “power_problem” : true, “sensor_problem” : false, “selftest_problem”: false, “reserved7” : false, “reserved8”: false } }
Thanks Jose, I thought about Context, but isn’t it a bit limited for what it can be used in the system.
What can I do with context in the portal?
Only show it in some widgets, no?
It doesn’t show in a friendly way in the device manager
I can’t trigger events with it in case I wanted to.
So as a way to handle Alerts/Alarms, I do not think it is very useful right?
Alerts are related actually to variable values, context is intended to store non-numerical values (aka strings) in an unique variable, this is useful to audit or visualization purposes. If you need to set alerts with those values you will have to cast the boolean values to decimal types (zero or one) and send them in different variables to ubidots.
Hope this clarifies your doubt.