Custom Thermostat UI + Trigger Google | Alexa command scripts

Can I set the thermostat Heater or Cooler as an Action like a script?

I have a Google / Alexa connected Aprilaire thermostat and it can take commands to set certain Temp value or Mode through Alexa / Google assistant SDK.

Or have a custom Slider UI which will pass the slider value to the script in order to trigger Hey Google, set the thermostat to {$value_passed}
& subsequently create 3 - 4 buttons in order to trigger Fan, Heat Cool and Humidifier , Air Cleaning modes?

I’m getting the home temperature using Alexa Echos placed in different rooms for an average house temperature.

Currently set this in my Configuration.yaml


# Generic Thermostat
climate:
  - platform: generic_thermostat
    name: Aprilaire Custom Kenscape Tom
    heater: script.custom_home_thermostat
    target_sensor: sensor.kenscape_temperature
    min_temp: 14
    max_temp: 25
    ac_mode: false
    target_temp: 19
    cold_tolerance: 0.3
    hot_tolerance: 0
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_hvac_mode: "off"
    away_temp: 14
    precision: 0.1
# end Generic Thermostat

Script for increasing or decreasing values of Temperature

alias: Increase thermostat by one
sequence:
  - service: google_assistant_sdk.send_text_command
    data:
      command: increase thermostat by one
mode: single
icon: mdi:thermometer-chevron-up

Script for Thermostat modes like Heat / Cool / Off

alias: "Heat Home Thermostat "
sequence:
  - service: input_boolean.toggle
    data: {}
    target:
      entity_id: input_boolean.thermostat_heat_power
  - if:
      - condition: state
        entity_id: input_boolean.thermostat_heat_power
        state: "on"
    then:
      - service: google_assistant_sdk.send_text_command
        data:
          command: turn thermostat mode to heat
    else:
      - service: google_assistant_sdk.send_text_command
        data:
          command: turn OFF thermostat
mode: restart
icon: mdi:heat-pump

I did watch some youtube videos and read up on better thermostat but couldn’t fully understand the concept since they had switches for heater or cooler. Which I don’t have. I don’t have option to just turn on heating or cooling. Aprilaire Thermostat 8940 (without the automation option in contractor settings) needs to set a temperature value and can’t just act as a switch. After it reaches that temperature it automatically sets ON or OFF.

Any help is appreciated. Kinda new to Home Assistant 3 - 4 months but mobile engineer by profession. Just wanted to know if someone has done it rather than me starting with something when there could be a better solution all along.
Currently on iPad but I want to change the Thermostat Card to have individual addressable buttons and slider value sent into the appropriate scripts which will trigger my Alexa | Google Thermostat.

I kinda solved it using Google Assistant because Alexa was responding everytime I made a change. Which was a no go for me.

Final UI
Screenshot 2023-04-05 at 13.28.08

Helper Sensor - the graph is like that because I switched from Celsius to Fahrenheit for easier commands to Google Assistant SDK API to Aprilaire
Screenshot 2023-04-05 at 13.28.14

Climate Entity

# Generic Thermostat
climate:
  - platform: generic_thermostat
    name: Aprilaire Custom Kenscape Tom
    heater: input_boolean.thermostat_heat_power
    target_sensor: sensor.kenscape_temperature
    min_temp: 60
    max_temp: 80
    ac_mode: false
    target_temp: 65
    cold_tolerance: 0.6
    hot_tolerance: 0
    min_cycle_duration:
      seconds: 5
    keep_alive:
      minutes: 3
    initial_hvac_mode: "heat"
    away_temp: 60
    precision: 0.5
# end Generic Thermostat

Helper

  • Input Sensor - Skipped for now
  • Boolean sensor - to toggle Heat On | Off

Screenshots

Temperature sensor from 4 Echos using alexa media player to expose their temperature sensor.

Boolean sensor

Automation

alias: Climate card set Temp Google Assistant
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.aprilaire_custom_kenscape_tom
condition: []
action:
  - service: script.set_thermostat_to_climate_card_value
    data: {}
mode: single

Script

alias: "Set Thermostat to Climate Card value "
variables:
  climate_thermF_set: "{{ state_attr('climate.aprilaire_custom_kenscape_tom', 'temperature') }}"
  defaultValue: >-
    {{ state_attr('climate.aprilaire_custom_kenscape_tom', 'temperature') | int
    }}
  fahrenheitValue: "{{ (((defaultValue)*9/5)+32) | int }}"
sequence:
  - condition: template
    value_template: "{{ states.input_number.temperature_control_america.state | int }}"
    enabled: false
  - wait_for_trigger:
      - platform: state
        entity_id:
          - input_number.temperature_control_america
    enabled: false
  - service: google_assistant_sdk.send_text_command
    data:
      command: Set thermostat to {{ defaultValue }}
  - service: media_player.play_media
    data:
      media_content_type: custom
      media_content_id: Set thermostat to {{ defaultValue }}
    enabled: false
  - service: notify.alexa_media_living_speaker_left
    data:
      message: set value to {{ defaultValue }}
mode: single

Future TODOs:

  • Haven’t figured out how to cycle different modes using this climate entity or general thermostat.
    Maybe better thermostat or something.

  • There is Aprilaire Plus Alexa skill to turn on humidity, air cleaning, fan control & fresh air intake.

1 Like

This is awesome! I also have an aprilaire thermostat and have been frustrated by its painful lack of smart home integrations.

There is a HACS integration that was recently released that talks to Aprilaire locally. Community thread here and GitHub repo here.

It works pretty good but it doesn’t support multiple zones yet (it technically does if you have two thermostats but it doesn’t if you have a support module).

EDIT: I just caught up on the thread and see that you already posted in it and your specific issue raised. My bad.

HI Quick Newibe Question Im new HA and i have no idea where to add this