Basic Homeassistant Automations for Climate and Switch Entities - Rhasspy 2.5

At the moment (Homeassistant Version 0.110.2) it isn’t possible to listen to all events starting with rhasspy_ and handle them from there on. That means that you would need to write an automation for every component and all methods you want to call from them.

Therefore i created a very basic set of automations including all current methods for the climate and switch entity.
You will find example sentences and slots for most methods aswell. I am curious for your improvement ideas.


Climate:

:gear: Automation file - climate.yaml -> gist here:

# Manging Rhasspy calls for the climate entity
# A climate entity controls temperature, humidity, or fans, such as A/C systems and humidifiers.
# --> https://developers.home-assistant.io/docs/core/entity/climate/

automation:
  #Changing the Temperature
  - alias: Rhasspy Set Temperature
    description: Set new target temperature
    trigger:
    - event_data: {}
      platform: event
      event_type: rhasspy_Set_Temperature
    action:
      service: climate.set_temperature
      data_template:
        entity_id: "{{ trigger.event.data.entity | string }}"
        temperature: "{{ trigger.event.data.temperature | float }}"
  
  #Changing the Humidity
  - alias: Rhasspy Set Humidity
    description: Set new target humidity
    trigger:
    - event_data: {}
      platform: event
      event_type: rhasspy_Set_Humidity
    action:
      service: climate.set_humidity
      data_template:
        entity_id: "{{ trigger.event.data.entity | string }}"
        humidity: "{{ trigger.event.data.humidity | float }}"

  #Changing the HVAC mode - https://developers.home-assistant.io/docs/core/entity/climate/#hvac-modes
  - alias: Rhasspy Set HVAC mode
    description: Set new HVAC(Heating, ventilation, and air conditioning) mode
    trigger:
    - event_data: {}
      platform: event
      event_type: rhasspy_Set_HVAC_Mode
    action:
      service: climate.set_hvac_mode
      data_template:
        entity_id: "{{ trigger.event.data.entity | string }}"
        hvac_mode: "{{ trigger.event.data.hvac_mode | string }}"

  #Applying a preset - https://developers.home-assistant.io/docs/core/entity/climate/#presets
  - alias: Rhasspy Set Preset mode
    description: Applying a device preset
    trigger:
    - event_data: {}
      platform: event
      event_type: rhasspy_Set_Preset_Mode
    action:
      service: climate.set_preset_mode
      data_template:
        entity_id: "{{ trigger.event.data.entity | string }}"
        preset_mode: "{{ trigger.event.data.preset_mode | string }}"

  #Changing the Fan mode - https://developers.home-assistant.io/docs/core/entity/climate/#fan-modes
  - alias: Rhasspy Set Fan mode
    description: Changing the fan mode
    trigger:
    - event_data: {}
      platform: event
      event_type: rhasspy_Set_Fan_Mode
    action:
      service: climate.set_fan_mode
      data_template:
        entity_id: "{{ trigger.event.data.entity | string }}"
        fan_mode: "{{ trigger.event.data.fan_mode | string }}"

  #Changing the Fan Swing mode (vertical/horizontal/both) - https://developers.home-assistant.io/docs/core/entity/climate/#swing-modes
  - alias: Rhasspy Set Swing mode
    description: Changing the fan swinging motion
    trigger:
    - event_data: {}
      platform: event
      event_type: rhasspy_Set_Swing_Mode
    action:
      service: climate.set_swing_mode
      data_template:
        entity_id: "{{ trigger.event.data.entity | string }}"
        swing_mode: "{{ trigger.event.data.swing_mode | string }}"

:page_facing_up: Sentences:

[Set_Temperature]
set [the] ($climate) {entity} [to] (1..40) {temperature}
change [the] temperature in [the] ($climate) {entity} to (1..40) {temperature}

[Set_Humidity]
set [the] humidity in [the] ($climate) {entity} [to] (1..100) {humidity}

[Set_HVAC_Mode]
modes = (off | heat | cool | auto | dry | fan only)
set [the] <modes> {hvac_mode} mode in [the] ($climate) {entity}

[Set_Preset_Mode]
modes = (eco | away | boost | comfort | home | sleep | activity)
apply [the] <modes> {preset_mode} mode in [the] ($climate) {entity}

[Set_Fan_Mode]
modes = (on | off | low | medium | high | focus | middle | diffuse)
set [the] ($climate) {entity} fan to <modes> {fan_mode} [mode]
turn [the] ($climate) {entity} fan [to] <modes> {fan_mode}

[Set_Swing_Mode]
modes = (off | vertical | horizontal | both)
move the ($climate) {entity} fan <modes> {swing_mode}
(stop) {swing_mode:off} moving the ($climate) {entity} fan

:radio_button: Example slots - climate:
!!! Please remember to add your homeassistant entity names as synonyms here!

(bedroom):climate.steven_heater
(living room):climate.humidifier
(jeffs room):cliamte.fan

Switch:

:gear: Automation file - switch.yaml -> gist here:

# 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 }}"

:page_facing_up: Sentences:

[Turn_On]
turn [on] [the] ($switch) {entity} [on]
[please] power up the ($switch) {entity}

[Turn_Off]
turn [off] [the] ($switch) {entity} [off]
[please] shut down the ($switch) {entity}

[Toggle]
toggle [the] ($switch) {entity}

:radio_button: Example slots - switch:
!!! Please remember to add your homeassistant entity names as synonyms here!

(Miningrig):switch.miningrig
(Christmastree):switch.dalittree
4 Likes