Hi everyone,
I have a flow that controls my living room lamps by lux and motion during daylight hours and then a timer once the sun sets. My Wife Acceptance Rate has dropped lately as the lights and turning on and off too many times during the day for her liking.
I need a new conditional delay node triggered by the light turn-off automation, so that if the lux increases past the threshold but immediately decreases we don’t have a dip to black. Here’s where I would need it in the flow.
I think I would need to write a function that has a gate that closes for x seconds when triggered by the turn-off node.
Here’s the entire flow as well:
[{"id":"b1a17bc8.bc2618","type":"tab","label":"Living Room Lights","disabled":false,"info":""},{"id":"2c0a5767bf83a0e4","type":"junction","z":"b1a17bc8.bc2618","x":1880,"y":240,"wires":[[]]},{"id":"87739f86.c1df4","type":"eztimer","z":"b1a17bc8.bc2618","name":"Weekends","debug":true,"autoname":"goldenHour - 23:00:00","tag":"eztimer","topic":"","suspended":false,"sendEventsOnSuspend":false,"latLongSource":"haZone","latLongHaZone":"zone.home","lat":"30.003590996565503","lon":"-90.06227874742763","timerType":"1","startupMessage":false,"ontype":"1","ontimesun":"goldenHour","ontimetod":"17:00","onpropertytype":"msg","onproperty":"payload","onvaluetype":"bool","onvalue":"true","onoffset":0,"onrandomoffset":0,"onsuppressrepeats":false,"offtype":"2","offtimesun":"dusk","offtimetod":"23:00:00","offduration":"00:01:00","offpropertytype":"msg","offproperty":"payload","offvaluetype":"bool","offvalue":"false","offoffset":"20","offrandomoffset":true,"offsuppressrepeats":false,"resend":false,"resendInterval":"0s","mon":false,"tue":false,"wed":false,"thu":false,"fri":true,"sat":true,"sun":false,"x":930,"y":440,"wires":[["9b05be9280e7fe16"]]},{"id":"c2154d39.f17ee","type":"eztimer","z":"b1a17bc8.bc2618","name":"Weeknights","debug":false,"autoname":"goldenHour - 22:00:00","tag":"eztimer","topic":"","suspended":false,"sendEventsOnSuspend":false,"latLongSource":"haZone","latLongHaZone":"zone.home","lat":"30.003590996565503","lon":"-90.06227874742763","timerType":"1","startupMessage":false,"ontype":"1","ontimesun":"goldenHour","ontimetod":"17:00","onpropertytype":"msg","onproperty":"payload","onvaluetype":"bool","onvalue":"true","onoffset":0,"onrandomoffset":0,"onsuppressrepeats":false,"offtype":"2","offtimesun":"dusk","offtimetod":"22:00:00","offduration":"00:01:00","offpropertytype":"msg","offproperty":"payload","offvaluetype":"bool","offvalue":"false","offoffset":"20","offrandomoffset":true,"offsuppressrepeats":false,"resend":false,"resendInterval":"0s","mon":true,"tue":true,"wed":true,"thu":true,"fri":false,"sat":false,"sun":true,"x":1050,"y":380,"wires":[["f60c7c44b60d3ac9"]]},{"id":"51e15269.8a2cfc","type":"time-range-switch","z":"b1a17bc8.bc2618","name":"daytime only turn on","lat":"30.00369","lon":"-90.06115","startTime":"11:00:00","endTime":"goldenHour","startOffset":0,"endOffset":"0","x":1000,"y":240,"wires":[["d85ffd3542eaf50a"],[]]},{"id":"e3784291c3ee3a60","type":"time-range-switch","z":"b1a17bc8.bc2618","name":"daytime only turn on","lat":"30.00369","lon":"-90.06115","startTime":"07:00","endTime":"11:00","startOffset":0,"endOffset":0,"x":1000,"y":140,"wires":[["d85ffd3542eaf50a"],[]]},{"id":"0c7ac1534deca9e4","type":"change","z":"b1a17bc8.bc2618","name":"Set Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":500,"wires":[["f7f6b22efd4e1747"]]},{"id":"2e124205a0075a77","type":"time-range-switch","z":"b1a17bc8.bc2618","name":"daytime only turn off","lat":"30.00369","lon":"-90.06115","startTime":"07:15:00","endTime":"goldenHour","startOffset":0,"endOffset":"-20","x":980,"y":500,"wires":[["0c7ac1534deca9e4"],[]]},{"id":"f60c7c44b60d3ac9","type":"FilterUltimate","z":"b1a17bc8.bc2618","name":"Filter","x":1130,"y":300,"wires":[["d85ffd3542eaf50a"],["0c7ac1534deca9e4"]]},{"id":"9b05be9280e7fe16","type":"FilterUltimate","z":"b1a17bc8.bc2618","name":"Filter","x":1130,"y":440,"wires":[["d85ffd3542eaf50a"],["0c7ac1534deca9e4"]]},{"id":"a2ae234d83440814","type":"ha-device","z":"b1a17bc8.bc2618","name":"Living Room Switch On","server":"1952aa83.c9e0e5","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"72c875fc1b51980db098977ff4324493","event":{"device_id":"72c875fc1b51980db098977ff4324493","domain":"zha","platform":"device","type":"remote_button_short_press","subtype":"remote_button_short_press","metadata":{}},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"true","valueType":"bool"}],"x":1200,"y":20,"wires":[["f7f6b22efd4e1747"]]},{"id":"26803b41ef85c6fb","type":"ha-device","z":"b1a17bc8.bc2618","name":"Living Room Switch Off","server":"1952aa83.c9e0e5","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"inputs":0,"deviceType":"trigger","device":"72c875fc1b51980db098977ff4324493","event":{"device_id":"72c875fc1b51980db098977ff4324493","domain":"zha","platform":"device","type":"remote_button_double_press","subtype":"remote_button_double_press","metadata":{}},"capabilities":[],"outputProperties":[{"property":"payload","propertyType":"msg","value":"false","valueType":"bool"}],"x":1200,"y":80,"wires":[["f7f6b22efd4e1747"]]},{"id":"d85ffd3542eaf50a","type":"change","z":"b1a17bc8.bc2618","name":"Set On","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1520,"y":220,"wires":[["f7f6b22efd4e1747"]]},{"id":"4d7ba4595d83d57a","type":"trigger-state","z":"b1a17bc8.bc2618","name":"Lux and Motion","server":"1952aa83.c9e0e5","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.living_room_illuminance","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"entity_id","targetValue":"binary_sensor.living_room_occupancy","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"<=","comparatorValueDatatype":"num","comparatorValue":"60","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":580,"y":380,"wires":[["363faa285e8d615b","e3784291c3ee3a60","51e15269.8a2cfc"],["363faa285e8d615b","b513363afb1ac414"]]},{"id":"363faa285e8d615b","type":"debug","z":"b1a17bc8.bc2618","name":"debug 3","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":910,"y":340,"wires":[]},{"id":"b513363afb1ac414","type":"delay","z":"b1a17bc8.bc2618","name":"","pauseType":"rate","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"15","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":740,"y":500,"wires":[["2e124205a0075a77"]]},{"id":"f7f6b22efd4e1747","type":"api-call-service","z":"b1a17bc8.bc2618","name":"Living Room Toggle","server":"1952aa83.c9e0e5","version":3,"debugenabled":false,"service_domain":"scene","service":"turn_{{payload}}","entityId":"scene.living_room_normal","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2090,"y":260,"wires":[[]]},{"id":"1952aa83.c9e0e5","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open|1","connectionDelay":true,"cacheJson":true}]
Thanks!