Motion light not working

Rather new to Home Assistant and Node Red. I’ve been importing flows into Node red, and ended up with several “Servers.” I’m trying to collapse them into one. I named the one I’m using to Home Assistant Real just to distinguish it from the rest. I made sure that the server selection for allitems in the flow are set to home assistant real. The problem, i think, is that the edit change node is not referencing this server. I’m not 100% sure this is the issue. Hpoing someone can take a quick look and help. The motion lights work fine, and turn the lights on at the appropriate brightness for the time of day. The problem is that when i have automation set to off, the motion lights are still triggered. Thanks for anyones help.

[{"id":"af8612f417bce48b","type":"comment","z":"2f95c855cb2cd6a6","name":"Parker","info":"","x":110,"y":2780,"wires":[]},{"id":"9fdc28cbbe44dc42","type":"server-state-changed","z":"2f95c855cb2cd6a6","name":"Motion","server":"9405c3fe.d0a6c","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.parker_motion_sensor_ias_zone","entityidfiltertype":"substring","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":130,"y":2920,"wires":[["6edd805c997c7f6d"]]},{"id":"6edd805c997c7f6d","type":"change","z":"2f95c855cb2cd6a6","name":"Get input_boolean state and set delays in ms","rules":[{"t":"set","p":"delay","pt":"msg","to":"$globalContext(\"homeassistant.homeAssistant.states['input_boolean.parker_automation'].state\")","tot":"jsonata"},{"t":"change","p":"delay","pt":"msg","from":"on","fromt":"str","to":"300000","tot":"num"},{"t":"change","p":"delay","pt":"msg","from":"off","fromt":"str","to":"1800000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":215,"y":2920,"wires":[["c8216a4ce8da120c"]],"l":false},{"id":"659336d110a29471","type":"trigger","z":"2f95c855cb2cd6a6","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"250","extend":false,"overrideDelay":true,"units":"ms","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":535,"y":2980,"wires":[["4e38033a0db12a31"]],"l":false},{"id":"c8216a4ce8da120c","type":"switch","z":"2f95c855cb2cd6a6","name":"Automation on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":2920,"wires":[["659336d110a29471","cd867336755e02a4","18a5509c0b901c38"],["659336d110a29471"]]},{"id":"4e38033a0db12a31","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light off","server":"bb06732d.30845","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.parker_ceiling_fan, fan.parker_ceiling_fan","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":2980,"wires":[["b58a3cce547a8f3a"]]},{"id":"b58a3cce547a8f3a","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Input off?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.parker_automation","state_type":"str","blockInputOverrides":true,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":880,"y":2980,"wires":[["cfb7902164d0498a"],[]]},{"id":"cfb7902164d0498a","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Input on","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"input_boolean.parker_automation","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":2980,"wires":[[]]},{"id":"cd867336755e02a4","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Day?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"Day","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":570,"y":2840,"wires":[["f1d8aea6165f32f3"],[]]},{"id":"f1d8aea6165f32f3","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light 100%","server":"bb06732d.30845","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.parker_ceiling_fan","data":"{\"brightness_pct\": \"100\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":2820,"wires":[[]]},{"id":"217876d8abf96aae","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light 20%","server":"bb06732d.30845","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.parker_ceiling_fan","data":"{\"brightness_pct\": \"20\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":2900,"wires":[[]]},{"id":"18a5509c0b901c38","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Evening?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"Evening","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":580,"y":2900,"wires":[["217876d8abf96aae"],[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"bb06732d.30845","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]

Ok, so this is without even importing your flow into Node-Red, but where are you getting the status for your “Automation on or off?” node to? It looks like that’s simply taking the message from your motion sensor of on/off and then turning the lights on or off depending on the activity.

If that’s the case, your override (which is what I assume you’ve attempted to include here) will never be considered. You need to keep the Motion trigger, then get the current status of the automation on or off override, and then feed that into your decision maker to decide whether to turn the lights on/off as you need

there is a separate input boolean that is turned on/off outside of this flow called input_boolean.kitchen_automation. if kitchen automation is off, the lights should stay in whatever state they are currently in so long as there is occasionally motion in the room. once there is no motion in the room for 30 minutes, it should turn the light off if it was on and then turn kitchen automation back on.

Ok, I was focusing on the complete wrong part.

So the issue is fairly straightfoward, you’ve got the flow to be “whenever the timer runs out, turn the light off”:
image
And then, once it’s been turned off, you then check the status of that automation.

So I’d alter that, swap the input off? And light off nodes so you can control that. This would make the flow:

  • Is the automation allowed?
  • Yes? Light off - and toggle as required
  • No? No actions
    Which I beleive is what you’re after?

This still isnt working. For some reason, if the automation boolean is off, when the lights are off, and motion is triggered, the lights are switching on. I adjusted as you suggested, but that didnt work

[{"id":"af8612f417bce48b","type":"comment","z":"2f95c855cb2cd6a6","name":"Parker","info":"","x":110,"y":2780,"wires":[]},{"id":"9fdc28cbbe44dc42","type":"server-state-changed","z":"2f95c855cb2cd6a6","name":"Motion","server":"9405c3fe.d0a6c","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.parker_motion_sensor_ias_zone","entityidfiltertype":"substring","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":130,"y":2920,"wires":[["6edd805c997c7f6d"]]},{"id":"6edd805c997c7f6d","type":"change","z":"2f95c855cb2cd6a6","name":"Get input_boolean state and set delays in ms","rules":[{"t":"set","p":"delay","pt":"msg","to":"$globalContext(\"homeassistant.homeAssistant.states['input_boolean.parker_automation'].state\")","tot":"jsonata"},{"t":"change","p":"delay","pt":"msg","from":"on","fromt":"str","to":"300000","tot":"num"},{"t":"change","p":"delay","pt":"msg","from":"off","fromt":"str","to":"1800000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":215,"y":2920,"wires":[[]],"l":false},{"id":"659336d110a29471","type":"trigger","z":"2f95c855cb2cd6a6","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"250","extend":false,"overrideDelay":true,"units":"ms","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":535,"y":2980,"wires":[["b58a3cce547a8f3a"]],"l":false},{"id":"c8216a4ce8da120c","type":"switch","z":"2f95c855cb2cd6a6","name":"Automation on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":360,"y":2920,"wires":[["659336d110a29471","cd867336755e02a4","18a5509c0b901c38"],["659336d110a29471"]]},{"id":"4e38033a0db12a31","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light off","server":"bb06732d.30845","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.parker_ceiling_fan, fan.parker_ceiling_fan","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1240,"y":2980,"wires":[[]]},{"id":"b58a3cce547a8f3a","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Input off?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.parker_automation","state_type":"str","blockInputOverrides":true,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":880,"y":2980,"wires":[["cfb7902164d0498a"],[]]},{"id":"cfb7902164d0498a","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Input on","server":"9405c3fe.d0a6c","version":3,"debugenabled":false,"service_domain":"homeassistant","service":"turn_on","entityId":"input_boolean.parker_automation","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":2980,"wires":[["4e38033a0db12a31"]]},{"id":"cd867336755e02a4","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Day?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"Day","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":570,"y":2840,"wires":[["f1d8aea6165f32f3"],[]]},{"id":"f1d8aea6165f32f3","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light 100%","server":"bb06732d.30845","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.parker_ceiling_fan","data":"{\"brightness_pct\": \"100\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":2820,"wires":[[]]},{"id":"217876d8abf96aae","type":"api-call-service","z":"2f95c855cb2cd6a6","name":"Light 20%","server":"bb06732d.30845","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.parker_ceiling_fan","data":"{\"brightness_pct\": \"20\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":2900,"wires":[[]]},{"id":"18a5509c0b901c38","type":"api-current-state","z":"2f95c855cb2cd6a6","name":"Evening?","server":"9405c3fe.d0a6c","version":2,"outputs":2,"halt_if":"Evening","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":580,"y":2900,"wires":[["217876d8abf96aae"],[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"bb06732d.30845","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]```