Witam serdecznie.
Potrzebuję pomocy. Buduję termostat z funkcją gdzie włączam dzień wolny i wpisuję godzinę o której ma się włączyć piec, tylko nie umiem znaleźć odpowiedniego rozwiązania, które by startowało proces o godzinie wpisanej w pomocniku.
Z góry dziękuję za pomoc.
Ja używam takiego procesu akurat tutaj pobieram czas z alarmu z telefonu.
[{"id":"10815d85b2363164","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"1f974d66abd8e049","type":"delay","z":"10815d85b2363164","name":"Czekaj na czas + 5 min","pauseType":"delayv","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1030,"y":140,"wires":[[]]},{"id":"854968a1d4946a5f","type":"change","z":"10815d85b2363164","name":"Ustaw skasowanie","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":200,"wires":[["1f974d66abd8e049"]]},{"id":"b6958e95e0baebb9","type":"function","z":"10815d85b2363164","name":"Oblicz czas","func":"const now = Date.now();\nconst alarm = new Date(msg.alarm);\nconst timeDifference = alarm.getTime();\nconst delay = timeDifference - now;\n\nif(delay < 0) {\n node.status({fill: 'red', text: 'Alarm in the past'});\n node.error(\"Alarm in the past.\");\n return {reset: true};\n}\n\nnode.status({});\nmsg.delay = delay\n\n// Reset the delay node before setting the new delay\nreturn [[{reset: true},msg]];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":140,"wires":[["1f974d66abd8e049"]]},{"id":"7b58edcf63aad345","type":"switch","z":"10815d85b2363164","name":"Skasuj gdy niedostępny alarm","property":"alarm","propertyType":"msg","rules":[{"t":"eq","v":"unavailable","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":490,"y":200,"wires":[["854968a1d4946a5f"]]},{"id":"f15517528f3d8196","type":"server-state-changed","z":"10815d85b2363164","name":"Aktualizuj alarm","server":"c00e7dc3.fec7d","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.pot_lx1_nastepny_alarm","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"alarm","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":220,"y":140,"wires":[["b6958e95e0baebb9","7b58edcf63aad345"]]},{"id":"c00e7dc3.fec7d","type":"server","name":"Home Assistant iZYD","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]
Poprawiłem trochę flow, teraz sprawdza czy jest w ogóle ustawiony alarm.
Dziękuję, działa idealnie, musiałem tylko pomocnika zmienić z czas, na data i czas.
Czy mógłbym prosić w wolnej chwili o funkcję która będzie działała z samą godziną ponieważ w przypadku kilku dni wolnych będzie trzeba codziennie przestawiać datę.
Jeszcze raz dziękuję.