I just got one of these and am looking for advice on whether I should use my Zigbee2MQTT integration or the Philips Hue integration that I’ve seen mentioned. I don’t have the Philips Hue Bridge and that might mean I don’t have a choice to make!
Also, what is the practical difference between illuminance and illuminance lux, both of which are exposed by the sensor?
If you don’t have a Hue Bridge, I’d say it’s an easy choice: use your Zigbee2MQTT instance. (It’s a standard Zigbee device that Philips only markets for use with their own Hue system but really works with a variety of Zigbee coordinators, including Zigbee2MQTT or Home Assistant’s own ZHA.) You could use a Hue Bridge, too, but if you don’t already have one for some reason (e.g., because you have Zigbee bulbs like Hue and want to keep them on their own network — not a bad idea, but that’s another story), then I wouldn’t do that just for this. There used to be a good reason not to use the Hue Bridge for these — the Hue integration relied on polling, with no way to “push” immediate changes from Hue to HASS — but that changed with the release of the v2 Hue API (requires the square v2 Bridge and recent-ish firmware, not the old/round v1 Bridge).
I’m not sure about illuminance vs. illuminance_lux, except that the docs say the former is the “raw” value, which I assume might be what the sensor reports natively, which Hue’s API docs say is 10000 log10 (lux) + 1. The illuminance_lux measurement is, of course, lux, which I assume is converted from this value by “reversing” that formula. I always use lux since it’s a standard unit I am familiar with, but I’d assume either could if you write your automations to account for the actual measurements you get.
I’m using the slae.sh cc2652rb USB based Zigbee coordinator and have now paired the Philips to it. I will watch the values of occupancy, illuminance and illuminance lux to see what works best for my automation needs. The lqi is only 27 even though the sensor is on the outside wall of the room with the coordinator but I don’t know if it will become prolematic.
The current controversy is that my wife is not happy with me having put the motion detector right above the front door!
Great you have it working , like you i have a lot of Mi sensors but others in the house are not happy with visible ones so I glued it to the ceiling above the door in the lamp fixture , now no one cares
I have an automation running that turns on the front porch lights for 15 minutes, using the position of the sun as a proxy for darkness until I figure out the illuminance levels. Does changing mode from Single to Restart mean that the 15 minutes will be measured from when motion detection stops rather than from when it first starts?
- id: '1640298949305'
alias: Turn porch lights on for 15 mins when motion is detected and it is dark
trigger:
- type: motion
platform: device
device_id: 58cdd7e066ed59250e9630fdb5e52242
entity_id: binary_sensor.philips_outdoor_motion_sensor_a_occupancy
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 1
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- service: light.turn_on
target:
entity_id:
- light.treatlife1_light
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- service: light.turn_off
target:
entity_id:
- light.treatlife1_light
mode: single
Also, I think that if the light had been turned on manually, say from the physical switch, then it would turn off 15 minutes after someone stepped in front of the sensor. How would I modify the automation to only perform the turn_off action if the automation was the reason the light had turned on?
I believe we might be trying the same thing. (or may be slightly different)
for the lux measure, the best thing is to let the sensor run for one day and check measured luminance and visually see form which level you wish the light to turn on. (the you just need to see what is the corresponding lux measured - for me it was 5 lux…)
My usage is to automate my light positioned in my stairs
I wish my light to switch on based on motion detection + luminance below a certain level (ie when it is really needed)
i want the light to keep on lighting 20 seconds after the last motion detection (meaning that if a motion is detected every 19s the light will never switch off
The motion sensor itself stays at ‘detected’ state for 10 seconds after the last detection.
I could not find a way to shorten this (you can extend it but if you put a value between 0 and 10 it lasts for 10 seconds.)
so if the motion sensor constantly detects motion, then it never goes to ‘false’ and my automation is not triggered despite the restart mode (indeed a transition from false to true to start this automation is needed)
to restart it needs 10 seconds of iddle with no detection and then a detection…
so i should change my automation somewhere
i hope i expressed my issue better (and sorry for not being able to do so the first time
This works for me, i did it in yaml instead of the ‘automation ui’.
Its very similar to yours, but you should tweak it for to your valours (entity_id, delay etc…) and also includes the sun elevation:
- id: pir_luz_dormitorio
alias: pir luz dormitorio
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.wemos02_pir_sensor
to: 'on'
condition:
- condition: or
conditions:
- condition: template # 'night' condition: from dusk to dawn, in typical locations
value_template: '{{ state_attr("sun.sun", "elevation") < 3 }}'
- condition: numeric_state
entity_id: sensor.dormitorio_lux
below: 6
action:
- service: light.turn_on
data:
entity_id: light.lamparacolordorm
brightness: 90
color_temp: 153
- delay: "00:00:15"
- service: light.turn_off
entity_id: light.lamparacolordorm
Oh, and probably you should get rid of this on your condition:
the last condition replaces the sun condition you added with an additional behavior:if the light is already on for any reason (because another automation has switched it on for instance) if motion is detected, light will be turned off after the 20 seconds (which is a behavior i need also)
I tried your trigger method but it did not change the behavior of the trigger. Are you using a hue motion sensor also ? i do not see a difference
In this room is not a hue motion sensor, but the behaviour its similar (i have a hue sensor in another room).
You should try all the code instead of a part for debug and find the culprit.
Or try to get rid of the light is_on condition to check if thats the problem.
Edit: have you tried with condition and instead of or?
So hue sensor waits 10 seconds for idle, puts its state off, then HA waits 10 more seconds before switching off my light. I have my requested Switch off after 20 second of no motion
and any move subsequent to the switch off instantly re-switch on
I thought I had this working but either I’ve done something wrong (most likely) or the integration is flakey, I can’t tell. At first I thought the issue was happening when the sensor detected me, I then moved out of range, but back in before 20 seconds was up to re-trigger and the light would not turn off. But now sometimes it doesnt turn off even after a simple single detection + delayed time check.
you do not need to put a timer of 10 seconds just after you switch on the lights, as long as your Hardware is a hue motion sensor, as they incorporate this 10 seconds waiting time.
I believe what happens is that the hue sensor sometimes switchs off just before the end of your 10 seconds tempo, so the sensor is already cleared before you enter in the wait for trigger mode
I think I sorted my problem (fingers crossed).
It’s possible that hue was still trying to take control so I totally reset it and selected “configure in other app”.
Anyway, its working as I want now so I’m happy