Sensor Light Blueprint Site Conditions

Hello, the template in HA has one point has the following point
Ambient Light Sensor - Site Conditions

In some cases when your lights turn ON, your ambient light sensor is affected, increasing its LUX value. This can cause the lights to go OFF prematurely. Please select an option that best suits your installation.

How can this be mapped in Node Red?
I have the problem that the lux values are only transmitted very slowly.
Light goes on, motion detector no longer detects movement and switches the light off, but the lux value is still there, movement is detected but nothing happens because the lux value is too high. How can I adjust the flow so that it works?
Thank you

Look at the output of the motion sensor. Does it have an entry timeSinceChangedMs?

image

You can use a switch node to bypass the lux node if the time since last changed is so many seconds. Meaning the amount of time that the lux sensor takes to recover. This example would allow a bypass if the last time the motion sensor was triggered is less than 5 seconds.

image

1 Like

I will try , it is a hue motion sensor

There is this information
16.3.2024, 09:13:47node: debug 3binary_sensor.sensorflurog_occupancy : msg.payload : string[3]

โ€œoffโ€

import this flow

[{"id":"3bef1e230515a96e","type":"api-current-state","z":"60f2d2277843c698","name":"","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"","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":620,"y":2520,"wires":[["16bb88cd11b0ca0a"]]},{"id":"e62a2859e9f7ce6e","type":"inject","z":"60f2d2277843c698","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":2520,"wires":[["3bef1e230515a96e"]]},{"id":"16bb88cd11b0ca0a","type":"debug","z":"60f2d2277843c698","name":"debug 171","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":2520,"wires":[]}]

Put the motion sensor in the current state node. Deploy. Press inject.

In the debug hit the copy value icon next to payload, then post the results here.

image

you are right
context: object

timeSinceChangedMs: 325012

But under the note event state, when i choose the motion sensor, i cant choose msg.data entity

Use that path in a switch node, not the event state.

image

Place the switch right after the event state.

image

1 Like

But now every time a come to the motion sensor, the light will go on.

Select all the nodes in the flow. Right click and choose export. Click copy to clip board in the dialog box that pops up. Then post the code here. Encase the code in 3 backticks.

```
Paste code here
```

[{"id":"6f11b03d63add176","type":"server-state-changed","z":"83aac7ec10827c26","name":"Bewegung Flur EG erkannt","server":"166521b8.009eae","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.sensorflureg_occupancy","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"off","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"30","forType":"num","forUnits":"seconds","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":150,"y":120,"wires":[["1967a1d5af43cb7d"],["4581082005c407d1"]]},{"id":"e12b49f475826cbd","type":"api-current-state","z":"83aac7ec10827c26","name":"Helligkeit Flur EG unter 40 Lux","server":"166521b8.009eae","version":3,"outputs":2,"halt_if":"40","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.sensorflureg_illuminance_lux","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":710,"y":140,"wires":[["a19b14c7f72eef9f"],[]]},{"id":"a19b14c7f72eef9f","type":"time-range-switch","z":"83aac7ec10827c26","name":"von 5-23 Uhr","lat":"","lon":"","startTime":"05:00","endTime":"23:00","startOffset":0,"endOffset":0,"x":750,"y":220,"wires":[["b99aeed8ee4032f5"],["e524beef642a2307"]]},{"id":"b99aeed8ee4032f5","type":"api-call-service","z":"83aac7ec10827c26","name":"Flur EG Lampe an","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"{\"brightness_pct\":\"13\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1150,"y":120,"wires":[[]]},{"id":"e524beef642a2307","type":"api-call-service","z":"83aac7ec10827c26","name":"Flur EG Lampe an","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"{\"brightness\":\"5\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1190,"y":180,"wires":[[]]},{"id":"e0db86beee76c698","type":"comment","z":"83aac7ec10827c26","name":"Flur EG","info":"","x":110,"y":60,"wires":[]},{"id":"1967a1d5af43cb7d","type":"api-call-service","z":"83aac7ec10827c26","name":"Flur EG Lampe aus","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":470,"y":60,"wires":[[]]},{"id":"4581082005c407d1","type":"switch","z":"83aac7ec10827c26","name":"","property":"data.new_state.timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gt","v":"5000","vt":"num"},{"t":"lte","v":"5000","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":120,"wires":[["e12b49f475826cbd"],["a19b14c7f72eef9f"]]},{"id":"166521b8.009eae","type":"server","name":"Home Assistant","addon":true}]

You will need to go to the right side hamburger menu, choose manage palette. Look for and install the traffic node. Then import the flow

[{"id":"6f11b03d63add176","type":"server-state-changed","z":"60f2d2277843c698","name":"Bewegung Flur EG erkannt","server":"166521b8.009eae","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.sensorflureg_occupancy","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"off","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"30","forType":"num","forUnits":"seconds","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":320,"y":2480,"wires":[["1967a1d5af43cb7d"],["e12b49f475826cbd","bac92c2814ae3513"]]},{"id":"e12b49f475826cbd","type":"api-current-state","z":"60f2d2277843c698","name":"Helligkeit Flur EG unter 40 Lux","server":"166521b8.009eae","version":3,"outputs":2,"halt_if":"40","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.sensorflureg_illuminance_lux","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":670,"y":2480,"wires":[["a19b14c7f72eef9f"],[]]},{"id":"a19b14c7f72eef9f","type":"time-range-switch","z":"60f2d2277843c698","name":"von 5-23 Uhr","lat":"","lon":"","startTime":"05:00","endTime":"23:00","startOffset":0,"endOffset":0,"x":1050,"y":2580,"wires":[["b99aeed8ee4032f5"],["e524beef642a2307"]]},{"id":"b99aeed8ee4032f5","type":"api-call-service","z":"60f2d2277843c698","name":"Flur EG Lampe an","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"{\"brightness_pct\":\"13\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1350,"y":2520,"wires":[[]]},{"id":"e524beef642a2307","type":"api-call-service","z":"60f2d2277843c698","name":"Flur EG Lampe an","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"{\"brightness\":\"5\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1350,"y":2580,"wires":[[]]},{"id":"e0db86beee76c698","type":"comment","z":"60f2d2277843c698","name":"Flur EG","info":"","x":280,"y":2420,"wires":[]},{"id":"1967a1d5af43cb7d","type":"api-call-service","z":"60f2d2277843c698","name":"Flur EG Lampe aus","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":2420,"wires":[["894d64d3d5eb8fbd"]]},{"id":"4581082005c407d1","type":"switch","z":"60f2d2277843c698","name":"","property":"data.new_state.timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gt","v":"5000","vt":"num"},{"t":"lte","v":"5000","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":850,"y":2580,"wires":[[],["a19b14c7f72eef9f"]]},{"id":"bac92c2814ae3513","type":"traffic","z":"60f2d2277843c698","name":"","property_allow":"payload","filter_allow":"allow","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"stop","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":690,"y":2580,"wires":[["4581082005c407d1"]]},{"id":"894d64d3d5eb8fbd","type":"trigger","z":"60f2d2277843c698","name":"","op1":"allow","op2":"stop","op1type":"str","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":910,"y":2420,"wires":[["bac92c2814ae3513"]]},{"id":"166521b8.009eae","type":"server","name":"Home Assistant","addon":true}]
1 Like

I missed one setting, inside the trigger node

image

Check the box extend delay if new message received.

image

1 Like

i will try an give you a feedback tommorow, when there is more light in the house :slight_smile:

1 Like

sry, but it dont work, when i pass the sensor and the lux level is okay, i dont go on. That is okay . But when i pass the sensor and traffic light node stand on allow. the light on also is over the lux value. What can be wrong.

Thank you for your work very much. :slight_smile:

Okay I made an adjustment. There is a delay node set for 2 min. This should be set so that it is a little longer than the time it takes for the lux sensor to reset.


[{"id":"6f11b03d63add176","type":"server-state-changed","z":"60f2d2277843c698","name":"Bewegung Flur EG erkannt","server":"166521b8.009eae","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.sensorflureg_occupancy","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"off","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"30","forType":"num","forUnits":"seconds","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":300,"y":4660,"wires":[["1967a1d5af43cb7d"],["e12b49f475826cbd","bac92c2814ae3513"]]},{"id":"e12b49f475826cbd","type":"api-current-state","z":"60f2d2277843c698","name":"Helligkeit Flur EG unter 40 Lux","server":"166521b8.009eae","version":3,"outputs":2,"halt_if":"40","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.sensorflureg_illuminance_lux","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":650,"y":4660,"wires":[["a19b14c7f72eef9f","7c1072ac0c13063c"],[]]},{"id":"a19b14c7f72eef9f","type":"time-range-switch","z":"60f2d2277843c698","name":"von 5-23 Uhr","lat":"","lon":"","startTime":"05:00","endTime":"23:00","startOffset":0,"endOffset":0,"x":1070,"y":4760,"wires":[["b99aeed8ee4032f5"],["e524beef642a2307"]]},{"id":"b99aeed8ee4032f5","type":"api-call-service","z":"60f2d2277843c698","name":"Flur EG Lampe an","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"{\"brightness_pct\":\"13\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":4700,"wires":[[]]},{"id":"e524beef642a2307","type":"api-call-service","z":"60f2d2277843c698","name":"Flur EG Lampe an","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"{\"brightness\":\"5\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1330,"y":4760,"wires":[[]]},{"id":"e0db86beee76c698","type":"comment","z":"60f2d2277843c698","name":"Flur EG","info":"","x":260,"y":4600,"wires":[]},{"id":"1967a1d5af43cb7d","type":"api-call-service","z":"60f2d2277843c698","name":"Flur EG Lampe aus","server":"166521b8.009eae","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.flureg"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":620,"y":4600,"wires":[["500721583141bc81"]]},{"id":"4581082005c407d1","type":"switch","z":"60f2d2277843c698","name":"","property":"data.new_state.timeSinceChangedMs","propertyType":"msg","rules":[{"t":"gt","v":"5000","vt":"num"},{"t":"lte","v":"5000","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":870,"y":4760,"wires":[[],["a19b14c7f72eef9f"]]},{"id":"bac92c2814ae3513","type":"traffic","z":"60f2d2277843c698","name":"","property_allow":"payload","filter_allow":"allow","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"stop","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":710,"y":4760,"wires":[["4581082005c407d1"]]},{"id":"7c1072ac0c13063c","type":"change","z":"60f2d2277843c698","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"allow","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":935,"y":4660,"wires":[["bac92c2814ae3513"]],"l":false},{"id":"500721583141bc81","type":"delay","z":"60f2d2277843c698","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":800,"y":4600,"wires":[["749e43826ecc9db6"]]},{"id":"749e43826ecc9db6","type":"change","z":"60f2d2277843c698","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":895,"y":4600,"wires":[["bac92c2814ae3513"]],"l":false},{"id":"166521b8.009eae","type":"server","name":"Home Assistant","addon":true}]
1 Like

i think now it woks correct.

thank you for your patience and your knowledge