Hi,
I have been struggling for a long time with this 'simple?' logic:
If me or my wife are home ànd the sunset goes in, the outdoor light should go on until 9:30pm.
Since I want to use 3 checks, I'm using the boolean logic ultimate node.
This way I can create an OR for the presence of me and my wife. Once that is a go it is send to an AND that is waiting for the presence and the sunset.
Yet: the status of this don't seem live. Or imagine this: the sunset gives a go; but we are not home until past 10pm, then the light would go on while it shouldn't. the AND function remembers the state and don't reinitialize.
I have my code here. I tried everything, but can't seem to make it work. I have been adding checks like: is it past 9:30pm and wait untill sunset to restart the function. etc Nothing helps. It seems a much used idea, but can't make it work. Any tips?
[{"id":"ec23ac591e0ba1c1","type":"comment","z":"3ad1aee4bf3eebb2","name":"Chalet buitenlamp aan in donker","info":"","x":230,"y":1440,"wires":[]},{"id":"ce9ddade72ca7990","type":"ha-wait-until","z":"3ad1aee4bf3eebb2","name":"wait till 9:30pm","server":"7c8d4509.f039ec","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"21:30","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"x":800,"y":1580,"wires":[["0c1ae773432fb8c5"]]},{"id":"0c1ae773432fb8c5","type":"api-call-service","z":"3ad1aee4bf3eebb2","name":"chalet lamp off","server":"7c8d4509.f039ec","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.sonoff_10015c1449_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1020,"y":1580,"wires":[["38f5ca4ba2feb13d"]]},{"id":"eceeabaa176d9e55","type":"debug","z":"3ad1aee4bf3eebb2","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"\"De automatische chaletlamp is terug uit\"","statusType":"msg","x":1460,"y":1580,"wires":[]},{"id":"7012b25a34cc9bb8","type":"trigger-state","z":"3ad1aee4bf3eebb2","name":"Is X home?","server":"7c8d4509.f039ec","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"device_tracker.tomas_s22","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":0,"outputs":3,"customoutputs":[{"messageType":"payload","messageValue":"true","messageValueType":"bool","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"home","comparatorValueDataType":"str"}],"outputinitially":true,"state_type":"str","enableInput":false,"x":170,"y":1500,"wires":[[],[],["2c4dc29b884b39be"]]},{"id":"85044d931132543d","type":"trigger-state","z":"3ad1aee4bf3eebb2","name":"Is Y home?","server":"7c8d4509.f039ec","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"device_tracker.celine_gsm","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":0,"outputs":3,"customoutputs":[{"messageType":"payload","messageValue":"true","messageValueType":"bool","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"home","comparatorValueDataType":"str"}],"outputinitially":true,"state_type":"str","enableInput":false,"x":160,"y":1560,"wires":[[],[],["2c4dc29b884b39be"]]},{"id":"2c4dc29b884b39be","type":"BooleanLogicUltimate","z":"3ad1aee4bf3eebb2","name":"OR","payloadPropName":"payload","filtertrue":"both","persist":false,"sInitializeWith":"false","triggertopic":"trigger","outputtriggeredby":"all","inputCount":"2","topic":"result","restrictinputevaluation":false,"delayEvaluation":0,"x":390,"y":1500,"wires":[[],["3753f074c1532296"],[]]},{"id":"3753f074c1532296","type":"BooleanLogicUltimate","z":"3ad1aee4bf3eebb2","name":"AND","payloadPropName":"payload","filtertrue":"both","persist":false,"sInitializeWith":"false","triggertopic":"trigger","outputtriggeredby":"onlyonetopic","inputCount":"3","topic":"result","restrictinputevaluation":false,"delayEvaluation":0,"x":420,"y":1660,"wires":[["839e16c0c981d692"],[],[]]},{"id":"839e16c0c981d692","type":"api-call-service","z":"3ad1aee4bf3eebb2","name":"Chalet lamp on","server":"8be923df.d66f9","version":5,"debugenabled":true,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.sonoff_10015c1449_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"\"Het licht is aangegaan\"","valueType":"str"}],"queue":"none","x":560,"y":1580,"wires":[["ce9ddade72ca7990"]]},{"id":"9e1c976856de51f1","type":"server-state-changed","z":"3ad1aee4bf3eebb2","name":"Sunset?","server":"8be923df.d66f9","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sun.sun","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"below_horizon","halt_if_type":"str","halt_if_compare":"is","outputs":2,"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":"true","valueType":"bool"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":1640,"wires":[["3753f074c1532296"],[]]},{"id":"38f5ca4ba2feb13d","type":"ha-wait-until","z":"3ad1aee4bf3eebb2","name":"pause till sun come up","server":"7c8d4509.f039ec","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"10:30","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"x":1240,"y":1580,"wires":[["eceeabaa176d9e55"]]},{"id":"5d54c61acdbbbcc5","type":"trigger-state","z":"3ad1aee4bf3eebb2","name":"After 9:30pm?","server":"8be923df.d66f9","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.time","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":0,"outputs":3,"customoutputs":[{"messageType":"payload","messageValue":"true","messageValueType":"bool","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"<","comparatorValue":"21:30","comparatorValueDataType":"str"}],"outputinitially":true,"state_type":"str","enableInput":false,"x":170,"y":1700,"wires":[["3753f074c1532296"],[],[]]},{"id":"7c8d4509.f039ec","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"},{"id":"8be923df.d66f9","type":"server","name":"homeassistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]```