Skip to content

Instantly share code, notes, and snippets.

@nicsuzor
Last active September 9, 2021 08:31
Show Gist options
  • Save nicsuzor/337b640c5571278ea0b7d3833a1d372f to your computer and use it in GitHub Desktop.
Save nicsuzor/337b640c5571278ea0b7d3833a1d372f to your computer and use it in GitHub Desktop.
action button blueprint
alias: ikea button light switch
description: 'light switch for IKEA button'
blueprint:
name: action button
description: Adjust lights when a button is pressed or held
domain: automation
input:
button:
name: button
description: The action of the button
selector:
entity:
domain: sensor
target_light:
name: Lights
description: The lights to keep in sync.
selector:
target:
entity:
domain: light
trigger:
- platform: state
entity_id: !input button
attribute: action
id: toggle
to: 'on'
- platform: state
entity_id: !input button
id: hold
attribute: action
to: brightness_move_up
action:
- choose:
- conditions:
- condition: trigger
id: hold
sequence:
- service: light.turn_on
target: !input target_light
data:
brightness_step_pct: -25
- conditions:
- condition: trigger
id: 'toggle'
sequence:
- service: light.toggle
target: !input target_light
data:
brightness_step_pct: 100
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment