Motion Sensing Time Range Problem

Node Red noob here, so I suspect I've done something dumb or just missed a detail somewhere.

I started with kgalilio's motion triggered lights flow. It is working to turn my lights on and off; however the Time Range does not seem to be working; it is activating lights outside the time range specified. The times indicated all seem correct; so it isn't clear what I am missing.... perhaps something I just missed that needs configuring somewhere...?

Am I missing something simple here?

[{"id":"29ae2b18b7ddda3c","type":"tab","label":"Livingroom Lights Motion","disabled":false,"info":"","env":[]},{"id":"de82d455.7709f8","type":"comment","z":"29ae2b18b7ddda3c","name":"Livingroom Lights","info":"# Master Bathroom Lights Automation Logic\nThis flow monitors motion in the Master Bathroom to turn on the Bathroom lights if it is dark. The lights should stay on for 15 minutes since the last motion detection then turn off automatically.\n\n","x":330,"y":180,"wires":[]},{"id":"97aebb2f908d6f02","type":"trigger","z":"29ae2b18b7ddda3c","name":"Turn them on for 1 mins","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"1","extend":false,"overrideDelay":true,"units":"min","reset":"reset","bytopic":"all","topic":"topic","outputs":2,"x":930,"y":360,"wires":[["d70122a7d11f1c0e"],["ca98d8f2ed12e674"]]},{"id":"b70a595bbed15ec7","type":"api-current-state","z":"29ae2b18b7ddda3c","name":"lights off?","server":"","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.lr_lights","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"on","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":360,"wires":[["63b8c3ca4eda2d59"],["cbd33c0f9dac8a96"]]},{"id":"d70122a7d11f1c0e","type":"api-call-service","z":"29ae2b18b7ddda3c","name":"Turn on Lights","server":"","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.lr_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1160,"y":340,"wires":[[]]},{"id":"1ab8faf2a42facb2","type":"trigger-state","z":"29ae2b18b7ddda3c","name":"Just turned off","server":"","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityId":"light.lr_lights","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":530,"y":440,"wires":[["23c8568c5cf59e10"],[]]},{"id":"6f5a233d3e0b4176","type":"api-call-service","z":"29ae2b18b7ddda3c","name":"Turn off Lights","server":"","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.lr_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1160,"y":500,"wires":[[]]},{"id":"23c8568c5cf59e10","type":"change","z":"29ae2b18b7ddda3c","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":440,"wires":[["dbb25c6ea8d1d836"]]},{"id":"ca98d8f2ed12e674","type":"api-current-state","z":"29ae2b18b7ddda3c","name":"Lights are on?","server":"","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.lr_lights","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":1160,"y":420,"wires":[["6f5a233d3e0b4176"],[]]},{"id":"2bb0794d1f65d0ea","type":"trigger-state","z":"29ae2b18b7ddda3c","name":"motion?","server":"","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.kitchen_lr_guesiton_motion","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":330,"y":240,"wires":[["4b2a199b4ccb0c31"],[]]},{"id":"4eed6787d2ad2899","type":"link out","z":"29ae2b18b7ddda3c","name":"extend","mode":"link","links":["6fdee0fe4d750458"],"x":785,"y":500,"wires":[]},{"id":"6fdee0fe4d750458","type":"link in","z":"29ae2b18b7ddda3c","name":"","links":["4eed6787d2ad2899"],"x":845,"y":300,"wires":[["97aebb2f908d6f02"]]},{"id":"4b2a199b4ccb0c31","type":"time-range-switch","z":"29ae2b18b7ddda3c","name":"Dark Outside","lat":"","lon":"","startTime":"22:00","endTime":"6:00","startOffset":"0","endOffset":"0","x":390,"y":300,"wires":[["b70a595bbed15ec7"],[]]},{"id":"b717da7be90b83d1","type":"link in","z":"29ae2b18b7ddda3c","name":"reset","links":["dbb25c6ea8d1d836"],"x":845,"y":420,"wires":[["97aebb2f908d6f02"]]},{"id":"dbb25c6ea8d1d836","type":"link out","z":"29ae2b18b7ddda3c","name":"reset","mode":"link","links":["b717da7be90b83d1","0040ebcb02d9fef8"],"x":785,"y":440,"wires":[]},{"id":"f09442224461776a","type":"trigger-state","z":"29ae2b18b7ddda3c","name":"new motion?","server":"","version":4,"inputs":1,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.kitchen_lr_guesiton_motion","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":true,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":530,"y":500,"wires":[["0c6f3b0dd7511448"],[]]},{"id":"81d2b619741dfdca","type":"trigger-state","z":"29ae2b18b7ddda3c","name":"Lights are on?","server":"","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityId":"light.lr_lights","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":370,"y":500,"wires":[["f09442224461776a"],[]]},{"id":"63b8c3ca4eda2d59","type":"trigger","z":"29ae2b18b7ddda3c","name":"once-off","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":true,"units":"min","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":680,"y":360,"wires":[["97aebb2f908d6f02"]]},{"id":"0040ebcb02d9fef8","type":"link in","z":"29ae2b18b7ddda3c","name":"reset","links":["ef3709d14051a554","dbb25c6ea8d1d836"],"x":635,"y":320,"wires":[["63b8c3ca4eda2d59"]]},{"id":"cbd33c0f9dac8a96","type":"link out","z":"29ae2b18b7ddda3c","name":"extend-on","mode":"link","links":[],"x":635,"y":400,"wires":[]},{"id":"0c6f3b0dd7511448","type":"change","z":"29ae2b18b7ddda3c","name":"extend","rules":[{"t":"set","p":"delay","pt":"msg","to":"60000","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":500,"wires":[["4eed6787d2ad2899"]]},{"id":"35471a2e685aa423","type":"time-range-switch","z":"29ae2b18b7ddda3c","name":"Dark Outside","lat":"","lon":"","startTime":"sunsetStart","endTime":"sunriseEnd","startOffset":"0","endOffset":"0","x":670,"y":60,"wires":[[],[]]}]

Hi and welcome.

I see no one has yet replied/responded.

Sorry but there is/are a couple of things:

1 - not everyone has those nodes and so as good as it was you posting the flow: it won't work on most people's machines without installing those nodes.

2 - try to explain what you expect to happen and what is happening.

Quick look:
The two trigger nodes straight after one another.... I fear that isn't going to work.
(But can't be sure.

link nodes are nice to negate backward running connections, but they are meaningless on screen shots as no one knows where they go.
(If they are local, edit the screen shot so it shows the connections.)

To do what I read you want to happen that is a LOT OF NODES to do it.

Sorry I can't be of more help.

2 Likes

I see that you are using Home Assistant and not many here use HA. You might be better served opening an issue on the Home Assistant forum.

Thanks for the feedback. .I will look into asking on an HA forum.

could you mark this as solved please.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.