Activate the trigger only once

Hello everybody,

with home assistant I control a temperature sensor,
the object checks if the temperature is lower than 20, then turn on a relay.
The problem is this: when the temperature drops below 20
the object activates the relay and this is correct, but the problem is that the object continues to trigger even when a value changes below the set threshold, I would like that when it reaches the threshold, the object only activates once.
I thank


2

Add a Filter node on the output, set to pass only when the value changes. Then you will get only one on message and only one off message.

thanks, I inserted the filter, and I set it that if greater than 19 it does not consider the data, however how can I do if it is less than 19?
The filter options indicate only if greater than you do....

I also tried to use the first option of the filter, but when the value changes as it is not equal, the data is read.

thank you very much.


1
3

I didn't say replace the existing nodes with that node, I said to add a filter node (I meant at the end of the flow), set to only pass if data changes. That will suppress the repeated on and off messages.

hi,
the nodes have been added, I have not removed anything, if I use the first option of the filter node, the data passes because the read value is different, if instead the data is equal it is not considered.
The value unfortunately changes is not always the same, so I used another option of the filter node, but I don't know how to set the node if the value is less than .....

thank you


3

The difficulty using the filter node seems to be because your data is split between the two wires, for "Switch turn on" and "Switch turn off".

Is it possible to combine these into one, rbe then split again? Something like this (no HA nodes in the example)

[{"id":"06e1b33b692056bc","type":"inject","z":"18302aaec057c898","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"19","payloadType":"num","x":90,"y":80,"wires":[["0f19e212ce258b8b"]]},{"id":"60ddbdf3832ab530","type":"inject","z":"18302aaec057c898","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":90,"y":120,"wires":[["0f19e212ce258b8b"]]},{"id":"ceefcd7272a139c9","type":"inject","z":"18302aaec057c898","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"21","payloadType":"num","x":90,"y":160,"wires":[["0f19e212ce258b8b"]]},{"id":"0f19e212ce258b8b","type":"switch","z":"18302aaec057c898","name":"<20?","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"20","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":230,"y":100,"wires":[["b7d5980bb6049dbe"],["44def34c21007195"]]},{"id":"44def34c21007195","type":"change","z":"18302aaec057c898","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":120,"wires":[["41ef36c36f8ac7a7"]]},{"id":"b7d5980bb6049dbe","type":"change","z":"18302aaec057c898","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":80,"wires":[["41ef36c36f8ac7a7"]]},{"id":"41ef36c36f8ac7a7","type":"rbe","z":"18302aaec057c898","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":470,"y":100,"wires":[["020ac02ac024ddbb"]]},{"id":"020ac02ac024ddbb","type":"switch","z":"18302aaec057c898","name":"ON or OFF ?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":100,"wires":[["e54564bb5d8098e3","f5dbeaa5575a8496"],["250c2727b643a907","cd83acadd225604c"]]},{"id":"e54564bb5d8098e3","type":"link out","z":"18302aaec057c898","name":"Turn something ON","mode":"link","links":[],"x":810,"y":80,"wires":[],"l":true},{"id":"250c2727b643a907","type":"link out","z":"18302aaec057c898","name":"Turn something OFF","mode":"link","links":[],"x":820,"y":120,"wires":[],"l":true},{"id":"4f575cbb1e44d2dd","type":"inject","z":"18302aaec057c898","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"18","payloadType":"num","x":90,"y":40,"wires":[["0f19e212ce258b8b"]]},{"id":"f5dbeaa5575a8496","type":"debug","z":"18302aaec057c898","name":"ON","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":40,"wires":[]},{"id":"cd83acadd225604c","type":"debug","z":"18302aaec057c898","name":"OFF","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":160,"wires":[]}]
1 Like

image

Instead of using separate nodes to turn it on and off, use one node that is passed a message to tell it whether to go on or off. Then put the filter in front of that.