Skip to content

Instantly share code, notes, and snippets.

@JonahKr
Created May 26, 2020 10:43
Show Gist options
  • Save JonahKr/7ea6cf03a99406151ab61e9f225e18f8 to your computer and use it in GitHub Desktop.
Save JonahKr/7ea6cf03a99406151ab61e9f225e18f8 to your computer and use it in GitHub Desktop.
Automation Template for managing Homeassistant Switch entities through events (Rhasspy)
# Manging Rhasspy calls for the switch entity
# A switch entity turns on or off something, for example a relay.
# --> https://developers.home-assistant.io/docs/core/entity/switch
automation:
#Turn On
- alias: Rhasspy Turn on
description: Turn on the switch
trigger:
- event_data: {}
platform: event
event_type: rhasspy_Turn_On
action:
service: switch.turn_on
data_template:
entity_id: "{{ trigger.event.data.entity | string }}"
#Turn Off
- alias: Rhasspy Turn off
description: Turn off the switch
trigger:
- event_data: {}
platform: event
event_type: rhasspy_Turn_Off
action:
service: switch.turn_off
data_template:
entity_id: "{{ trigger.event.data.entity | string }}"
#Toggle
- alias: Rhasspy Toggle switch
description: Toggle the switch
trigger:
- event_data: {}
platform: event
event_type: rhasspy_Toggle
action:
service: switch.toggle
data_template:
entity_id: "{{ trigger.event.data.entity | string }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment