Hi,
i habe a sequence in node red to open my garage just a little bit, stay like this for 10 minutes, and then the garage closes again automatically. Is there a easy possibility to have the lower timer variable?
In my Lovelace I habe set up a number helper, where you can select a number from 10 to 60. Can i somehow integrate this in the timer, so the timer runs as long as the selected number in minutes?
Thanks in Advance,
Greets,
Finn
Of course thats possible. As always, in node red there are probably a million and one ways of doing this.
However, what I did was to create an input number slider helper and when it reaches 1 i trigger a 1min timer within nodered that then fires my switch.
In a seperate flow, I am taking the value of the helper and after a minute i will set it to -1 of its previous value.
With that, I always have a visual representation of how much time is still available on the timer, and you can always just change it.
Here is the code on how I use it:
[{"id":"8f44a2d6.2b655","type":"server-state-changed","z":"f28a8271.df143","name":"Timer","server":"2fba4297.e4145e","version":1,"entityidfilter":"input_number.livingroom_fantime","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"0","halt_if_type":"num","halt_if_compare":"lte","outputs":2,"output_only_on_state_change":true,"x":90,"y":2360,"wires":[[],["198c2876.834978"]]},{"id":"7ae29818.37f5f8","type":"api-call-service","z":"f28a8271.df143","name":"Wohnzimmer Off","server":"2fba4297.e4145e","version":1,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.wohnzimmer","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":930,"y":2360,"wires":[[]]},{"id":"198c2876.834978","type":"function","z":"f28a8271.df143","name":"on/off?","func":"newmsg = {};\nif (msg.payload == \"1.0\")\n{\n newmsg.payload = \"True\";\n}else {\n newmsg.payload = \"STOP\";\n}\n\nreturn newmsg;","outputs":1,"noerr":0,"x":550,"y":2360,"wires":[["21fab686.0673ea"]]},{"id":"21fab686.0673ea","type":"stoptimer","z":"f28a8271.df143","duration":"1","units":"Minute","payloadtype":"num","payloadval":"1","name":"","x":720,"y":2360,"wires":[["7ae29818.37f5f8"],[]]},{"id":"2fba4297.e4145e","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
[{"id":"e5654941.1ca258","type":"server-state-changed","z":"f28a8271.df143","name":"Fantime On?","server":"2fba4297.e4145e","version":1,"entityidfilter":"input_number.livingroom_fantime","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"0","halt_if_type":"num","halt_if_compare":"lte","outputs":2,"output_only_on_state_change":false,"x":370,"y":2720,"wires":[[],["eaaec268.aae75"]]},{"id":"92d405cd.7bc228","type":"api-call-service","z":"f28a8271.df143","name":"Fan Time","server":"2fba4297.e4145e","version":1,"service_domain":"input_number","service":"set_value","entityId":"input_number.livingroom_fantime","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":900,"y":2660,"wires":[[]]},{"id":"f4656307.b3c38","type":"function","z":"f28a8271.df143","name":"Fantime - 1","func":"newmsg = {}\n\nnewmsg.payload = { data: { \"value\":(msg.payload - 1)} }\n\nreturn newmsg;\n","outputs":1,"noerr":0,"x":710,"y":2660,"wires":[["92d405cd.7bc228"]]},{"id":"1f2eed2d.a1cb33","type":"switch","z":"f28a8271.df143","name":"","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"connected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":230,"y":2660,"wires":[["95581a4a.f8f788"]]},{"id":"95581a4a.f8f788","type":"api-current-state","z":"f28a8271.df143","name":"Fantime?","server":"2fba4297.e4145e","version":1,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"lte","override_topic":false,"entity_id":"input_number.livingroom_fantime","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":360,"y":2660,"wires":[[],["eaaec268.aae75"]]},{"id":"78ca75e6.00c4bc","type":"status","z":"f28a8271.df143","name":"","scope":["f397f3e0.7e85d"],"x":100,"y":2660,"wires":[["1f2eed2d.a1cb33"]]},{"id":"eaaec268.aae75","type":"stoptimer","z":"f28a8271.df143","duration":"1","units":"Minute","payloadtype":"num","payloadval":"0","name":"1m","x":530,"y":2660,"wires":[["f4656307.b3c38"],[]]},{"id":"2fba4297.e4145e","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
2 Likes