Activating flow using home assistant binary motion detection entity

Hello all

I'm new to Node-Red (NR).

I have NR installed as an addon in Home assistant. As my first flow I would like to trigger a light to go on and of based upon motion detection, time of day and luminosity. I also would like to have the light turn on at a certain % of lux at certain time of day (such as waking up to pee at night).

I am using the motion detection binary entity of Aeotec multisensor 6 to turn on a shelly dimmable light.

I have this automation working in home assistant. However i would like to transition my automations to NR.

As such i start the flow using event state from the home assistant pallet and configured the following way

Entity : the correct binary entity for the aeotec motion senser for the correct floor
If State: IS ON

state type: string
no other selection checked

This node is wired to a bigtime node which in turn i wired to a current state node (illuminance) which is wired to the light
If i trigger the event with the deploy button the event starts and finishes correctly

however

If i pass in front of the motion sensor, the motion sensor is activated but the flow is not

If i install an inject node and wire it to the bigtime node, bypassing the motion sensor, I would press the inject node and the flow completes successfully.

What could be the issue?

In addition I submitted my issue to the home assistant community and the replicate the same issue

Thank you in advance for any help provided

Welcome to the forum @wbravin

Start by adding debug nodes to your flow to work out which node is not behaving as you expect.

Thank you for your prompt reply

I do have debug nodes at each step of the flow

Here are the results

10/18/2023, 8:50:43 AM[node: debug 2](http://192.168.1.112:8123/api/hassio_ingress/JeXK6fWVzk2zs66R1f1inIgAejGgIEVbYkOEpL_3X6Q/#)msg : Object

object

payload: "OFF"

topic: ""

state: "auto"

value: 0

autoState: 0

manualState: 0

timeout: 0

temporaryManual: 0

permanentManual: 0

now: 530

timer: 0

duration: 550

stamp: 1697611841621

extState: "OFF for 09hrs 10mins"

_msgid: "a1c9bbd3da96103b"

10/18/2023, 8:50:43 AM[node: debug 3](http://192.168.1.112:8123/api/hassio_ingress/JeXK6fWVzk2zs66R1f1inIgAejGgIEVbYkOEpL_3X6Q/#)msg : Object

object

payload: 2

topic: ""

state: "auto"

value: 0

autoState: 0

manualState: 0

timeout: 0

temporaryManual: 0

permanentManual: 0

now: 530

timer: 0

duration: 550

stamp: 1697611841621

extState: "OFF for 09hrs 10mins"

_msgid: "a1c9bbd3da96103b"

data: object

entity_id: "sensor.entrance_hall_sensor_illuminance"

state: 2

attributes: object

last_changed: "2023-10-18T05:53:46.454Z"

last_updated: "2023-10-18T05:53:46.454Z"

context: object

timeSinceChangedMs: 3415176

original_state: "2.0"

10/18/2023, 8:50:43 AM[node: debug 4](http://192.168.1.112:8123/api/hassio_ingress/JeXK6fWVzk2zs66R1f1inIgAejGgIEVbYkOEpL_3X6Q/#)msg : Object

object

payload: 2

topic: ""

state: "auto"

value: 0

autoState: 0

manualState: 0

timeout: 0

temporaryManual: 0

permanentManual: 0

now: 530

timer: 0

duration: 550

stamp: 1697611841621

extState: "OFF for 09hrs 10mins"

_msgid: "a1c9bbd3da96103b"

data: object

brightness_pct: 60

10/18/2023, 8:50:43 AM[node: debug 4](http://192.168.1.112:8123/api/hassio_ingress/JeXK6fWVzk2zs66R1f1inIgAejGgIEVbYkOEpL_3X6Q/#)msg : Object

object

payload: 2

topic: ""

state: "auto"

value: 0

autoState: 0

manualState: 0

timeout: 0

temporaryManual: 0

permanentManual: 0

now: 530

timer: 0

duration: 550

stamp: 1697611841621

extState: "OFF for 09hrs 10mins"

_msgid: "a1c9bbd3da96103b"

data: object

entity_id: "sensor.entrance_hall_sensor_illuminance"

state: 2

attributes: object

state_class: "measurement"

unit_of_measurement: "lx"

device_class: "illuminance"

friendly_name: "Entrance Hall Sensor Illuminance"

last_changed: "2023-10-18T05:53:46.454Z"

last_updated: "2023-10-18T05:53:46.454Z"

context: object

id: "01HD0NHRYPR5EB1FMEVQNT5FFG"

parent_id: null

user_id: null

timeSinceChangedMs: 3415176

original_state: "2.0"

brightness_pct: 30

10/18/2023, 8:51:13 AM[node: debug 5](http://192.168.1.112:8123/api/hassio_ingress/JeXK6fWVzk2zs66R1f1inIgAejGgIEVbYkOEpL_3X6Q/#)msg : Object

object

payload: 2

topic: ""

state: "auto"

value: 0

autoState: 0

manualState: 0

timeout: 0

temporaryManual: 0

permanentManual: 0

now: 530

timer: 0

duration: 550

stamp: 1697611841621

extState: "OFF for 09hrs 10mins"

_msgid: "a1c9bbd3da96103b"

data: object

entity_id: "sensor.entrance_hall_sensor_illuminance"

state: 2

attributes: object

last_changed: "2023-10-18T05:53:46.454Z"

last_updated: "2023-10-18T05:53:46.454Z"

context: object

timeSinceChangedMs: 3415176

original_state: "2.0"

10/18/2023, 8:51:14 AM[node: debug 6](http://192.168.1.112:8123/api/hassio_ingress/JeXK6fWVzk2zs66R1f1inIgAejGgIEVbYkOEpL_3X6Q/#)msg.payload : number

Please bare in mind that debug1 does not show up. This debug node is connected to the event state node .

this is the issue is that a) this node has a red square at the bottom left corner and i cannot make it green regardless of the suttup configuration.

This is where we are all stumped

Again Thank you for responding

Since we don't know the details of your flow the debug output is of little help. Please select the nodes of interest (only those necessary to see the problem) and use the menu Export to copy to the clipboard and paste it here. When pasting use the </> button at the top of the forum entry window to stop the forum messing with the format.

Do you mean that the HA Event State node is not triggering? If so it is unlikely that anyone here can help as few here use HA, preferring to do everything in Node Red.

Hello Thanks @Colin for your patience and time

I'm also new to these processes so i hope this is what you mean

[{"id":"e901b5dfd444e4a5","type":"tab","label":"Stairs Light Control","disabled":false,"info":"to control all entrance and stairwell lights","env":[]},{"id":"d0d4bd828a93a1db","type":"delay","z":"e901b5dfd444e4a5","name":"30 Sec Delay","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":910,"y":400,"wires":[["08e7e1e6fafb4c5b","69290bb86647a390"]]},{"id":"ceb6baaac58a9232","type":"api-call-service","z":"e901b5dfd444e4a5","name":"Entrance Hall Night Light on","server":"8687e46ec9bc620c","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["entrance_hall"],"deviceId":[],"entityId":["light.entrance_hall_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"brightness_pct","propertyType":"msg","value":"30","valueType":"num"}],"queue":"none","x":860,"y":320,"wires":[["95df5fb9b8cf7c29"]]},{"id":"7c9778648d1e2427","type":"bigtimer","z":"e901b5dfd444e4a5","outtopic":"","outpayload1":"On","outpayload2":"OFF","name":"Day Schedular","comment":"","lat":"46.08429","lon":"12.47402","starttime":"1080","endtime":1425,"starttime2":"1425","endtime2":"450","startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"on","outtext2":"off","timeout":"0","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":0,"xmonth7":0,"xday8":0,"xmonth8":0,"xday9":0,"xmonth9":0,"xday10":0,"xmonth10":0,"xday11":0,"xmonth11":0,"xday12":0,"xmonth12":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":340,"y":280,"wires":[["f6695991abdf38a2","2b3184bf33942fd8"],[],[]]},{"id":"f6695991abdf38a2","type":"api-current-state","z":"e901b5dfd444e4a5","name":"Illuminance","server":"8687e46ec9bc620c","version":3,"outputs":2,"halt_if":"4","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.entrance_hall_sensor_illuminance","state_type":"num","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":550,"y":280,"wires":[["f17df4d1a6d2d4e1","ceb6baaac58a9232","d0d4bd828a93a1db","3c90b92e70c5cf40"],["08e7e1e6fafb4c5b"]]},{"id":"f17df4d1a6d2d4e1","type":"api-call-service","z":"e901b5dfd444e4a5","name":"Entrance Hall Evening Light on","server":"8687e46ec9bc620c","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["entrance_hall"],"deviceId":["b84f023137ed2a83ed872a779abd8a8e"],"entityId":["light.entrance_hall_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"brightness_pct","propertyType":"msg","value":"60","valueType":"num"}],"queue":"none","x":870,"y":260,"wires":[["95df5fb9b8cf7c29"]]},{"id":"f4aacc9aac952103","type":"inject","z":"e901b5dfd444e4a5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":110,"y":140,"wires":[[]]},{"id":"08e7e1e6fafb4c5b","type":"api-call-service","z":"e901b5dfd444e4a5","name":"","server":"8687e46ec9bc620c","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":["entrance_hall"],"deviceId":["b84f023137ed2a83ed872a779abd8a8e"],"entityId":["light.entrance_hall_light"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":560,"wires":[["9ef58e1fd63d2fef"]]},{"id":"4ba22f749ae37694","type":"debug","z":"e901b5dfd444e4a5","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":380,"y":140,"wires":[]},{"id":"2b3184bf33942fd8","type":"debug","z":"e901b5dfd444e4a5","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":140,"wires":[]},{"id":"3c90b92e70c5cf40","type":"debug","z":"e901b5dfd444e4a5","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":800,"y":140,"wires":[]},{"id":"95df5fb9b8cf7c29","type":"debug","z":"e901b5dfd444e4a5","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1060,"y":140,"wires":[]},{"id":"69290bb86647a390","type":"debug","z":"e901b5dfd444e4a5","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1260,"y":140,"wires":[]},{"id":"9ef58e1fd63d2fef","type":"debug","z":"e901b5dfd444e4a5","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1240,"y":340,"wires":[]},{"id":"3564f1af07a6d100","type":"server-state-changed","z":"e901b5dfd444e4a5","name":"Motion Dtection","server":"8687e46ec9bc620c","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.entrance_hall_sensor_motion_detection","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"on","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":false,"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":120,"y":280,"wires":[["7c9778648d1e2427","4ba22f749ae37694"],[]]},{"id":"be836a5ad495a120","type":"light-scheduler","z":"e901b5dfd444e4a5","settings":"6a6d6587855f656c","events":"[{\"start\":{\"dow\":2,\"mod\":1070},\"end\":{\"dow\":3,\"mod\":0}},{\"start\":{\"dow\":3,\"mod\":1075},\"end\":{\"dow\":4,\"mod\":0}},{\"start\":{\"dow\":4,\"mod\":1075},\"end\":{\"dow\":5,\"mod\":0}},{\"start\":{\"dow\":5,\"mod\":1080},\"end\":{\"dow\":6,\"mod\":0}},{\"start\":{\"dow\":6,\"mod\":1080},\"end\":{\"dow\":0,\"mod\":0}},{\"start\":{\"dow\":0,\"mod\":1075},\"end\":{\"dow\":1,\"mod\":0}},{\"start\":{\"dow\":1,\"mod\":0},\"end\":{\"dow\":1,\"mod\":470}},{\"start\":{\"dow\":2,\"mod\":0},\"end\":{\"dow\":2,\"mod\":470}},{\"start\":{\"dow\":3,\"mod\":0},\"end\":{\"dow\":3,\"mod\":470}},{\"start\":{\"dow\":4,\"mod\":0},\"end\":{\"dow\":4,\"mod\":470}},{\"start\":{\"dow\":5,\"mod\":0},\"end\":{\"dow\":5,\"mod\":470}},{\"start\":{\"dow\":0,\"mod\":0},\"end\":{\"dow\":0,\"mod\":470}},{\"start\":{\"dow\":6,\"mod\":0},\"end\":{\"dow\":6,\"mod\":470}}]","topic":"","name":"Light Schedules","onPayload":"ON","onPayloadType":"str","offPayload":"OFF","offPayloadType":"str","onlyWhenDark":true,"scheduleRndMax":0,"sunElevationThreshold":6,"sunShowElevationInStatus":true,"outputfreq":"output.statechange.startup","x":380,"y":480,"wires":[[]]},{"id":"a070398642c7183e","type":"ha-device","z":"e901b5dfd444e4a5","name":"sensor","server":"8687e46ec9bc620c","version":1,"exposeAsEntityConfig":"","inputs":0,"deviceType":"trigger","device":"53071347466f09649554148757651809","event":{"platform":"device","device_id":"53071347466f09649554148757651809","domain":"zwave_js","type":"state.node_status","entity_id":"64f3dee4bbf079df7ea104a154e2396b","metadata":{"secondary":true}},"capabilities":[{"name":"from","type":"select","value":"asleep"},{"name":"to","type":"select","value":"awake"},{"name":"for","type":"positive_time_period_dict","value":2,"unit":"seconds"}],"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":390,"y":420,"wires":[[]]},{"id":"8687e46ec9bc620c","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"numeric","statusMonth":"short","statusDay":"2-digit","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":false},{"id":"6a6d6587855f656c","type":"light-scheduler-settings","name":"Home","latitude":"46.08429","longitude":"12.47402"}]

Once again thank you

If you see nothing Debug 1 then that means it is the Event State node that is not doing what it should (so the rest of the flow is irrelevant). Unfortunately, as I said, few here use HA so it is likely that no-one here can help. The HA nodes are maintained by HA not the node-red team.

Thank you @Colin

As i mentioned, I raised this issue to HA and i got back that they too encountered the same issue .

Thank you for then time and the help you provided on this issue

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