My motion and turn_on services work in my automation. But when the motion sensor detects NO motion, the lights should turn off after 1 minute… somehow my automation won’t work…
Can someone please have a look and help me out ???
You automations are ambiguous. Do you want the lights to turn on by motion AND darkness outside (sensor.hue_motion_achtertuin_illuminance) or do you want to turn on the lights on motion OR darkness outside?
When it’s dark outside, the lights should go on when detecting motion. The lights should go on for max 2 minutes and go of if no motion is detected after those 2 minutes.
i tend to use two triggers for state changes for off → on and on → off because it did happen in the past, that binary_sensors triggered without change (that is: sensor is off, becomes unavailable, returns back in and reports off again)
only if the motion sensor changed off → on (trigger-id: ‘on’) and the illuminance sensor reports a value below 10, lights are turned on. No need to check the current state of the switched lights, you can turn them on again.
if the motion sensor changes on → off for more than 2 minutes, the lights are turned off, despite their current state and even when it’s light outside. Since the lights should already be off, this doesn’t harm.