Rhasspy offline voice assistant toolkit

Looks like your Home Assistant URL is empty. Make sure to check the Settings page.

I’ve been playing around with Node-Red, and it works quite well with Rhasspy through MQTT (receiving intents) and HTTP (via the HTTP API). I’m adding a /api/text-to-speech end-point to Rhasspy in an upcoming version so you’ll be able to have Rhasspy speak at the end of a Node-Red flow.

I admit I didn’t dive at all into Rhasspy structure and don’t know if it as already doable, but couldn’t this /api/text-to-speech end-point feature open the possibililty of decentralized clients in different rooms to listen for speech commands and talk to a ‘central Rhasspy brain’ ?

This is my installation
You help me fix the settings for me

This is actually possible right now with the api/speech-to-intent endpoint. POST-ing some WAV data to this endpoint will cause Rhasspy to process it as a voice command (and send it to Home Assistant).

1 Like

This has to be some kind of bug, because everything looks good with your settings. Have you made sure to restart Rhasspy since you changed the Home Assistant URL?

when I reboot, I get this error

Wow, I’ve never seen that error before. Was there anything in your Home Assistant logs? Maybe it got the connection, but closed it for some reason?

I just moved into the package

homeassistant:
customize:

package.rhasspy:
  customize: &customize
    package: 'rhasspy'

  exposed: &exposed
    <<: *customize
    emulated_hue_hidden: true
    homebridge_hidden: false

  not_exposed: &not_exposed
    <<: *customize
    emulated_hue_hidden: false
    homebridge_hidden: true

  hidden: &hidden
    <<: *customize
    hidden: true

#################################################################
##group
#################################################################
group:

rhasspy:
control: hidden
name: rhasspy
entities:
- group.rhasspy

##################################################################
#switch
##################################################################
switch:

  • platform: command_line
    switches:
    living_room_lamp:
    command_on: “echo ‘Living room lamp ON’”
    command_off: “echo ‘Living room lamp OFF’”
    garage_light:
    command_on: “echo ‘Garage light ON’”
    command_off: “echo ‘Garage light OFF’”

##################################################################
#sensor:
##################################################################
sensor:

  • platform: command_line
    name: LVR Temperature
    unit_of_measurement: “°C”
    command: “date +%S”

##################################################################
#input_boolean
##################################################################
input_boolean:
rhasspy:
name: rhasspy
initial: off

##################################################################
#automation
##################################################################
automation:

  • alias: “Turn living room lamp on/off”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightState
    event_data:
    name: ‘living room lamp’
    action:
    service_template: ‘switch.turn_{{ trigger.event.data[“state”] }}’
    data:
    entity_id: switch.living_room_lamp

  • alias: “Turn garage light on/off”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightState
    event_data:
    name: ‘garage light’
    action:
    service_template: ‘switch.turn_{{ trigger.event.data[“state”] }}’
    data:
    entity_id: switch.garage_light

  • alias: “Turn bedroom light on”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightState
    event_data:
    name: ‘bedroom light’
    state: ‘on’
    action:
    service: mqtt.publish
    data_template:
    topic: “bedroom_light/set”
    payload: “on,255,255,255”

  • alias: “Turn bedroom light off”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightState
    event_data:
    name: ‘bedroom light’
    state: ‘off’
    action:
    service: mqtt.publish
    data_template:
    topic: “bedroom_light/set”
    payload: “off,0,0,0”

  • alias: “Say garage open/closed”
    trigger:
    platform: event
    event_type: rhasspy_GetGarageState
    action:
    service: tts.picotts_say
    data_template:
    message: >
    {% if is_state(‘binary_sensor.garage_door’, ‘off’) %}
    The garage door is closed.
    {% else %}
    The garage door is open.
    {% endif %}

  • alias: “Say the time”
    trigger:
    platform: event
    event_type: rhasspy_GetTime
    action:
    service: tts.picotts_say
    data_template:
    message: “It is {{ now().strftime(’%I’) | int }} {{ now().strftime(’%M %p’) }}.”

  • alias: “Say the LVR Temperature”
    trigger:
    platform: event
    event_type: rhasspy_GetTemperature
    action:
    service: tts.picotts_say
    data_template:
    message: “It is {{ states(‘sensor.LVR Temperature’) }} degrees.”

  • alias: “Set bedroom light color (red)”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightColor
    event_data:
    name: ‘bedroom light’
    color: ‘red’
    action:
    service: mqtt.publish
    data:
    topic: “bedroom_light/set”
    payload: “on,255,0,0”

  • alias: “Set bedroom light color (green)”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightColor
    event_data:
    name: ‘bedroom light’
    color: ‘green’
    action:
    service: mqtt.publish
    data:
    topic: “bedroom_light/set”
    payload: “on,0,255,0”

  • alias: “Set bedroom light color (blue)”
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightColor
    event_data:
    name: ‘bedroom light’
    color: ‘blue’
    action:
    service: mqtt.publish
    data:
    topic: “bedroom_light/set”
    payload: “on,0,0,255”

  • alias: Light voice command (rhasspy)
    trigger:
    platform: event
    event_type: rhasspy_ChangeLightState
    action:
    service_template: >
    {% if trigger.event.data[“command”] == “accendi” %}
    light.turn_on
    {% else %}
    light.turn_off
    {% endif %}
    data_template:
    entity_id: “light.{{ trigger.event.data[‘name’] }}_{{ trigger.event.data[‘room’] }}”

Thank you very much for your work on this. I could make it to work in a straightforward way. Still working in a Pi3 that I had laying around for testing purposes.
But I could not find in the docs anything about changing brightness of a light.
How it can be done?

I noticed that after some minutes, it stops from accepting the wake word. I can’t understand the reason, So I had to restart it, then it works for some minutes more.

I am using:
Rpi3 + HASSIO 0.90.2
USB dongle with a microphone attached (blue chinese dongle)
Instaled Rhasspy Assistant only (Okay Rhasspy wake word)
I appreciate any help on this.

I have some more questions… Sorry, I am new to it and I am having many doubts…
What if I want to request a temperature from another sensor?
How can I use GetTemperature intent from another sensor?
And if I want to request the weather? Is it possible?
Thanks!

If you want to create a weather request, you should have some application to respond to your question.
Rhasspy only handle the Sppecht To Text and publishes intents to Hassio.
Your Hassio will need to handle those intents, which can be done in several ways.

1 Like

Sure, but I was meaning to request in a natural way. Something like “How is the weather today?”, “How will be the weather tomorrow?”.
I know I can do it with “Turn on the weather”, but it is not natural.
Sorry if there is something that I misunderstood, but Rhasspy is really new for.me. Thanks!

This is actually a situation where Rhasspy shines :slight_smile: You can add any new voice commands you’d like in Sentences tab of the web interface. For your situation, I’d probably add a GetWeather intent with a few sentences like this:

[GetWeather]
how is the weather (today){when}
how will the weather be (tomorrow){when}

Make sure to re-train Rhasspy after saving your new sentences. Now, when you say “how is the weather today”, Rhasspy will send Home Assistant a rhasspy_GetWeather event with a when property set to today. You will need to catch this event in one of your Home Assistant automations, and (I’m guessing) look up the appropriate information in your weather sensor to send to your tts component. My garage door example does this when handling a rhasspy_GetGarageState event.

If you get this working, I’d be interested in adding it as an example in the default Rhasspy install.

1 Like

The wake word is still a weak point for Rhasspy. If you have a regular Rpi3 (not the B+), you might give the snowboy system a try instead of the default pocketsphinx one.

If you happen to have some external wake word system that works well for you, you can always integrate it with Rhasspy by just doing an HTTP POST to /api/listen-for-command to wake Rhasspy up and have it start listening. Another option is using MQTT.

Could you try re-creating your authentication token in Home Assistant and updating it in Rhasspy? I can’t think of any other reason that Home Assistant would just disconnect like that.

Great! I will digest the information and bring back my findings.
Thank for your help.

Both worked like a charm. Thanks!

1 Like