Binary sensor with illuminance with node red

Hi there,

i have the following automation for my light in the corridor:

> [{"id":"af7416ee.37c178","type":"tab","label":"Deckenlampe Flur","disabled":false,"info":""},{"id":"1c73597d.5bfbdf","type":"switch","z":"af7416ee.37c178","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":200,"wires":[["cb6dcae0.000078"],["bff73bf3.6b1518"]]},{"id":"94211752.509d4","type":"api-call-service","z":"af7416ee.37c178","name":"Tag ","server":"818794df.29c548","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.deckenlampe_flur","data":"{\"brightness_pct\":100}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1410,"y":40,"wires":[["bff73bf3.6b1518"]]},{"id":"20686e7d.bb3402","type":"api-call-service","z":"af7416ee.37c178","name":"","server":"818794df.29c548","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.deckenlampe_flur","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1450,"y":360,"wires":[[]]},{"id":"bff73bf3.6b1518","type":"trigger","z":"af7416ee.37c178","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"30","extend":false,"overrideDelay":false,"units":"s","reset":"true","bytopic":"all","topic":"topic","outputs":1,"x":1130,"y":300,"wires":[["20686e7d.bb3402"]]},{"id":"5f545cca.2c7614","type":"trigger-state","z":"af7416ee.37c178","name":"","server":"818794df.29c548","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.flur_bewegungsmeldung_occupancy","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"bool","comparatorValue":"true","propertyValue":"new_state.state"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"bool","comparatorValue":"false","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"habool","x":290,"y":200,"wires":[["1c73597d.5bfbdf"],["1c73597d.5bfbdf"]]},{"id":"fb93c45b.161b9","type":"trigger","z":"af7416ee.37c178","name":"","op1":"","op2":"1","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":380,"y":440,"wires":[["a5ad5640.15adc"]]},{"id":"cb6dcae0.000078","type":"time-range-switch","z":"af7416ee.37c178","name":"Tag 6:30-23:00","lat":"","lon":"","startTime":"6:30","endTime":"23:00","startOffset":0,"endOffset":0,"x":1120,"y":80,"wires":[["94211752.509d4"],["69b2e451.820ab4"]]},{"id":"69b2e451.820ab4","type":"api-call-service","z":"af7416ee.37c178","name":"Nacht","server":"818794df.29c548","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.deckenlampe_flur","data":"{\"brightness_pct\":30}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1410,"y":160,"wires":[["bff73bf3.6b1518"]]},{"id":"3ae1175c.893398","type":"api-call-service","z":"af7416ee.37c178","name":"Tag ","server":"818794df.29c548","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.flur_deckenlampe","data":"{\"brightness_pct\":100}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":380,"wires":[[]]},{"id":"679b5aff.b6b4dc","type":"api-call-service","z":"af7416ee.37c178","name":"Nacht","server":"818794df.29c548","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.flur_deckenlampe","data":"{\"brightness_pct\":30}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":500,"wires":[[]]},{"id":"a5ad5640.15adc","type":"time-range-switch","z":"af7416ee.37c178","name":"Tag 6:30-23:00","lat":"","lon":"","startTime":"6:30","endTime":"23:00","startOffset":0,"endOffset":0,"x":580,"y":440,"wires":[["3ae1175c.893398"],["679b5aff.b6b4dc"]]},{"id":"d90859a9.395268","type":"server-state-changed","z":"af7416ee.37c178","name":"Deckenlampe Flur","server":"818794df.29c548","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.deckenlampe_flur","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"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":150,"y":440,"wires":[["fb93c45b.161b9"],[]]},{"id":"818794df.29c548","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

is there a way to include the binary sensor illuminance from philips hue, that the light will not turn on, if occupancy was detected a motion, if the brightness in the room ist brighter than pe. 50 lx?

Regards

I don’t know dutch, and can’t decipher exactly what is going on in your flow. However, I do have a similar automation in nodered. The flow only allows a motion sensor to turn the light on if the room is dark enough. Here is what the relevant portion of the flow looks like:

Untitled

Note it’s very similar to what you already have, using a time range first (which is fed by a motion sensor in the room, and filtered with presence entities so lights don’t go on when my dog moves while we are not home). In my case, the lum check is only used at night time. The reason for this is there is a bit of delay on the lum sensor, which can lead to conditions where lum state is high, while lights are off, and motion is detected (stuck in a dark room if that happens). In my case, skipping lums at night was better than increasing the report rate of the lum sensor (less HA traffic this way, and guaranteed to never be left in the dark).

For your application, you just need to add one node to check lums before calling the light on service (without knowing dutch, guessing between the time range and “tag” nodes).

On a side note, reading your post I could infer that the hue bulbs have a sensor built in? Is this the case? If so that’s pretty cool… I’m using lum chips attached to esphome devices now, but having a sensor in some bulbs might be useful.

1 Like

thank you, first of all it isn’t dutch, it’s german :smiley:
I use the philips hue motion sensor to control my shellys.

I will try it later and give a feedback :slight_smile:

thanks, it works :slight_smile: