@aguspg thanks for your help on the last widget. New widget question. ( Green horn here). If i wanted to do a sum total for a variable when a value exceeds 100 how would you do it?
So to be clear. Sensor one > 100 I want to sum the time that it was greater then 100 and display that time as a new variable. I am playing with it myself but wanted to touch base. Doesnt appear I can do a sum?
Hi Herner, if I got this right, you want to count the time that a variable is above 100. If so, the current widgets won’t support it, however, I would try to compute this value from the source and post it as a separate variable.
For example, let’s say you’re posting a temperature every second (I’ll use a python-like sintaxis):
while (1):
x = get_temp() //Get your value
temp.save_value(x) //Save value to Ubidots
time.sleep(1)
What I’d do is to include an additional variable that counts that time:
while (1):
x = get_temp() //Get your value
var_temp.save_value(x) //Save value to Ubidots
if x > 100:
counter = counter + 1
var_time.save_value(counter)
time.sleep(1)
Hope this helps!
On the other hand, if you’re looking to do a sum of the values of a variable (not the time) you can use this endpoint to compute it automatically (although it wouldn’t support conditions like ‘x > 100’):
Thanks for the reply. I was hoping to do it from a widget ( tried and failed ). The more I can keep OFF my hardware the better due to limitations on the device.
Back to the drawing board Who do I email to ask some questions about white labeling and getting a feel for how it will work with our needs?