Hi,
I am quite new in this automation. How could I make a timer that would turn on a fan for e.g. 2min every hour. Fan is plugged in the relay thought ESP32.
Or should I make this outside the node-red?
Thanks!
Hi,
I am quite new in this automation. How could I make a timer that would turn on a fan for e.g. 2min every hour. Fan is plugged in the relay thought ESP32.
Or should I make this outside the node-red?
Thanks!
Maybe not very sophisticated but why not use the ootb Automations?
Actions:
inject node can be âscheduledâ. So either one repeated every hour with a two minute delay or have two injects that is offset with the number of minutes (not sure that is possible though)
Just put it on the esp. Use the interval component.
interval:
- interval: 60min
then:
- switch.turn_on: fan
- delay: 2min
- switch.turn_off: fan
Thank you for the ideas. I went with inject node in node-red with interval and then trigger function that can send string âonâ for a period of time (20s) and then send string âoffâ.
It would be great if I could control the trigger function time period from the dashboard slider. Any Idea on how to achieve that?
You can use the delay node with variable length.
Set a helper with the length and use the current state node to get the value, use this value as the delay in delay node.
Something like this:
[{"id":"29f7cde1488a0cbe","type":"delay","z":"4f357a5f.1c8d34","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":680,"y":2280,"wires":[[]]},{"id":"23c1888b3995986f","type":"function","z":"4f357a5f.1c8d34","name":"","func":"msg.delay = msg.payload * 1000;\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":2280,"wires":[["29f7cde1488a0cbe"]]},{"id":"e9e1f51533f4430d","type":"api-current-state","z":"4f357a5f.1c8d34","name":"input number","server":"4bbca37b.1700ec","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_number.YOUR_ENTITY","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":390,"y":2280,"wires":[["23c1888b3995986f"]]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]