I have a ZigBee button in the shower room, and I have set up the single press to turn the extractor on, double tap to turn off and then there is a long press to turn on the lights all this has been working for weeks with no problem, using the code.
alias: Toilet button
description: ""
trigger:
- device_id: fdd21cc8f84030dba882ec1c5e073070
domain: zha
platform: device
type: remote_button_short_press
subtype: remote_button_short_press
id: one-click
- device_id: fdd21cc8f84030dba882ec1c5e073070
domain: zha
platform: device
type: remote_button_double_press
subtype: remote_button_double_press
id: two-press
- device_id: fdd21cc8f84030dba882ec1c5e073070
domain: zha
platform: device
type: remote_button_long_press
subtype: remote_button_long_press
id: long-press
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: one-click
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.toilet_extractor_switch
- conditions:
- condition: trigger
id: two-press
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.toilet_extractor_switch
- conditions:
- condition: trigger
id: long-press
sequence:
- service: light.toggle
data: {}
target:
device_id: a45df7700b8489617be33a75b807a8e5
mode: single
I have now added a timer to turn the extractor off after 30 minutes, here’s that code.
alias: Toilet Extractor Off after 30 minutes
description: ""
trigger:
- platform: device
type: turned_on
device_id: 51df02baa7139319bfe8d5e30a9028fd
entity_id: switch.toilet_extractor_switch
domain: switch
for:
hours: 0
minutes: 30
seconds: 0
condition: []
action:
- type: turn_off
device_id: 51df02baa7139319bfe8d5e30a9028fd
entity_id: switch.toilet_extractor_switch
domain: switch
mode: single
The problem is the timer only works if I turn the extractor on from HA, if I turn it on at the button it runs continuously.
Any thoughts? Thanks