Hi there - I’ve a problem with an automation that I can’t seem to get to the bottom of. What I want to happen is pretty simple and all the bits work on their own but the combination doesn’t work.
What I want to achieve is this: I have a Tuya presence sensor (ZY-M100) and a Candeo dimmer mains light in the same room. If there’s no one in the room for 5 minutes and the light is on, then light should turn off (YAML below but note I’ve set the ‘timer’ to 1 minute for testing).
Key bits of information:
- As currently configured the automation doesn’t trigger - if I run it manual the light turns off.
- Previously this was all working with a simple PIR sensor (all connected via zigbee). e.g. light would turn off after 5 minutes (but being a PIR if you sit still it would turn off too)
- The Tuya sensor seems to be fine - detects and clears occupancy as expected. If I create an automation that turns the light on when someone is present that works fine.
- Probably key information. If I don’t include a delay - so light should turn off as soon as no occupancy detected then it works fine (i.e. the light turns of as soon as someone leaves).
I think the problem is this: So as far as I can see there’s some interaction between the Tuya presence sensory and the requirement for it to be clear for 5 minutes - is that possible? If so how do I fix it? I’ve checked and it’s not flickering on and off due to - for example - poor detection. It stays off when someone isn’t in the room. I’m totally stumped!
Here’s the YAML - note the ‘timer’ is set to 1 minute while I was testing things.
alias: Lounge_MainLight_OFF_NoOneInRoom
description: Turn the light off if no-one is in the room
trigger:
- type: not_occupied
platform: device
device_id: 9f4cb851879afc5e853948ff7a82b0bb
entity_id: 2424061c5e6a0cfda05723748d1bb4f4
domain: binary_sensor
for:
hours: 0
minutes: 1
seconds: 0
condition:
- condition: device
type: is_on
device_id: beb99c5030fceb9a089d4b4374ae37a0
entity_id: 441231c27be06e0b7fa9d2d743088549
domain: light
action:
- type: turn_off
device_id: beb99c5030fceb9a089d4b4374ae37a0
entity_id: 441231c27be06e0b7fa9d2d743088549
domain: light
mode: single