Only send notification once when temp changes?

Post Reply
iffen5
Posts: 16
Joined: Tuesday 17 January 2017 12:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Only send notification once when temp changes?

Post by iffen5 » Tuesday 17 January 2017 13:22

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???
Attachments
events_tempp.JPG
events_tempp.JPG (24.56 KiB) Viewed 1840 times

Nautilus
Posts: 792
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Only send notification once when temp changes?

Post by Nautilus » Tuesday 17 January 2017 14:02

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...
Last edited by Nautilus on Tuesday 17 January 2017 14:42, edited 2 times in total.

iffen5
Posts: 16
Joined: Tuesday 17 January 2017 12:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Only send notification once when temp changes?

Post by iffen5 » Tuesday 17 January 2017 14:11

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

Nautilus
Posts: 792
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Only send notification once when temp changes?

Post by Nautilus » Tuesday 17 January 2017 14:31

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.

iffen5
Posts: 16
Joined: Tuesday 17 January 2017 12:59
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Only send notification once when temp changes?

Post by iffen5 » Tuesday 17 January 2017 14:34

Thanks This works :)
Attachments
vedpanna_funkar.JPG
vedpanna_funkar.JPG (39.7 KiB) Viewed 1819 times

Nautilus
Posts: 792
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Only send notification once when temp changes?

Post by Nautilus » Tuesday 17 January 2017 14:41

Nice! 8-)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests