Page 1 of 1
Only send notification once when temp changes?
Posted: Tuesday 17 January 2017 12:22
by iffen5
I try to build an events that will send a single messages when temperature drop below 90 degree C. In this examples its start to send message when temperature is under 90 but it’s continue to send until I deactivate the events
How to make this event to send just one message when temperature passes 90 and below and then only send message next time the temperature drops???
Re: Only send notification once when temp changes?
Posted: Tuesday 17 January 2017 13:02
by Nautilus
I'd suggest adding a user variable for which you give some desired value (true/false, 0/1, on/off...) when temp passes the notification threshold to either direction. Then for the notification, add additional check for the user variable to send it only when the variable still says temp > 90 but actual temp is < 90. At the same time the user variable updates and with the next check it will not send a message anymore.
Also, add a condition to update the user variable only in case the value needs to change (otherwise it will keep updating the same value).
This might actually be a bit easier to be done with LUA but should be working in Blockly too...
Re: Only send notification once when temp changes?
Posted: Tuesday 17 January 2017 13:11
by iffen5
ahhh ok so if i have a variable send= 1 or 0
If temp is higher then 90 then send = 1
If temp is lower than 90 and send = 1 then send message and then set send = 0
Nice thanks
Re: Only send notification once when temp changes?
Posted: Tuesday 17 January 2017 13:31
by Nautilus
Yes, something along those lines was exactly what I meant
And possibly also consider:
Code: Select all
If temp is higher than 90 and send = 0 then send = 1
...and vice versa - if you want to avoid updating the variable when the target value is the same as the current value.
Re: Only send notification once when temp changes?
Posted: Tuesday 17 January 2017 13:34
by iffen5
Thanks This works

Re: Only send notification once when temp changes?
Posted: Tuesday 17 January 2017 13:41
by Nautilus
Nice!
