It already should!
I checked the example, and it should appear like this:
I forgot to mention, you have to send a message, like test without the /, to the bot to get the menu.
FYI, The final result could be something like this:
Notice the /m-node prior to the Main Menu. When a message is send for the first time it will enter the Main Buttons Menu. When your inside the Telegram send and respond loop the menu will not be shown every time, only when you send a /m option again (you can also add this as a button in the Main Button Menu).
Also there is a /stop command node added to exit the Telegram send and respond loop. The attached Telegram Sender Node at the end must have the ‘Track’ option disabled.
Now it’s all making sense and working sort of. Only thing is now the flow kind of broke.
So now the /as
or payload isn’t sent to the switch I had configured to convert msg.payload
from /as
to arm_away
.
I have it setup exactly as you do. So my question is where do you send the /as to?
I’m a complete rookie concerning Home Assistant. I use several IoT devices and gateways so I use Node Red as my main ‘configurator and automation’ server.
The basic protocol I use is MQTT, also for HA. This way it’s easy to ‘trigger’ events on all Home Automation devices. One big advantage is that I don’t have to dig deep into all my Home Automation devices/gateways.
In short, if I want to trigger an event, I just post it to a certain topic on my MQTT broker.
FYI, don’t forget to close the loop to the Telegram Sender Node (for example with a text that the command is executed or something like that). That’s why I have put the red arrows into the final result picture.
BTW, do you mind if I link this topic to my https://community.home-assistant.io/t/howto-setting-up-a-telegram-bot-for-all-your-home-automation-messages topic, as an example?
I’m using MQTT as well Home Assistant is just what pulls it all together.
Sure, you can link this to anywhere - I don’t own this and it may help someone else!
As for closing the loop, is there a downside to not closing that loop? I don’t plan to use the bot for anything else. Just seems to show the menu again and I’m ok with that.
Thanks again.
I don’t use your setup, I just made this as an example to get you started
Well, then you have to re-attach to the main Telegram again (starting at the beginning of the loop, showing the Main Menu every time again). If that’s alright with you, then it shouldn’t be a problem.
Thank you very much, it’s is highly appreciated!
You’re welcome!
hi, i have similar problem, look at that:
i dont understand how to make it on/off based on the button i clicked in the bot. i must miss some node in between, no?
thank you!
I still can’t figure this out.
What package do this blue nodes come from?
Checking your flow, it does have some flaws.
1 - Put an authorized-node after the Telegram Receiver. Otherwise anyone can send commands!
2 - When a ‘/1’ message is received the ‘pick button’-buttons are returned, ehh, then what?
In the ‘pick button’-node you must configure a command to execute (postback value). Behind the Telegram-sender node you have to return the loop to all your (button)options you have. Check the final result example I posted before.
home assistant hassio add on
I don’t use hassio. Nevermind, found it as node-red-contrib-home-assistant
i still dont understand… sorry, but how even in your final result, how to configure the main menu so when you pick one he will run /m and not /as
start should be /start (the / is important otherwise the command-node will not be triggered) , and /start has to be added as command node.
nodered home assistant package.
I have this, but the commands are never run. There is a disconnect somewhere. Just don’t know where. @Asaf_Davidof has the same issue I have.
No offense to @Domoticon, but I had some difficulty following the tutorial myself so I took another approach to get this done. I can set this off by sending /al and the menus popup in telegram, after I make my choice the function node send the appropriate command HA. To secure it the telegram nodes allows me to restrict who can send a command. In addition, I have another node tied to telegram that sends me the status of the alarm each time I choose one of the option to ensure it went through.
[{"id":"34052197.65fc5e","type":"telegrambot-switch","z":"210599c3.81f106","name":"Alarm Choices","bot":"6cf9d125.c9a1f","chatId":"364959066","question":"What would you like to do with the alarm?","answers":["arm_home","arm_away","disarm"],"outputs":3,"autoAnswerCallback":true,"timeoutValue":"","timeoutUnits":"","x":620,"y":680,"wires":[["f8eef33e.406ab"],["566dbe0.a166644"],["ecf3dfbc.1d5f9"]]},{"id":"6b091eec.dc7aa","type":"telegrambot-command","z":"210599c3.81f106","bot":"6cf9d125.c9a1f","command":"/al","commandType":"str","commandCase":false,"x":430,"y":680,"wires":[["34052197.65fc5e"]]},{"id":"42a9b95.4d6dc48","type":"mqtt out","z":"210599c3.81f106","name":"Alarm out-put","topic":"","qos":"","retain":"","broker":"d22d2dd3.efb5","x":1000,"y":640,"wires":[]},{"id":"f8eef33e.406ab","type":"function","z":"210599c3.81f106","name":"Set Home Alarm","func":"var newMsg = {\"payload\":\"ARM_HOME\",\"topic\":\"home/alarm/set\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":820,"y":640,"wires":[["42a9b95.4d6dc48","16dfde83.1b9a21"]]},{"id":"ea46fbd.096e508","type":"mqtt out","z":"210599c3.81f106","name":"Alarm out-put","topic":"","qos":"","retain":"","broker":"d22d2dd3.efb5","x":1000,"y":680,"wires":[]},{"id":"566dbe0.a166644","type":"function","z":"210599c3.81f106","name":"Set Away Alarm","func":"var newMsg = {\"payload\":\"ARM_AWAY\",\"topic\":\"home/alarm/set\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":820,"y":680,"wires":[["ea46fbd.096e508","16dfde83.1b9a21"]]},{"id":"d332c82f.103f38","type":"mqtt out","z":"210599c3.81f106","name":"Alarm out-put","topic":"","qos":"","retain":"","broker":"d22d2dd3.efb5","x":1000,"y":720,"wires":[]},{"id":"ecf3dfbc.1d5f9","type":"function","z":"210599c3.81f106","name":"Disarm Alarm","func":"var newMsg = {\"payload\":\"DISARM 9999\",\"topic\":\"home/alarm/set\"};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":820,"y":720,"wires":[["d332c82f.103f38","832e43c9.4a88a"]]},{"id":"16dfde83.1b9a21","type":"telegrambot-notify","z":"210599c3.81f106","name":"The alarm has been set","bot":"6cf9d125.c9a1f","chatId":"111111111","message":"The alarm has been set","parseMode":"","x":1210,"y":660,"wires":[]},{"id":"832e43c9.4a88a","type":"telegrambot-notify","z":"210599c3.81f106","name":"The alarm has been disarmed","bot":"6cf9d125.c9a1f","chatId":"111111111","message":"The alarm has been disarmed","parseMode":"","x":1230,"y":720,"wires":[]},{"id":"6cf9d125.c9a1f","type":"telegrambot-config","z":"","botname":"DoorSensorBot","usernames":"walkintothelight","chatIds":"111111111","pollInterval":"300"},{"id":"d22d2dd3.efb5","type":"mqtt-broker","z":"","name":"Win-Mosquitto","broker":"192.168.1.999","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]