So after my first try with the telegram bot i wanted something more.
I wanted that the bot could be a little bit smarter en could give me some suggestions of devices if i don’t know the name exactly.
So i started again and created an dynamic telegram bot for domoticz using telepot.
To secure the bot so that not everyone could talk to it i build in an check for usernames which can be set in the telegram app.
What can it do?
Using this bot you can ask him for an switch/scene/group/utility switch. After the bot found the device it will ask you what you want to do with it (on,off)
If the device is an selector switch the bot will build special keyboard in telegram where you can find you’re selector options from domoticz.
But sometimes you don’t know the full name of the device or you forget an character, in that case the bot will look for devices that could be the device that you want and will come with suggestions.
So for example if you have 2 switches called livingroomSpeaker, livingroomLights
If you type livingroomspeaker to the bot it will come with the switch and asks you what you want to do (on or off)
but if you type living the bot will make an suggestions and asks if you meant one of the following devices and comes with livingroomSpeaker and livingroomLights.
you can find the code in my github repo:
Github Dynamic Telegram Bot
So an couple examples: