Node blokujący proces

Mam podłączonego kompa a właściwie wszystko co jest na biurku przez gniazdo SP111. Przy uruchomionym kompie pobór całości jest ok 100W, gdy komp jest wyłączony mam pobór 10W. Próbuje zrobić proces że jak moc spadnie po niżej 20W (czyli wyłączę kompa) ma się wyłączyć podświetlenie klawiatury i oświetlenie na biurku. Wszystko działa ale w związku z tym, że node events state cały czas sprawdza stan to po wyłączeniu kompa jak załącz oświetlenie na biurku po chwili gaśnie ponieważ jest stan poniżej 20W. Jak można zablokować, że dopóki moc nie wzrośnie i jest pobór mocy poniżej 20W to nie puszcza dalej procesu. Z góry dzięki za pomoc.

Ustaw sobie parametr For po jakim czasie ma się zmienić stan na wyjściu . Jeżeli mówimy o włączeniu lampki i oczekiwaniu na uruchomienie PC

Parametr czasu jest kiepski ponieważ jaki czas ustawić? Jak kompa wyłączę, a za chwile włączę to czas musi być krótki a jak włączę za 2-3 czy 5 godzin to chce, aby oświetlenie można było włączyć. Nie umie zrobić że jak jest pobór mocy poniżej 20W to stan jest OFF i stan się dopiero zmieni na ON jak moc wzrośnie powyżej 20W. Czyli sprowadzić to do sytuacji 0 lub 1. Próbowałem to zrobić na zmiennych, coś na wzór ja w filmach Artura na YT. Ale nie chce mi to działać. W związku z tym że moc nie jest stała ponieważ po wyłączeniu kompa jest 10W za chwile 8W dalej 11W to node event state cały czas monituje o zmianie stanu.

A może dodaj noda “switch” i w nim określ waty i co się ma dziać.
image

Właśnie tak miałem zrobione node events state dalej switch następnie call service wyłaczający oświetlenie. I jak wyłączam kompa moc spada poniżej 10W gaśnie światło. Teraz włączam oświetlenie, a komp wyłączony i światło gaśnie ponieważ node events state odpala proces bo jest moc poniżej progu.
Mało tego moc nie jest stała poniżej 10W tylko skacze zależnie od tego czy jest jakaś ładowatrka podpięta czy inny mały odbiór.

Może node wait until (moc spadnie < 10) we flow rozpoczynąjącym się od node state > 10.
Włączanie wyłączanie samego światła byłoby niezależne.

Kurka nie potrafię ogarnąć tego node wait until, kombinuje i nie wychodzi. Mogę prosić o jakiś screen. Z góry wielkie dzięki.

Ja bym zrobił tak

[{"id":"af544410a23576f7","type":"switch","z":"a5f2d2db30a6d2c3","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"20","vt":"str"},{"t":"gt","v":"20","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":200,"wires":[["973585d0ddd42978"],["a6debe64242e0e8b"]]},{"id":"c09e97f4f60ad68c","type":"server-state-changed","z":"a5f2d2db30a6d2c3","name":"Gniazdko łazienka Waty","server":"6a2af6d8.98c388","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.lazienkagniazdopralka_energy_power","entityidfiltertype":"exact","outputinitially":false,"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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":540,"y":200,"wires":[["af544410a23576f7"]]},{"id":"973585d0ddd42978","type":"api-call-service","z":"a5f2d2db30a6d2c3","name":"Wyłącz światło","server":"6a2af6d8.98c388","version":5,"debugenabled":false,"areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":180,"wires":[[]]},{"id":"a6debe64242e0e8b","type":"api-call-service","z":"a5f2d2db30a6d2c3","name":"Włącz światło","server":"6a2af6d8.98c388","version":5,"debugenabled":false,"areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":220,"wires":[[]]},{"id":"6a2af6d8.98c388","type":"server","name":"Home Assistant 1","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Jestem początkującym i nie bardzo wiem co z tym zrobić???

Skopiuj i zaimportuj w nodred klikasz w trzy kerski a następnie import
image
następnie zmieniasz encje w nodach

Przykro mi ale to nie spełnia założenia ponieważ jeżeli wyłączę kompa moc spadnie do ok 10W (około ponieważ czasami ładowarka ładuje coś, czasami coś innego i moc skacze około 10W) oświetlenie się wyłączy. Komp wyłączony i włączę oświetlenie to po chwili się wyłączy jak node events state ponownie wczyta wartość pobieranej mocy i oświetlenie się wyłączy.

Sorki troche nie zrozumialem twojego założenia. Potrzebujesz podwojny warunek jesli wylaczysz kompa wylacz swiatla. Jesli komp wyłaczony i włączysz światło to nie gaś. Czy dobrze to opisałem?

Edit: jak masz sterowane zródło światła? Tylko z cha czy też manualnie.

Dokładnie tak o to mi chodzi, żebym mógł światło włączać i wyłączać mimo że komp jest wyłączony.

Zdązyłes odpisac przed moją edycja

sterowanie mam tez manualnie

Jutro wyklikam proces

Super, bardzo dziękuję!

A więc zrobiłem dwie wersje.
Wersja A

[{"id":"019a014a87850f43","type":"switch","z":"ce04220a55843173","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"20","vt":"str"},{"t":"gt","v":"20","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":200,"wires":[["0202ac8da89777e2"],["7cf5530171428f40"]]},{"id":"38d118fe32e2b528","type":"server-state-changed","z":"ce04220a55843173","name":"Gniazdko łazienka Waty","server":"6a2af6d8.98c388","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.lazienkagniazdopralka_energy_power","entityidfiltertype":"exact","outputinitially":false,"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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":340,"y":200,"wires":[["019a014a87850f43"]]},{"id":"47d39d7bb59dcb7f","type":"api-call-service","z":"ce04220a55843173","name":"Wyłącz światło","server":"6a2af6d8.98c388","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.salonstol"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":160,"wires":[["0415f20fc234f6bc"]]},{"id":"7cf5530171428f40","type":"api-call-service","z":"ce04220a55843173","name":"Włącz światło","server":"6a2af6d8.98c388","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.salonstol"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":240,"wires":[["8e825e7ef893dd98"]]},{"id":"186225c7436981ea","type":"inject","z":"ce04220a55843173","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":100,"wires":[["3d462404d77c8223"]]},{"id":"3d462404d77c8223","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoonoff","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":100,"wires":[[]]},{"id":"8e825e7ef893dd98","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoonoff","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":240,"wires":[[]]},{"id":"0202ac8da89777e2","type":"switch","z":"ce04220a55843173","name":"Czy włączone z NR?","property":"biurkoonoff","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":160,"wires":[["47d39d7bb59dcb7f"]]},{"id":"0415f20fc234f6bc","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoonoff","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":160,"wires":[[]]},{"id":"c3457974213aaee5","type":"inject","z":"ce04220a55843173","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":390,"y":240,"wires":[["019a014a87850f43"]]},{"id":"dab05167855a49bd","type":"inject","z":"ce04220a55843173","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":390,"y":160,"wires":[["019a014a87850f43"]]},{"id":"a798b47e6bc14382","type":"comment","z":"ce04220a55843173","name":"Wersja A bez kontroli kto włączył","info":"","x":470,"y":60,"wires":[]},{"id":"6a2af6d8.98c388","type":"server","name":"Home Assistant 1","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

włącza światło po uruchomieniu komputera (Watt > 20) i wyłącza światło po wyłączenia komputera (Watt < 20)

Wersja B

[{"id":"9e0c3b4e4e34a451","type":"inject","z":"ce04220a55843173","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":400,"wires":[["f8aabe7b960660ef"]]},{"id":"f8aabe7b960660ef","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoktowlaczyl","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":400,"wires":[[]]},{"id":"500b95b7d4d3076c","type":"switch","z":"ce04220a55843173","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"20","vt":"str"},{"t":"gt","v":"20","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":500,"wires":[["27010fb6c187561e"],["7385594bb6528ff0"]]},{"id":"10baa42c5c6126ae","type":"server-state-changed","z":"ce04220a55843173","name":"Gniazdko łazienka Waty","server":"6a2af6d8.98c388","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.lazienkagniazdopralka_energy_power","entityidfiltertype":"exact","outputinitially":false,"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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":340,"y":500,"wires":[["500b95b7d4d3076c"]]},{"id":"d2e28f1fa1d9b9c8","type":"api-call-service","z":"ce04220a55843173","name":"Wyłącz światło","server":"6a2af6d8.98c388","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.salonstol"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":460,"wires":[["e6675e382405c1f8"]]},{"id":"5c08eacb4eece133","type":"api-call-service","z":"ce04220a55843173","name":"Włącz światło","server":"6a2af6d8.98c388","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.salonstol"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":540,"wires":[["5a94b327150bbf9e"]]},{"id":"5a94b327150bbf9e","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoktowlaczyl","pt":"flow","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":540,"wires":[[]]},{"id":"27010fb6c187561e","type":"switch","z":"ce04220a55843173","name":"Kto włączył?","property":"biurkoktowlaczyl","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":460,"wires":[["d2e28f1fa1d9b9c8"]]},{"id":"e6675e382405c1f8","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoktowlaczyl","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":460,"wires":[[]]},{"id":"dc7dfed5dd4b2b57","type":"inject","z":"ce04220a55843173","name":"","props":[{"p":"payload"},{"p":"kto","v":"-1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":390,"y":540,"wires":[["500b95b7d4d3076c"]]},{"id":"fa1ff95b9e5812b7","type":"inject","z":"ce04220a55843173","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":390,"y":460,"wires":[["500b95b7d4d3076c"]]},{"id":"7385594bb6528ff0","type":"switch","z":"ce04220a55843173","name":"Kto włączył?","property":"biurkoktowlaczyl","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":540,"wires":[["5c08eacb4eece133"]]},{"id":"a3fbc67c8b2c5e3c","type":"server-state-changed","z":"ce04220a55843173","name":"Swiatło","server":"6a2af6d8.98c388","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.salonstol","entityidfiltertype":"exact","outputinitially":false,"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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":390,"y":660,"wires":[["0357d0db9e068d21"]]},{"id":"0357d0db9e068d21","type":"delay","z":"ce04220a55843173","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":550,"y":660,"wires":[["61b38132c48eec23"]]},{"id":"61b38132c48eec23","type":"switch","z":"ce04220a55843173","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":660,"wires":[["09a5535c18be5841"],["629006d333c521d7"]]},{"id":"09a5535c18be5841","type":"switch","z":"ce04220a55843173","name":"Kto włączył?","property":"biurkoktowlaczyl","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":620,"wires":[["ed718e8ec1f909ac"]]},{"id":"ed718e8ec1f909ac","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoktowlaczyl","pt":"flow","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":620,"wires":[[]]},{"id":"629006d333c521d7","type":"switch","z":"ce04220a55843173","name":"Kto włączył?","property":"biurkoktowlaczyl","propertyType":"flow","rules":[{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":680,"wires":[["e1ee26c757c33e84"]]},{"id":"e1ee26c757c33e84","type":"change","z":"ce04220a55843173","name":"Zmienne","rules":[{"t":"set","p":"biurkoktowlaczyl","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":680,"wires":[[]]},{"id":"678f02086b3aa084","type":"comment","z":"ce04220a55843173","name":"Wersja B z kontrolą kto włączył","info":"","x":470,"y":360,"wires":[]},{"id":"6a2af6d8.98c388","type":"server","name":"Home Assistant 1","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

w tej wersji sprawdzam czy światło zostało włączone przez użytkownika jeśli tak to światło nie wyłączy się nawet po wyłączeniu komputera

Dziękuję bardzo, tego potrzebowałem.