Rhasspy Light and Cover control with Node-RED and HA

Okay, so far I am able to turn on / off single lights, all lights or rooms, change their colors and brightness as well as controlling all my covers with rhasspy, HA and Node-RED.

Special feature: If I ask to shut the lights and don’t name a room or light, the siteID will be used (which is - surprise - identical with the friendly name of that rooms light group) to perform the command in the room you are. Same goes for covers of course.

I decided to switch to Node-RED for the whole logic and don’t use the HA intent handling. When creating intent_scripts for Snips in HA that was a big hassle with a lot of limits and I love doing it in Node-RED now. However the flow has to be restarted when the rhasspy master was restarted for the webhook reconnect. Would be great if that thing could notice its disconnected state automatically and reconnect but found no solution so far.

What I did is that I created slots containing the entities I want control and for the states, rooms, colors and so on. I mostly use synonyms in the way that I put in the slot what I could say to name that device but rhasspy always sends out the friendly name of the entity to Node-RED. That way I can keep the flows very flexible and universal. And maybe some more colors to the color slot, haha.

I would love to post the Node-RED flow as well as slots and sentences here, however it will not even fit in 3 posts. So I will find a way to post it later…to busy right now :slight_smile:

Upcoming tasks:

  • Thermostat control
  • HA scene selection (i.e. Movie Mode - dim light, close cover, start Netflix app on TV)
  • Hue light scene selection (switching to Home Assistant here, but want still to be able to call them)
    … some other small things I got in my mind …
4 Likes

You can detect the disconnect of the websocket in the node-red flow with a status node in the same flow.
No idea what you need to do to get it to reconnect. I have not encountered that issue for a while now (i had problems with websocket disconnects before).

1 Like

Cool, thank you for the hint.

Might be that it will not become a real problem, it gets lost of course when rhasspy is restarted. However would be good to have it monitored.

Was able to greatly reduce the number of flows and complexity in Node-Red by simply removing the rooms slot and adding the room names to the entity slots (they are entitiys anyways i.e. a lightgroup). That way I need only one intent to change the light state and not one for single lights and one for rooms.

Also implmented hue scenes.

I will continue to make some development and improvements and when I find the time I will put it on a Git or something for those who want to make use of it or use it as orientation.

1 Like

Find my current example here:

2 Likes

I just found out that the template node is pointless in my flows, I could as well put the variables in the HA service call nodes. Will save me some space :slight_smile: at least where there is only one template. On the other hand it is more consistent like this…

Sorry to bump an old thread, but this is amazingly useful for a newbie. HorizonKane, you’re a champion!

I think you’re saying you could get rid of the template nodes and use mustache templates directly in the call service node instead? Ex. put “turn_{{slots.state}}” directly in the service field of the call service node? Did you ever make this change?

Is this the suggested mode how to communicate with different Satellites? I am still starting to get used to Rhasspy, reading lots of threads, checking different Node-Red flows, but it feels complicated to send speech to each satellite instead of having a smart way that realizes which satellite creates the intend and send the answer back to this satellite.

It is one way.

Rhasspy and Home Assistant seem designed to be flexible - so many integrations and alternatives. If you are familiar with Node Red you can definitely use it as the core of your home automation … but personally I have been running HA with Rhasspy with 3 satellites for several months… and am only now looking at Node Red to hopefully replace the scripts, automations and intents in YAML (which I have been struggling with).

If you’re using Rhasspy in Base-Satellite configuration the “Satellite ID” field is important, as it is automatically sent to services running on the Base station, and tells Rhasspy which satellite to send any reply back to.
I haven’t tried it myself, but I understand you can send speech to a different satellite by specifying it’s Satellite_ID; say with MQTT.