Skip to content

Instantly share code, notes, and snippets.

@bydga
Last active February 2, 2025 21:10
Show Gist options
  • Select an option

  • Save bydga/fb9b679e897423e89c03551c16c20d36 to your computer and use it in GitHub Desktop.

Select an option

Save bydga/fb9b679e897423e89c03551c16c20d36 to your computer and use it in GitHub Desktop.
Bydga's HA hue dimmer switch blueprint
blueprint:
name: Bydga Custom Hue Switch Action
domain: automation
input:
switch_device:
name: Zigbee Switch
description: Select the Zigbee switch that will trigger the actions.
selector:
device:
integration: zha # Change if using zigbee2mqtt
target_lights:
name: Target Lights
description: Select the lights to control.
selector:
entity:
domain: light
multiple: true # Correct placement of multiple here
mode: single
trigger:
- platform: device
device_id: !input switch_device
domain: zha
type: remote_button_short_press
subtype: turn_on
id: toggle
- platform: device
device_id: !input switch_device
domain: zha
type: remote_button_short_press
subtype: dim_up
id: dim-up
- platform: device
device_id: !input switch_device
domain: zha
type: remote_button_short_press
subtype: dim_down
id: dim-down
variables:
first_light: "{{ (target_lights | list)[0] if target_lights else none }}"
action:
- choose:
- conditions:
- condition: trigger
id: toggle
sequence:
- service: light.toggle
data:
transition: 0.4
target:
entity_id: !input target_lights
- conditions:
- condition: trigger
id: dim-up
sequence:
- service: light.turn_on
data:
brightness_step_pct: 20
transition: 0.4
target:
entity_id: !input target_lights
- conditions:
- condition: trigger
id: dim-down
sequence:
- condition: template
value_template: "{{ states(first_light) is not none and state_attr(first_light, 'brightness') | float > 51 }}"
- service: light.turn_on
data:
brightness_step_pct: -20
transition: 0.4
target:
entity_id: !input target_lights
- condition: template
value_template: "{{ states(first_light) is none or state_attr(first_light, 'brightness') | float <= 51 }}"
- service: light.turn_on
data:
brightness_pct: 3
transition: 0.4
target:
entity_id: !input target_lights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment