Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save letsautomatenet/5eb6954d69e5fe9519d78023c4ebb35b to your computer and use it in GitHub Desktop.
Save letsautomatenet/5eb6954d69e5fe9519d78023c4ebb35b to your computer and use it in GitHub Desktop.
SwitchBot - Hub 3 - Buttons - Example Automation
# The useful bit of this automation is the condition which stops false triggering of the automation.
# There are occasions whereby the button might go unavailable and you don't want that treated as a button press
alias: SwitchBot - Hub 3 - Buttons
description: ""
triggers:
- trigger: state
entity_id:
- event.hub_3_button_1_button
id: button1
- trigger: state
entity_id:
- event.hub_3_button_2_button
id: button2
- trigger: state
entity_id:
- event.hub_3_button_3_button
id: button3
conditions:
- condition: template
value_template: >
{{ trigger.from_state.state != "unavailable" and trigger.to_state.state !=
"unavailable" }}
alias: Filter out unavailable states
actions:
- if:
- condition: trigger
id:
- button1
then:
- action: light.toggle
metadata: {}
data: {}
target:
entity_id: light.lounge_lamp
alias: Toggle Lounge Table Lamp
- if:
- condition: trigger
id:
- button2
then:
- action: light.toggle
metadata: {}
data: {}
target:
entity_id: light.lounge_floor_lamp
alias: Toggle Lounge Floor Lamp
- alias: Toggle Lounge Light
if:
- condition: trigger
id:
- button3
then:
- action: light.toggle
metadata: {}
data: {}
target:
entity_id:
- light.lounge_light
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment