Skip to content

Instantly share code, notes, and snippets.

@osk2
Last active December 28, 2025 12:46
Show Gist options
  • Select an option

  • Save osk2/22fce0244e20ee44ab27d70f7a1c5d45 to your computer and use it in GitHub Desktop.

Select an option

Save osk2/22fce0244e20ee44ab27d70f7a1c5d45 to your computer and use it in GitHub Desktop.
ha-scene-swtich-blueprint
blueprint:
name: ZHA - 3-Button Scene Controller
description: Handle ZHA button events for a 3-button remote (Single, Double, Hold).
domain: automation
input:
zha_device:
name: Remote Device
description: Select the ZHA remote device.
selector:
device:
integration: zha
# Button 1
btn_1_single:
name: Button 1 - Single Press
default: []
selector:
action: {}
btn_1_double:
name: Button 1 - Double Press
default: []
selector:
action: {}
btn_1_hold:
name: Button 1 - Long Press
default: []
selector:
action: {}
# Button 2
btn_2_single:
name: Button 2 - Single Press
default: []
selector:
action: {}
btn_2_double:
name: Button 2 - Double Press
default: []
selector:
action: {}
btn_2_hold:
name: Button 2 - Long Press
default: []
selector:
action: {}
# Button 3
btn_3_single:
name: Button 3 - Single Press
default: []
selector:
action: {}
btn_3_double:
name: Button 3 - Double Press
default: []
selector:
action: {}
btn_3_hold:
name: Button 3 - Long Press
default: []
selector:
action: {}
mode: restart
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input zha_device
action:
- variables:
# ZHA events usually provide 'command' and 'endpoint_id'
# endpoint_id 1 = Button 1, 2 = Button 2, etc.
command: "{{ trigger.event.data.command }}"
endpoint: "{{ trigger.event.data.endpoint_id }}"
- choose:
# Button 1
- conditions: "{{ endpoint == 1 and command == 'remote_button_short_press' }}"
sequence: !input btn_1_single
- conditions: "{{ endpoint == 1 and command == 'remote_button_double_press' }}"
sequence: !input btn_1_double
- conditions: "{{ endpoint == 1 and command == 'remote_button_long_press' }}"
sequence: !input btn_1_hold
# Button 2
- conditions: "{{ endpoint == 2 and command == 'remote_button_short_press' }}"
sequence: !input btn_2_single
- conditions: "{{ endpoint == 2 and command == 'remote_button_double_press' }}"
sequence: !input btn_2_double
- conditions: "{{ endpoint == 2 and command == 'remote_button_long_press' }}"
sequence: !input btn_2_hold
# Button 3
- conditions: "{{ endpoint == 3 and command == 'remote_button_short_press' }}"
sequence: !input btn_3_single
- conditions: "{{ endpoint == 3 and command == 'remote_button_double_press' }}"
sequence: !input btn_3_double
- conditions: "{{ endpoint == 3 and command == 'remote_button_long_press' }}"
sequence: !input btn_3_hold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment