I can successfully get the status of different sensors to Alexa, but I’m having trouble setting the temperature of one of my thermostats from Alexa.
Here’s what I have in my yaml file:
SetDownstairsTemp:
action:
service: climate.set_temperature
data:
entity_id: climate.downstairs
temperature: {{downtemp}}
speech:
type: plaintext
text: Okay, set downstairs temperature to {{downtemp}}
Also, when you test from the tester in the Amazon skill setup, what data are you seeing being sent to HASS? Is it correctly sending the key/value pair of “downtemp” and a number?
It is being sent across from the Amazon tester correctly. The response text from HA shows the value that Amazon sent. I just can’t start HA when I try to set temperature to {{downtemp}}.
If I use float({{downtemp}}), HA starts fine. But when Amazon calls the intent, the set_temperature service is passed ‘float(72)’ and it complains about not getting a float value.
That got me back to the invalid key error. It’s definitely some type of formatting issue, just have to figure out the right way. Thanks again for all the suggestions.
17-02-04 20:47:58 ERROR (MainThread) [homeassistant.core] Invalid service data for input_slider.select_value: extra keys not allowed @ data['value_template']. Got 'value: 20'
required key not provided @ data['value']. Got None
Sorry, you’re right. I thought I had this working but apparently I don’t… I had moved on to something else and forgot to finish this. I just checked and I am getting the same error as you with this code.
SetVolumeIntent:
action:
service: media_player.volume_set
data_template:
entity_id: media_player.yamaha_receiver
volume_level: >-
{%- if Level|int in range(10,81) -%}
{%- set n = Level|float -%}
{{ (1.0-( n / 100.0 )) | round(0.00) }}
{%- endif -%}
speech:
type: plaintext
text: OK
You are going to need to figure out the conversion from speech to input. In this case above, I wanted my intent input to be in decibels. So I say “Alexa, ask home to set volume to 25” which converts 25 into the volume (which happens to be 0.75).
Figure out what you need for the conversion and use that template. This is my alexa intent for this:
I made a slot with all the Levels I wanted to allow. I didn’t want my speaker to blow up so I use the alexa slot to limit the inputs instead of using AMAZON.NUMBER.
Basically you can use this principle for creating the temperature. You just need to find the attribute you are using and fill it in with the appropriate number. As I said before, you may need to convert the number you speak into the number that the attribute desires. For example, if your temperature attribute requires ºC and you say ºF, then you need to convert it before placing it in that attribute through the design_template.