Hi all,
what’s the craziest thing you can or cannot do with rhasspy ? triggered me to at least start some kind of writeup on “really cool stuff” implemented in the FHEM plugin. So why could this be interesting reading (don’t know how to make funny and instructive videos?) if you’re not using FHEM?
Well, imo the code structure itself might contain some aspects that might be worth taking into consideration, even if you use a completely different solution for your home automation…
So expect a wall of text hard to understand .
So let’s start with the spoken “louder, please” from the thread title:
Obviously, you can hardcode in your sentence.ini to point to a special intent to in consequence increase the volume on a specific amplifier. Oh no, how boring …
The one who’s asking your automation to execute that, might expect the TV in the living room to be addressed, or the one in the bedroom? Or the speakers attached to the PC in your offices desk? Who knows …
As you see from this example, taking some additional aspects into account to make the final decision on what should finaly happen makes the story much more “natural” in terms of user experience.
As Rhasspy already provides at least also the information, where any input is coming from, imo it’s obvious, the code always will have to take the siteId into account - obviously apart from the cases, the speaker explicitely wants the execution in a specific room…
So this is why this thread here started:
Additionally, for “louder, please”, the automation code should be able to consider
- which “device” is capable to execute “volume” commands at all?
- which one is running at this point in time?
All these things have been solved a long time ago by some smart other people (don’t exactly know whom), so big thanks to you guys in case you’re reading this!
The code beeing that open also has a big disadvantage: you may have “too much” positive hits (devices that might be the right ones)… What to do when the TV and the amplifier are turned on?
Well, you may
- aks the current user (this is solved here)
- set some priorities in the configuration.
So, what’s the structuring elements allowing that kind of decission making:
- keep the Rhasspy side (sentences.ini) as device agnostic as possible, use slots
- use generic intents whenever possible (“louder, please” will trigger an intent called “SetNumeric” which also is used to set desired temperatures for heating devices, blind positions, …)
- provide specific slots for specific (functional) tasks (“louder” only addresses media devices, so combining louder with a thermostat device should be avoided imo).
- keep the code itself language-agnostic
Last point might be self-explaining with an excerpt from my sentences:
<cmdmulti> [<den>] [$de.fhem.Device-media{Device}] [<rooms>] [<etwasLauter>] ( lauter:volUp | leiser:volDown ){Change}
(cmdmulti internally is optional, too)
So the basic info provided in FHEM is “Change:volUp” and siteId, no matter, if you translate the sentence in English, French or whatever you like…
Same thing with color informations and so on: For a “yellow” color to be set, the FHEM plugin expects just the number 60 (or something in that range at least) . Obviously, this can be standardized and distributed centraly for any possible language.
So the FHEM plugin treats the language itself more like a “skin” - just read a special file and all “standard responses” are translated (and e.g. the slot for “colors 2 numbers” is renewed)…
Last point then is how to complete the link between the mass of devices in the automation system (FHEM) and Rhasspy. Just use some slots filled automatically…
So the final configuration on the FHEM side is to add some “labels” containing “names” (no need to be unique for the entire system, only for a “room”), “room” and (in some rare cases) special information on how to threat weired devices…
OK, hope, you got the idea and some first impression?
So here’ some links you might find useful:
- If you are able to understand (or let translate) german, you might find RHASSPY/Schnellstart – FHEMWiki usefull as a first starting point.
- the “commandref” (pdf version, english; this is the “official” documentation).
- The code and some additional files (e.g. the “german language skin”) are available from FHEM svn here.