Philips Hue Sensor turning off light

Hi,
I have a Philips Hue sensor which turns on a switch (Wemo or Sonoff Matsuoka) as per below. I’ve found that when the sensor stops detecting movement it switches the switch off. In my automations.yaml file I am only triggering when the light turns on and then waiting for a timer to complete.

Why does HA turn off the light when the state changes although it is not specified???

- id: '1541311163574'
  alias: Outside Light Sensor
  trigger:
  - entity_id: sensor.motion_outside_table
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  action:
  - data: {}
    entity_id: switch.outside_light
    service: switch.turn_on
  - delay: 00:05:00
  - entity_id: switch.outside_light
    service: switch.turn_off

So this is happening because as soon as the motion sensor resets back to off, which in the case of the Hue’s, its 10 seconds, it then starts the timer. If you trip the motion sensor again, the timer WON’T reset, so it will still be counting down from 5 minutes from the first time it changed back to off. There is probably a clever way to do this all in one automation, there was a thread somewhere about it if you have a search around for it. But I just did it will two automation’s,

- alias: Chandelier Motion On
  trigger:
  - entity_id: sensor.downstairs_motion_motion_sensor
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: switch.chandelier_2
    service: switch.turn_on


- alias: Chandelier Motion off
  trigger:
  - entity_id: sensor.downstairs_motion_motion_sensor
    from: 'on'
    platform: state
    to: 'off'
    for:
      seconds: 20
  condition: []
  action:
  - data:
      entity_id: switch.chandelier_2
    service: switch.turn_off

The important bit there is the

to: 'off'
for:
  seconds: 20

So it will only turn it off IF the motion sensor has been off for 20 seconds, so in your case, if you have

to: 'off'
for:
  minutes: 5

Then after 5 minutes of no motion from the sensor, then it will switch the plug off.

As above, sure there is a better way of doing it, but this works for me.

1 Like

Thanks, this is brilliant!!
I was starting to think the same. Why don’t I somehow mask the sensor off.
Thanks again…great work!

You could try canceling & restarting the timer whenever the motion sensor is triggered. As long as the sensor is triggering, the timer is reset and the light stays on.

Like this:

  action:
  - data:
    entity_id: timer.garage
    service: timer.cancel
  - data:
    entity_id: timer.garage
    service: timer.start

Hope this helps

That’s exactly what I do in my automation. It says in the documentation that time.start is supposed to restart the timer if already running, but it doesn’t. So I preceeded it with a cancel timer.