Philips Hue Motion Sensor usage

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?

Thanks

Hi , I have the old Hue bridge so might be we could help each other .

can you link to your sensor , there are multiple other hubs that support
Hue lights and i think sensors .

Which ZigBee Hub or stick you are using ? You should be able to find out if it
support Hue

If you don’t have a Hue Bridge, I’d say it’s an easy choice: use your Zigbee2MQTT instance. :slight_smile: (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!

1 Like

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

For 2nd part i think it is LUMINANCE and ILLUMINANCE ? I had to google it because i did not know it too Difference Between Luminance and Illuminance | Compare the Difference Between Similar Terms

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?

Thanks

Hello Unmesh,

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

i wrote this automation

alias: Lumiere E4 Stairs motion detected
description: ''
trigger:
  - type: motion
    platform: device
    device_id: ef35cefeff77c5786fd2ca9ff4ac380a
    entity_id: binary_sensor.sensormotion_e4_stair_occupancy
    domain: binary_sensor
condition:
  - condition: or
    conditions:
      - type: is_illuminance
        condition: device
        device_id: ef35cefeff77c5786fd2ca9ff4ac380a
        entity_id: sensor.sensormotion_e4_stair_illuminance_lux
        domain: sensor
        below: 5
      - condition: device
        type: is_on
        device_id: 135bd94c52eeb37a64eec39661e8d769
        entity_id: light.bulb_e4_stair
        domain: light
action:
  - type: turn_on
    device_id: 135bd94c52eeb37a64eec39661e8d769
    entity_id: light.bulb_e4_stair
    domain: light
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - type: turn_off
    device_id: 135bd94c52eeb37a64eec39661e8d769
    entity_id: light.bulb_e4_stair
    domain: light
mode: restart

it almost works except that it is not restarting. do you know what i did wrong ?

Thx

What do you mean with “it is not restarting”. It only works the 1st time?

Have you checked if binary_sensor.sensormotion_e4_stair_occupancy is going to off and when?

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

thanks

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:

      - condition: device
        type: is_on
        device_id: 135bd94c52eeb37a64eec39661e8d769
        entity_id: light.bulb_e4_stair
        domain: light

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?

I tried using your exact code (just changed IDs)

It did not change the behavior i described

the automation needs 10 second of idle time (with no detection) to be able to restart

PS: i am using Z2M for connection, this is may be a difference

Strange, Strange, Strange :slight_smile:

Yeah, very strange. I am also using z2m for the bulbs.
Did you take a look at automation debug ?

I found THE solution (at least the one answering to my need)

instead of having a straight 20 second wait time i use the following

wait_for_trigger:
  - type: no_motion
    platform: device
    device_id: 7da78cdee4882cc68235cda757d19106
    entity_id: binary_sensor.sensormotion_e0_cave_occupancy
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 10
continue_on_timeout: false

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

Happy User :slight_smile:

Thanks for your help

4 Likes

This was a great suggestion and has fixed something that has been bugging me. Thanks!

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.

Here is my trace…

As you can see, the light never turned back off. It did not register the sensor with no-motion even though I can see it in my log…

The step that waits for no-motion before turning off the light…

So the final step did not execute…

Any ideas?

you have a timer to remove !

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

hope this could help you

Thank you for the assistance. I have now removed the timer, testing this morning though and it does not want to turn off still.

Though this time my trace is interesting - I haven’t seen this before…

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 :slight_smile: