Hi,
How do I add the device “in” list value into the “intent_script:-speech:-text:” response?
In this case (a specific example then the full code blocks follow):
lists:
oil_heater:
values:
- in: ...
Into the:
intent_script:
speech:
text: "Temperature changed to {{ temp_degrees }} degrees"
My example attempt:
intent_script:
speech:
text: "The {{ oil_heater }} Temperature changed to {{ temp_degrees }} degrees"
of course returns the:
lists:
oil_heater:
values:
- out: ...
So how do I code the “intent_script:-speech:-text:” to include the specific “lists:-oil_heater:-values:-in” from my intents sentence?
The in values aren’t available, unfortunately, since there (currently) can only be one value for an intent slot. I’ll see if there’s another way to pass this in.
Posted earlier, realized I was wrong. Now I’m trying again…
If I understand correctly, you want HA to accept a sentence with a list variable in it, and then use that list as an In value to convert to a number via an item-specific Out value, then take an action based on both the Out value and the original In value.
The only way I can imagine doing that with the current system is to encode a value in your number function. I would suggest doing that by changing from ‘degrees F’ to ‘1000 + degrees F’. Then in your action you can pick out the leading digit which represents your location (giving you 9 options without having to handle leading zeros), and then get your degrees F by removing that lead digit.
While I haven’t tested this myself, that means something like:
Forgive the intrusion. Note: I am not a programmer. Though your reply was not addressed to me (op), I gave your code block a try; I replaced my code block with yours and got the error pop-up: “Unexpected error during intent recognition”.
What I’m trying to do is have the response TTS reply using both the List “in” and “out” values.
For example using the following list item:
Then have the TTS response say something like: “The office temperature changed to 75 degrees”
Though the following does not work, hopefully it explains what I’m trying to do:
intent_script:
SetHeaterTemperature:
action:
service: "number.set_value"
data:
entity_id: "{{ oil_heater }}"
value: "{{ temp_degrees }}"
speech:
text: "The {{ oil_heater }} Temperature changed to {{ temp_degrees }} degrees"
Where oil-heater returns office instead of spelling out the list/out code.
The code that works for me at the moment cannot include the oil-heater -in- value as in
speech:
text: "Temperature changed to {{ temp_degrees }} degrees"
Thank you for testing… though I’m obviously a bit disappointed I didn’t have a brilliant insight that resolved the original request! I’m going to hack away at it and see if I can make something else work, eventually I’ll want to do this for my own setup anyway.
edit:
You know, you CAN use two lists in the same input… so you could have a list for your devices and a list for the value you want to pass to them. And I’ve tested this myself and it works perfectly. If you’re trying to pull current values from those devices, you’d do so in the response.
Thanks for the follow-up. Nice find. It might come in handy sometime.
Only thing is that though using two lists works to get it to first say the room then the temperature but only if I say the room name twice in the intents-sentences.
Something like: “office office to 55 degrees”