Simple script to enable Amazon Echo / Alexa to set the temperature on a climate / thermostat device via the emulated hue component

I did not find this before, but with the latest update to 35.2 (not sure if it was possible before), you can use a script to enable Amazon Echo to set the temperature on a climate device:

emulated_hue:
  off_maps_to_on_domains:
  exposed_domains:
    - script

script:
  thermostat:
    sequence:
      - service: climate.set_temperature
        data_template:
          entity_id: climate.YOUR_THERMOSTAT
          temperature: "{{ requested_level }}"

This alllows you to say:

Alexa, set the thermostat to 20. 

And the service will be called and set the temperature to 20 (celsius in my case). Fractions, i.e. 20.5 does not work.
This is idea can be used to set almost any sensor to a requested level.
Hope this helps someone!

13 Likes

very, very cool!

NIce! I guess that also works with Google home then.

Ps would you also be ablessed to ask for a current Value? Eg what is current temperature?

Amazing! I got my Alexa and Home Assistant talking to each other 2 days ago finally, and was looking this. Can’t wait to set this up now! THANK YOU

Unfortunately I don’t think this is possible. The Alexa skill API only allows you to set the current temperature, not query it for current levels.

Yes indeed, only setting to a level works. For a more sophisticated control, the emulated hue bridge has not the features we would need.
For that a complete “Amazon smart home skill” would be necessary, i.e. as at openHAB they are working on it: https://community.openhab.org/t/amazon-echo-skill-for-openhab-available/8113

Edit: Actually the correct link is this:

Ah right.

There is a feature request for this in the Home Assistant equivalent.

I’ve actually switched from Echo to Google home. In this scenario I was more thinking off TTS via Google Home to give the answer. Would like to ‘trick’ Google home via emulated home with a somewhat normal sentence to trigger e.g. a input_boolean that triggers a TTS notification to Google home.

I added the functionality to haaska.
See the issue for the pull request. It seems to work for now :slight_smile:

1 Like

Based on your script, how would I go about switching a socket on with Echo.

Not sure what words I can use with the Emulated Hue?

Regards Dave

I know this is an old thread, but here is the script part of things to setup a dual setpoint thermostat and automatically switch between cool and heat.

thermostat_heat:
  alias: "Heater"
  sequence:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.thermostat_heater_setpoint
        operation_mode: Heat
    - service: climate.set_temperature
      data_template:
        entity_id: climate.thermostat_heater_setpoint
        temperature: "{{ requested_level }}"

thermostat_cool:
  alias: "AC"
  sequence:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.thermostat_ac_setpoint
        operation_mode: Cool
    - service: climate.set_temperature
      data_template:
        entity_id: climate.thermostat_ac_setpoint
        temperature: "{{ requested_level }}"

Forgive my NOOB-ness. I am trying to learn As of now i can request Alexa for a Thermostat Status and she responds with correct temperature but I cannot have Alexa change or set or raise temperature so I thought I might try the above script

I am getting this error in HassIO
image

so my question is in Config.yaml shouldthis script be underneath Climate:
image

instead of here
image

I tried renaming bt that is not the problem
image

where is “here”? Where did you create those scripts?

Hello @daenny,
Thanks for this script. It works fine with my climate to raise temperature but does not work to lower it. Any idea why?
Thanks.

Hi, which Allexa skill and routine did you use for that? I can’t find a routine that have requested level as variable.

Does this still work ?

Seems to be missing

    script.thermostat:
      hidden: false
      name: "Thermostat"

in configuration.yaml

Alexa sees it as a bulb and you cannot set it with a number.

Hi. I know this is originally an older thread, but it’s recently active and the title is good. If it’s better as a new discussion, just let me know. I think it would be of interest to anyone following here.

@chris911 I’ve just started on getting climate linked with home assistant using emulated_hue, but am a long time home assistant user.

My code in configuration.yaml is simply

expose_by_default: false
entities:
climate.thermostat:
name: “Thermostat”
hidden: false

The results are a little ugly as Alexa says “Sorry, Thermostat seems to be malfunctioning.”, but it’s working within a few limits.

The climate entity is exposed as a light with a brightness control.
I can set the temperature by saying “Set the thermostat to 21”.
Even though it voices the error it works immediately.
This particular thermostat uses a wifi switch, a zigbee temperature/humidity sensor and is linked to the old z-wave wall thermostat with automations so that turning it up or down on the wall works. I use awesome_thermostat from HACS for my virtual thermostats so I can uncouple them and have local calls for heat for several zones depending on who’s at home (2 kids in college in the city)