Hi all,
Beginner here and could use some help, still learning and a ways to go yet!
Looking for a offline, local, voice assistant to control an 8 channel relay board off the RPi GPIOs and stumbled across Rhasspy! I have an electrical and mechanical background but programming and the associated resources are totally new me so please forgive my ineptness on the topic!
I want to control a few lights, fans, and garage doors for now hardwired though RPi GPIOs to the relay board with no additional router or server. Can RPi + Rhasspy achieve this locally (RPi 4 + 32gb card)? I have Rhasspy set up and trained (below) and a basic node-red flow with Rhasspy connected. The rpi-gpio out node is functioning and I can manually fire the relay when I change the initial level of pin from high to low and deploy (GPIOs 32, 36, 38 and 40 are wired to the relay board atm).
Not sure how to connect the dots here; ws node to rpi-gpio out node with inject node and not sure what line of code I need to alter to trigger the High/Low states. Also, not entirely sure if node-red can be run locally once configured and if node-red is even the best solution? I’ve played with a few python command strings I found online to fire the relays in different sequences, is there a way to omit node-red entirely and just parse the json from Rhasspy to python to trigger the relays? And to that, will Rhasspy function offline (or does it need to pull data from the external services)?
I’m sure this is quite novice for most of you but I really appreciate you pointing me in the right direction! It’s a bit of a learning curve and I feel like I’m missing some glaringly obvious steps due my inexperience with programming!
Very excited with the possibilities and really enjoying the challenge, cheers all!!
Rhasspy browser sentence:
[ChangeRelayState]
relay_name = ((relay 1 | relay 2 | relay 3 | relay 4) {name})
relay_state = (on | off) {state}
turn <relay_state> [the] <relay_name>
turn [the] <relay_name> <relay_state>
Intent JSON:
{
"entities": [
{
"end": 7,
"entity": "state",
"raw_end": 7,
"raw_start": 5,
"raw_value": "on",
"start": 5,
"value": "on",
"value_details": {
"kind": "Unknown",
"value": "on"
}
},
{
"end": 15,
"entity": "name",
"raw_end": 17,
"raw_start": 8,
"raw_value": "relay one",
"start": 8,
"value": "relay 1",
"value_details": {
"kind": "Unknown",
"value": "relay 1"
}
}
],
"intent": {
"confidence": 1,
"name": "ChangeRelayState"
},
"raw_text": "turn on relay 1",
"raw_tokens": [
"turn",
"on",
"relay",
"1"
],
"recognize_seconds": 0.0911380219995408,
"slots": {
"name": "relay 1",
"state": "on"
},
"speech_confidence": 1,
"text": "turn on relay 1",
"tokens": [
"turn",
"on",
"relay",
"1"
],
"wakeword_id": null
}
Node-red:
{"intent":{"name":"ChangeRelayState","confidence":1},"entities":[{"entity":"state","value":"on","value_details":{"kind":"Unknown","value":"on"},"raw_value":"on","start":5,"end":7,"raw_start":5,"raw_end":7},{"entity":"name","value":"relay 1","value_details":{"kind":"Unknown","value":"relay 1"},"raw_value":"relay one","start":8,"end":15,"raw_start":8,"raw_end":17}],"slots":{"state":"on","name":"relay 1"},"text":"turn on relay 1","raw_text":"turn on relay 1","tokens":["turn","on","relay","1"],"raw_tokens":["turn","on","relay","1"],"wakeword_id":null,"siteId":"default","sessionId":"d512bbcf-a86f-4ddd-9d79-84c684de93ad","customData":null,"wakewordId":null,"lang":null,"_session":{"type":"websocket","id":"522d2cfd.942b24"},"_msgid":"82a5ed53.1b40c"}