How to implement repeat reminder in node red

for example if door contact sensor is open, I’d like to get notification every half hour if it remains open. what node available to implement this logic?

Someone else might have a better solution but this is what I would do.

This will trigger when the door is opened and start a 30 minute timer. After 30 minutes it will again check the state of the door and if it is open will send an email (replace with whatever notification you want to use). If the door is closed it will send a stop message to the timer.

I haven’t tested it but it should work. I’m also not sure if you need to check the status again at the end because if someone closes the door it should stop the flow .

[{"id":"ee3c844d.1555c8","type":"server-state-changed","z":"801174eb.98e1c8","name":"Back Door","server":"b9ff79d7.164bf8","version":1,"entityidfilter":"sensor.fibaro_door_sensor_back_door_access_control","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":180,"y":1460,"wires":[["38c39ccc.6c5704"]]},{"id":"38c39ccc.6c5704","type":"switch","z":"801174eb.98e1c8","name":"Open/Closed?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"},{"t":"eq","v":"closed","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":1460,"wires":[["7bd262b.034f19c"],["474769bc.d45c38"]]},{"id":"7bd262b.034f19c","type":"stoptimer","z":"801174eb.98e1c8","duration":"30","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":660,"y":1460,"wires":[["8b080494.7488e8"],[]]},{"id":"8b080494.7488e8","type":"api-current-state","z":"801174eb.98e1c8","name":"Back Door State","server":"b9ff79d7.164bf8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.fibaro_door_sensor_back_door_access_control","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":880,"y":1460,"wires":[["e9a0361.2a0b9c8"]]},{"id":"e9a0361.2a0b9c8","type":"switch","z":"801174eb.98e1c8","name":"Open?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1050,"y":1460,"wires":[["5f6808d0.43fc38","7bd262b.034f19c"]]},{"id":"5f6808d0.43fc38","type":"e-mail","z":"801174eb.98e1c8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":1170,"y":1420,"wires":[]},{"id":"474769bc.d45c38","type":"change","z":"801174eb.98e1c8","name":"Stop Timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":1580,"wires":[["7bd262b.034f19c"]]},{"id":"b9ff79d7.164bf8","type":"server","z":"","name":"Home Assistant"}]
1 Like

The placeholder node is because you can’t link a node to itself.

image

[{"id":"fb5876e2.231518","type":"server-state-changed","z":"80ec2698.d814f8","name":"Back Door","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.fibaro_door_sensor_back_door_access_control","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"open","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":140,"y":448,"wires":[["f796009d.f87ca"],[]]},{"id":"f796009d.f87ca","type":"ha-wait-until","z":"80ec2698.d814f8","name":"","outputs":2,"entityId":"sensor.fibaro_door_sensor_back_door_access_control","property":"state","comparator":"is_not","value":"open","valueType":"str","timeout":"30","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":300,"y":448,"wires":[[],["35b613fa.c8201c","d447b9bf.c19b08"]]},{"id":"35b613fa.c8201c","type":"e-mail","z":"80ec2698.d814f8","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"","dname":"","x":450,"y":448,"wires":[]},{"id":"d447b9bf.c19b08","type":"function","z":"80ec2698.d814f8","name":"placeholder","func":"\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":496,"wires":[["f796009d.f87ca"]]}]
4 Likes

thanks both. I will be try them out.

@Kermit
Tested and it is working!

But I had some issue running it initially. I am using the door sensor from my ring alarm to test, the entity is binary_sensor.front_door.
The flow never trigger when I open the door. It turns out that the value for this sensor is on/off instead of open/close. Once I changed the value it is working now.
I think open/close value makes more sensor for door sensor, is there anything I can do to change that? or am I using the wrong entity?

I wanted to add one more possible way - with less node-red components.
I too am using this for a fridge door - to alert when it’s left open for longer than 2 min.
I use a State Node connected to a Trigger that acts as a repeater. When the state is ON for “door open” there’s a 2 min timer that starts. It then sends a message “on” to the Trigger that is set in repeat mode until it receives an “off” from the State node. Seems to work well with push bullet notifications.

[{"id":"c534c2c03a4e7cd2","type":"pushbullet","z":"0c7736e4831092b6","config":"b89e0561.b6ece8","pushtype":"note","title":"Garage Fridge Door is Open","chan":"","name":"","x":720,"y":200,"wires":[]},{"id":"b06314eff740879c","type":"server-state-changed","z":"0c7736e4831092b6","name":"Garage Fridge Door","server":"c9b3e5d8.522888","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.sensorfridge_dd650a01_ias_zone","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":"2","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":270,"y":200,"wires":[["8121c9c789e528e5"],["8121c9c789e528e5"]]},{"id":"8121c9c789e528e5","type":"trigger","z":"0c7736e4831092b6","name":"Repeater","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"-2","extend":false,"overrideDelay":false,"units":"min","reset":"off","bytopic":"all","topic":"topic","outputs":1,"x":500,"y":200,"wires":[["c534c2c03a4e7cd2","8f90afda320c5181"]]},{"id":"b89e0561.b6ece8","type":"pushbullet-config","name":"[email protected]"},{"id":"c9b3e5d8.522888","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

3 Likes