Hello, I have this code to turn on the light with the motion sensor:
- id: motion_light
alias: Turn on the light when motion detected and not too much light and light not already on
trigger:
- entity_id: binary_sensor.front_door_motion_sensor
platform: state
to: 'on'
condition:
- condition: state
entity_id: light.hue_hall
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.motion_lights_on
- service: light.turn_on
data:
entity_id: light.hue_hall
brightness: 200
which turns on the light whenever the motion is detected and saves sets the input boolean, that motion lights are on (for the purpose of switching off, see later).
Then I have another automation, which turns motion lights off:
- id: motion_light_off
alias: Turn off the light turned on by motion
trigger:
- entity_id: binary_sensor.front_door_motion_sensor
platform: state
to: 'off'
for:
seconds: 60
condition:
- condition: state
entity_id: input_boolean.motion_lights_on
state: 'on'
action:
- service: light.turn_off
entity_id: light.hue_hall
- service: input_boolean.turn_off
entity_id: input_boolean.motion_lights_on
These 2 work perfectly fine 95% of times. Sometimes I find this in the logbook:
7:40 PM Hue Hall turned on
7:40 PM Motion lights on turned off
7:40 PM Hue Hall turned off
7:40 PM Turn off the light turned on by motion has been triggered
7:39 PM Front door motion sensor cleared (no motion detected)
The Hue hall just turns on by itself with no reason and never goes off. Can somebody help me how to debug this? Sensor is using third party library, but I don’t think the problem is there. Sensor is set to “Do nothing” in the official hue app.