Skip to content

Instantly share code, notes, and snippets.

@pale2hall
Created June 4, 2024 17:47
Show Gist options
  • Save pale2hall/cd7ce883365e8a93979d4e37d8943089 to your computer and use it in GitHub Desktop.
Save pale2hall/cd7ce883365e8a93979d4e37d8943089 to your computer and use it in GitHub Desktop.
blueprint:
name: "Turn Off Zigbee Bulb on Physical Toggle with Delay"
description: >
This blueprint detects when a Zigbee bulb is physically toggled (power cycled),
turns it off automatically, and includes a delay to prevent immediate re-triggering.
domain: automation
input:
zigbee_bulb:
name: Zigbee Bulb
description: The Zigbee bulb to control
selector:
entity:
domain: light
delay_seconds:
name: Delay Seconds
description: The number of seconds to delay before the automation can run again
default: 10
selector:
number:
min: 1
max: 60
unit_of_measurement: seconds
variables:
zigbee_bulb: !input zigbee_bulb
delay_seconds: !input delay_seconds
trigger:
- platform: state
entity_id: !input zigbee_bulb
from: 'off'
to: 'on'
for:
seconds: 2
condition:
- condition: state
entity_id: input_boolean.zigbee_bulb_delay_active
state: 'off'
action:
- service: light.turn_off
target:
entity_id: !input zigbee_bulb
- service: input_boolean.turn_on
target:
entity_id: input_boolean.zigbee_bulb_delay_active
- delay: "{{ delay_seconds }}"
- wait_template: >
{{ is_state(zigbee_bulb, 'off') }}
- service: input_boolean.turn_off
target:
entity_id: input_boolean.zigbee_bulb_delay_active
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment