Rhasspy Home Assistant add-on: is it possible to create skills?

Hi all,
new to the amazing Rhasspy, but I’ve managed to have it working as an home assistant add-on.
I am using it to pass vocal commands to HA and control my house, amazing!
HA is installed as a container on a RPi4.

Now that I’ve correctly set-up different intents (ie control lights, get time, manage shopping list etc) I am trying to create a skill to tell me the next football match of my favourite team, but I can’t manage how to do that.

I’ve also tried to chat with Chat GPT lol
ChatGPT suggested me to create a folder “skills” (under …profile/it/skills) with a .py with the script I need to do an API call to fetch the matches info.

From the log anyway, it seems that the problem is that the intent is sent to HA to the handling.
So ChatGPT suggest to change the profile.json in different way, but till now no solution…

Another possibility would of course let HA do the API call etc., but I would try that way in order to be more free with the python code (the skill is basically a .py, while at least from what I’ve learn thare are some limits using python with HA)

Could you help me please? I think that a good guide to “how to set up a skill in a Rhasspy as HA addon” can be a big benefit for the whole community and open a lot of possibilities.
Sorry if the topic has already been discussed in other thread, I’ve not found anything that seem releted to this.
Thanks a lot!

check out on the rhasspy github for skills like the daily joke skill, and you can see how skills can be added. having home assistant do it, really makes sense if you have the info in home assistant already.

Shameless plug here:

You can also check out my github.

I’ve been slowly building a set of skills for Rhasspy. My time skill is pretty flushed out and has a decent read me to guide you through the setup. I recommend the docker way. The Grocy integration is working but still need more intents created. I am also almost done with my timer skill which will allow the creation of multiple timers (with optional names).

Looking for suggestions for more. A Jellyfin client control skill is on the roadmap.

1 Like

Looks interesting, i’ve done everything with node-red so far.

Thanks a lot for your feedbacks.

I read the documentaction and the examples you provided, and ended up with some guesses, but still have some doubt, would appreciate if you can provide more hints…

I guess that all the information needed are here:
https://rhasspy-hermes-app.readthedocs.io/en/latest/index.html

My main doubts is: given my set-up (Rhasspy as add-on (so container) of an Home Assistant instance running in docker on a RPi4) do I need to install rhasspy-hermes-app in the same container of rhasspy or directly on the RPi4 (pip3 install rhasspy-hermes-app)?
Second, after the hermess-app is installed, how do I tell the main rhasspy instance (so the HA add-on) to send the intent to rhasspy-hermess-app? Because for the moment I’ve set up “hass” to handle the intents (and fortunately it works).

Or I am completely going in the wrong way?
Thanks a lot!

The rhasspy-hermes-app library isn’t useful by itself. It’s a starting point for skill developers (like I am trying to be) to use to create a python app that can connect to the MQTT bus and respond to intents fired onto the MQTT bus. So an example of what you could do is, let’s say you like my time skill. You need a place to host it. It can be run in a docker container by itself or run it as a service on an existing linux server that you have. The key is the server it is running on has to have access to the MQTT broker that the rest of Rhasspy is using. Then you start up the python script (either via docker or service) and it connects to MQTT and starts listening for the intents defined in the skill script. Then you create sentences in Rhasspy that will fire the intents defined in the script. When you say the sentence to Rhasspy, it will then resolve the sentence to the intent name, send the fire intent command to MQTT with the intent name, the skill script sees that on the MQTT bus and starts responding.

You can then have multiple scripts running to handle different things. Currently I am running the time skill and just started running my timer skill. Working on my Grocy skill still.

I also have it tied to Home Assistant so I have a few intent scripts in there to handle Home Assistant related things. I have found the combo of both to be very useful.

As I started with, the rhasspy-hermes-app is for a developer to use. So if you are up for it you can use it to write your own skill but the library itself just helps you to connect to MQTT broker and listen for Rhasspy intents (and more). But please feel free to use mine. If something doesn’t work for you let me know and I’ll see what I can do. I am trying really hard to make it something useful for everyone. Adding in multi-language support for all of my skills is on of my next things on my roadmap.

1 Like

Thanks @JoeSherman.

Could you please give me more details?

For example, to start from scratch:

  • how do I retrive the username and the password used by the default internal rhasspt MQTT? (cause also from you git, the option user and pwd are needed);
  • do you suggest to create an empty cointainer in which install the hermes-app library and all the skills (.py script)? If this is the case, could you please provide me an example of docker command with all the settings needed?

Sorry if I’m going completely in the wrong direction, I’m trying my best but it’s not easy…

Hello,

  1. I am using a MQTT broker in my HA instance so i got it from there. In HA any user also has access to MQTT so I made a rhasspy user in HA and I use that. The docker container I created will accept the URL, port, username, and password as environment variables.If you are using the internal Rhasspy MQTT there are some instruction in the wiki on how to connect to it remotely. I recommend an external mQTT though.

  2. I have a dockerfile in my repo. You can use that to build the container. There should be some basic instructions in the read me. But basically use the dockerfile to build a local image (docker build command). Then you use the local image to create a container (docker up command). Supply the environment variable values to the container and when it starts up it should start the skill py script auto automatically and connect to your MQTT.

I know that I’m asking too much, but you guys are amazing and the only resource I have…

@JoeSherman when you have time, could you provide a detailed guide with also the code needed for each step?
I’m struggling trying to follow your “high level” indications.

Thanks!

No problem. Today was a family day so didn’t have time but I’ll be sure to give you some details tomorrow after work.

1 Like

@giof94is,

Here’s my best shot at a step by step for installing my time skill from here: GitHub - MCHellspawn/hermes-app-time

  1. Login to a Linux server with Docker installed, make sure this server has access to the same network as Rhasspy.
  2. Create a folder to work from for the install and navigate into it.
mkdir time-skill
cd time-skill 
  1. Clone the git repo
git clone https://github.com/MCHellspawn/hermes-app-time.git
  1. Build the docker image, this is just the image the container will use. This will run through the “dockerfile” in the repo. It will start with the python 3.8 alpine Linux image and then add in the python requirements, copy the files needs from the cloned repo and save the image in your local docker registry for use later.
sudo docker build hermes-app-time -t <image_name>

replace <image_name> with whatever you want to call the image.
5. Create and start the docker container

sudo docker run -it -d \
        --restart always \
        --name <container_name> \
        -e "TZ=<TZ Name>" \
        -e "MQTT_HOST=<MQTT Host/IP>" \
        -e "MQTT_PORT=<MQTT Port (Typically:1883)" \
        -e "MQTT_USER=<MQTT User>" \
        -e "MQTT_PASSWORD=<MQTT Password>" \
        <image_name>

Replace the following:
= Whatever you want to call the running Docker container
= A valid Linux Time Zone name (example list here: Linux Time Zones All Available List - Ed Chen Logic)
<MQTT Host/IP> = The hostname or IP address of your MQTT broker
= The port of your MQTT broker, usually 1883 but Rhasspy’s internal one uses something different
= The username used to connect to your MQTT broker
= The password used to connect to your MQTT broker
<image_name> = The image name defined in step 4
6. Log out of that server and login to your Rhasspy device that is doing the intent handling
7. Navigate to the profile folder
For example:

cd /profiles/en

Your profiles folder may be different. It is listed on the settings page on your Rhasspy device’s web UI.
8. Navigate to the slot_programs folder and create a new folder for this skill and navigate into it

cd slot_programs
mkdir time
cd time
  1. Copy the slot program down from my repo and mark it executable
wget https://raw.githubusercontent.com/MCHellspawn/hermes-app-time/master/slot_programs/timezones
chmod +x ./timezones
  1. Open the Sentences page on your Rhasspy device (the same one you put the slot program on)
  2. [Optional] Create a new sentence file (I create 1 sentence file for each skill for organization)
  3. Create sentences to fire the intents
[TimeGetTime]
timezones = $time/timezones
what is the [current] time
what time is it
tell me the time
what time is it in [the] (<timezones>){timezone} [timezone]
what is the [current] time in [the] (<timezones>){timezone} [timezone]
time

[TimeTzDiff]
what is the time difference between (<TimeGetTime.timezones>){timezone1} and (<TimeGetTime.timezones>){timezone2}
  1. Save the sentences and retrain Rhasspy.

Give it a shot. If you hasve any trouble let me know.