How can you control openHAB with Telegram and Node-RED? Any tutorials out there?
I do not know about Telegram (a quick google search tells me it is a messenging service ?) but you can certainly use Node-RED with OH.
I personally do, with MQTT as a communication bus between OH, Node-RED (and some actuators.)
This post might be interesting.
Currently only a Telegram-action exists. With that you are able to send messages to a telegram client. The other way round, reading a chat to control openHAB via messages doesn’t exist yet.
It’s on my list, but not started yet. Have a look here:
A quick Google search turned up this Telegram addon for Node-Red:. [https://flows.nodered.org/node/node-red-contrib-telegrambot]
It looks like it should be straight forward to set it up as a receiver in Node-Red. You could then use switch nodes to filter for your command messages and change nodes to set your actions to send back to OH either through the OH nodes or through MQTT.
node-red with node-red-contrib-telegrambot and node-red-contrib-openhab2 installed and working. My openHAB string item only receives the text msg.payload and not actual text from Telegram. What’s missing?
Since I don’t use the Telegram bot myself I don’t know their payload json structure. Likely the text is a sub value inside the payload. Easiest way to figure it out is hook up a debug node and set it to report the full object. Then you can expand it to see the value it is assigned to. You can then check that value in your switch node or if you wanted use a change node to move it to the msg.payload.
The value structure will be along the lines of
msg.payload.valueid if it’s inside the payload when you expand the object. If it’s at the same level then it’s just
I get this from the debug node when i send the word Testing: type: “message”, content: “Testing”
It’s working! I used
msg.payload = msg.payload.content.toString();
in a function node. Thanks for the help!
You shouldn’t need the function node. You should be able to evaluate
msg.payload.content in a switch node directly.
I just did a little test to switch on a hue light with nodered via telegram. That worked quite well.
Need to play with it a bit more during the weekend.
Have been looking for a way to have OH2 ask me a question and then take an action on my response. Bit of researched on Telegram pulled up gold. There is a Node-RED node
That does this really well. Took about 10 mins to setup using the instructions on the site and bam, I’m am getting notifications sent to my iphone asking me a question with various responses.
Give the age of this thread and a few request for a tutorial I’ll experiment abit more and create one.
What are your use cases for this ?