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 …
2 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: