My main reason for not using HTTP is that there is no way to correctly end a session after that an intenthandler (Home Assistant in my case) is done with it.
But HTTP should be possible.
what is the setting for TextToSpeech and AudioPlaying on the base?
what is the setting for TextToSpeech and AudioPlaying on the satellite?
I set TTS to be performed on the satellite, and everything works. The documentation suggested TTS should be done on the base, but I can’t figure out how to relay that TTS data back to the satellite.
As I only have one satellite at the moment it probably isn’t an issue, but I can see this possibly being a problem with multiple satellites, as Home Assistant would need some way to know which satellite sent the command. Is this possible with intents? I recall something about the ability to include extra info, but that may have only been with events.
Is it also possible to use the variables with intents?
For example:
[SwitchPrinter]
printer_state = (on | off) {state}
turn <printer_state> the printer
Can <printer_state> be sent with the intent? Or is the intent purely [SwitchPrinter] with all the logic handled on Home Assistant?
Adding a querystring should work:
http://<baseIP>:12101/api/text-to-speech?siteid=living_room
I have not yet found a way, but also did not investigate very much, this (seemingly) lack of feature is the reason I use events
The other reason is that you do not have to add a new intent to your configuration.yaml and restart HA before you can use it.
You can simply create a new automation with the required event trigger and reload automations.
So with events, it’s possible to determine which satellite the command came from and return the speech accordingly? I’ll need to try then, it’s one of those things though, I’ve built up a fair amount now with intents so to change to events will be a bit painful!
Regarding the slots, how do these work? I know there’s the slots section in Rhasspy, do I need to fill something in there? I assume though that in Home Assistant it would still need a separate entries for printer on and printer off, it’s just Rhasspy that would determine which intent to send? Sorry to ask so many questions.
This is my automation for lights, but I use MQTT:
Your slots will be available via trigger.event.data.<slotname>
Also, you have the sessionID as to close the session on Rhasspy
If you have a slot named action, you can use a service template to turn the printer on or off, see my example above. But my knowlegde is for now purely based on events and automations.
However, templates can be use in intent_scripts as well
Cool, thanks. I’ll have to start that setup then when I get the willpower. I have the MQTT broker in HA, does that link into the MQTT on Rhasspy at all? Like it all uses the same MQTT “network”.
I’ll have a read and hopefully I’ll figure it out! I would be interested to know more about intents too, like what is literally sent to HA. My logs in HA (for a failed intent) show:
That suggested to me that onlyGetTime is sent from Rhasspy, without anything else, like GetTime {variable}, or something. I definitely use templates in HA for TTS back to Rhasspy, so I know that works, it’s just how to send the variable to be templated you know.
TellDate:
action:
- data_template:
payload: 'The date is {{ now().day }} {{ (now().strftime("%b")) }} {{ now().year }}'
service: rest_command.rhasspy_speak
In my head I would imagine it to be something like this in HA (?), where {{printer_state}} is extra command data from Rhasspy:
No idea though! It does look like yours, but I don’t know if it works with intents. The docs certainly don’t suggest it works, the extra data is only mentioned in the events section.
Template variable warning: 'printer_state' is undefined when rendering 'turning {{printer_state}} the printer'
Template variable warning: 'printer_state' is undefined when rendering 'switch.turn_{{printer_state}}'
I assume from that then that intents can’t handle variables, only events.
I have checked you sentences, but you should use state, not printer_state.
{state} is the name of your slot. I am trying to find the correct syntax for intents
Also, I fixed the printer turning on/off issue, it works! Thank you for your help, that will improve things for me a lot, I think I will still look at using MQTT and events though.
This is with intents and not with events. You can use it in your intentscript template
I have used a mqtt publish just to see what the data looks like when an intent is handled.