Light not turning on after motion is detected a second time

@obaldius. I have set all my rooms where i need this turn off after 20 secs and it seems to be working.

As long as there is movement the light stays on. No movement its off after the 30 seconds. It will be tonight that we will really knows and i need to wait for the seal of approval from the Mrs on the bathroom staying on more than 20 seconds when she goes down to the toilet in the night. But from what i can see so far it is working as it should.

I still think it won’t work… ¬¬’

I mean, it will work, but it doesn’t work as it was intended.

The way you set it it’s exactly the same as if you extended the delay from 10s to 30s in your original flow, nothing more…

If you go into the dining room, go away for 15 seconds and go back in, the trigger node won’t reset and you’ll find yourself in the dark 15 seconds later regardless of the last detected movement.

It apparently works, but when you find out it doesn’t come back to this thread.

After an evening of real world use i think you are right. It was not really noticeable apart from in the kitchen where even though we were in it the light was still going off way quicker than it should.

So i have changed the flow for the kitchen to include what you said a few posts back

$entities('input_boolean.good_night_good_bye').state = 'on' ? 20 : 300	

I have included the flow for the Kitchen below just so we know where i am right now. I know we was looking at dining room but to be fair i am using the same logic for all the rooms that need it. I will give it some real world testing today / this evening and see if its any better.

[{"id":"4702f2af3c981df9","type":"group","z":"f4d699e3f5593b7b","name":"Turn Kitchen Lights - On - Off - If Alseep or away from home only turn on for 20 seconds","style":{"label":true},"nodes":["b813d119661b7826","d7ae93874e9e42d5","836a9ec058e0f16f","3a22270b2b637ea5","58300163b07271ca","df5f749a45e913a9","3981fbf8d53e9c39","7899c3bad1c6d5ce"],"x":34,"y":299,"w":972,"h":262},{"id":"b813d119661b7826","type":"server-state-changed","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Kitchen PIR","server":"da3b2d1e.ad751","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.sensor_group_kitchen_motion_sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"$entities('input_boolean.good_night_good_bye').state = 'on' ? 20 : 300","forType":"jsonata","forUnits":"seconds","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[],"x":130,"y":360,"wires":[["7899c3bad1c6d5ce"],["836a9ec058e0f16f"]]},{"id":"d7ae93874e9e42d5","type":"api-call-service","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Turn on Kitchen Lights - Full","server":"da3b2d1e.ad751","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.light_group_kitchen_spots"],"data":"{\"brightness\":255,\"rgb_color\":[255,255,255]}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":820,"y":460,"wires":[[]]},{"id":"836a9ec058e0f16f","type":"api-current-state","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Light Level","server":"7e20b797.b28178","version":3,"outputs":2,"halt_if":"200","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.mqtt_sensor_samsung_kitchen_boiler_illuminance_lux","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":150,"y":440,"wires":[["3a22270b2b637ea5"],[]]},{"id":"3a22270b2b637ea5","type":"api-current-state","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Good-Bye-Good-Night","server":"7e20b797.b28178","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.good_night_good_bye","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":370,"y":440,"wires":[["3981fbf8d53e9c39"],["58300163b07271ca"]]},{"id":"58300163b07271ca","type":"within-time-switch","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"","nameInt":"","positionConfig":"b954ab15.fd5738","startTime":"07:00","startTimeType":"entered","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"endTime":"23:00","endTimeType":"entered","endOffset":0,"endOffsetType":"none","endOffsetMultiplier":60000,"timeRestrictions":0,"timeRestrictionsType":"none","timeDays":"*","timeOnlyOddDays":false,"timeOnlyEvenDays":false,"timeOnlyOddWeeks":false,"timeOnlyEvenWeeks":false,"timeMonths":"*","timedatestart":"","timedateend":"","propertyStart":"","propertyStartType":"none","propertyStartCompare":"true","propertyStartThreshold":"","propertyStartThresholdType":"num","startTimeAlt":"","startTimeAltType":"entered","startOffsetAlt":0,"startOffsetAltType":"none","startOffsetAltMultiplier":60000,"propertyEnd":"","propertyEndType":"none","propertyEndCompare":"true","propertyEndThreshold":"","propertyEndThresholdType":"num","endTimeAlt":"","endTimeAltType":"entered","endOffsetAlt":0,"endOffsetAltType":"none","endOffsetAltMultiplier":60000,"withinTimeValue":"true","withinTimeValueType":"msgInput","outOfTimeValue":"false","outOfTimeValueType":"msgInput","tsCompare":"0","x":590,"y":480,"wires":[["d7ae93874e9e42d5"],["df5f749a45e913a9"]]},{"id":"df5f749a45e913a9","type":"api-call-service","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Turn on Kitchen Lights - Dimmed","server":"da3b2d1e.ad751","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.light_group_kitchen_spots"],"data":"{\"brightness\":5,\"rgb_color\":[255,255,255]}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":520,"wires":[[]]},{"id":"3981fbf8d53e9c39","type":"api-call-service","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Turn on Kitchen Lights - Dimmed","server":"da3b2d1e.ad751","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.light_group_kitchen_spots"],"data":"{\"brightness\":2,\"rgb_color\":[255,255,255]}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":400,"wires":[[]]},{"id":"7899c3bad1c6d5ce","type":"api-call-service","z":"f4d699e3f5593b7b","g":"4702f2af3c981df9","name":"Turn off Kitchen Lights","server":"da3b2d1e.ad751","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.light_group_kitchen_spots"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":360,"y":340,"wires":[[]]},{"id":"da3b2d1e.ad751","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":"7e20b797.b28178","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":"b954ab15.fd5738","type":"position-config","name":"","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12","contextStore":""}]
1 Like

Just to update. I think the above flow hit the nail on the head and is working as it should.

We was so busy last night in and out of rooms, in rooms for long period of times and we didnt even notice any issues that made us stop and notice the lights.

So unless we notice anything wrong i think this issue is fixed. Thank you to everyone who replied and helped. Your help is so appreciated in helping me get to grips with Node Red.