Hi, I am looking for a way to use args in Telegram Chat Bot in order to simplify my setup. Currently I am trying out a few things to get a feel for how it works, but I keep hitting a dead-end. For example, if I read out the event.data.args, they are surrounded by brackets i.e ‘args’ which makes it difficult to use them as template for an action.
Since I am researching on how I can accieve that, I found the idea of using AppDaemon, but I have no idea on how to code that and I am happy with getting along with homeassistant already. Also I have set up my ecosystem arround automations, so updating them is easier. My issue is that the commands that trigger the actions are quite lenghy in order to be unique and precise in what they do, i.e ‘/name.lights.on’ to switch on specific lights usualy used by that person. However those commands do get quite long sometimes and the keyboard function in Telegram shows them as ‘/name.li…s.on’, which makes it hard to know what I am doing.
I noticed that by having a space whithin the command allowes Telegram to place a second line of text in the same keyboard button. However, since that means the command has ended and the remaining text is an argument, it wouldn’t trigger the wanted automation.
So, what do I want? I am trying to get something like this to run:
/scene.turn_on name_scene
trigger:
platform: event
event_type: telegram_command
event_data:
command: '/scene.turn_on'
action:
- service_template: scene.turn_on
entity_id: scene.{{ trigger.event.data["args"] }}
Is something like this even possible? Currently it seems not to work due to those brackets that are added arround the argument. i.e the current entity_id looks like this:
scene.‘name_scene’
which obviously will not work.
I had a look at this topic here, but even tough I learned something valuable, it didn’t help me to accieve my goal: