Hello everybody,
Firstly I want to thank everyone in this great community for helpful information that I read in the past month or so and made my first steps in Home Assistant. Big thanks to developers of this amazing software.
My journey in HA started not long ago, but I found it very addictive and spent almost all of my free time learning and using it. I don’t have a big home nor many smart devices, but I tried to make some of them smart with a DIY approach using ESPHome. My first host for HA was a repurposed Android TV box (arch64 Linux on SD card, Docker, etc.), which was pretty slow and only enough for basic tasks. Then I realised that I could run HAOS headless on an old laptop (Intel N3060 4GB RAM, SSD, etc.) that was collecting dust on a shelf. That was a much better experience, and I was tempted to try Voice Assist, but I was disappointed with the performance of Whisper, Piper… and simply said it was too slow for everyday use. I was too optimistic about hardware requirements… now I know that it was on a shelf for a reson Time to reconsider other options till some better hardware comes along.
Back to square one, open NodeRed, set Telegram bot and write commands for all devices that I want to control as I did on previous setup. While doing this, an idea occurred to me: perhaps I could send words from Telegram to Assist and receive a response in Telegram? I’ll save time using this method and get everything from Assist and then I could add custom commands. I searched to see if someone had made something similar but didn’t find any. After some thinking, I made this, and I’m very happy with the results.
[{"id":"43daba42dc1073e0","type":"telegram receiver","z":"c018c05e16a1f1cf","name":"Receiver","bot":"4f4ec733844193d3","saveDataDir":"","filterCommands":true,"x":105,"y":125,"wires":[["0716b1cfd8c37767"],[]]},{"id":"97a5171027419807","type":"api-call-service","z":"c018c05e16a1f1cf","name":"Start conversation","server":"e46d2e3c.94c37","version":5,"debugenabled":false,"domain":"conversation","service":"process","areaId":[],"deviceId":[],"entityId":[],"data":"{\"text\":\"Turn all lights on\",\"language\":\"NL\",\"agent_id\":\"homeassistant\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"},{"property":"payload.chatId","propertyType":"msg","value":"originalMessage.chat.id","valueType":"msg"},{"property":"payload.type","propertyType":"msg","value":"message","valueType":"str"},{"property":"payload.content","propertyType":"msg","value":"payload.response.speech.plain.speech","valueType":"msg"}],"queue":"none","x":580,"y":125,"wires":[["4ca0611f1949a8de"]]},{"id":"0716b1cfd8c37767","type":"change","z":"c018c05e16a1f1cf","name":"Change payload","rules":[{"t":"set","p":"payload.text","pt":"msg","to":"payload.content","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":125,"wires":[["97a5171027419807"]]},{"id":"4a53450f543e0be1","type":"telegram sender","z":"c018c05e16a1f1cf","name":"Sender","bot":"4f4ec733844193d3","haserroroutput":false,"outputs":1,"x":1075,"y":125,"wires":[[]]},{"id":"4ca0611f1949a8de","type":"change","z":"c018c05e16a1f1cf","name":"Clean up message","rules":[{"t":"delete","p":"payload.response","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":125,"wires":[["4a53450f543e0be1"]]}]
Set your telegram bot details in the Receiver and Sender nodes, pick your Home Assistant server instance in the Start Conversation node, and you can start chat with your HA Assist (conversation agent) using typical HA Assist sentences.You can even use Telegram’s speech to text; maybe a reply too can be sent as voice, but I didn’t want to make things too complicated as I usually do.
Maybe I reinvented the wheel and someone already came up with the same idea, but I didn’t search hard enough, or maybe this will help someone. I will be very pleased if anyone finds this helpful and I want to give my small contribution to the community.
This is my first post and I hope I didn’t miss category. I left out information on how to set up Node-RED and Telegram in HA because it has been discussed in many other topics.
Any comments are welcome.