Light Control using Telegram Bot
We control the light using Telegram Bot.
A bot is a software application that is programmed to do certain tasks. Bots are automated, which means they run according to their instructions without a human user needing to start them up. Bots often imitate or replace a human user’s behavior. Typically they do repetitive tasks, and they can do them much faster than human users could.
Bots can be:
- Chatbots: Bots that simulate human conversation by responding to certain phrases with programmed responses
- Web crawlers (Googlebots): Bots that scan content on webpages all over the Internet
- Social bots: Bots that operate on social media platforms
- Malicious bots: Bots that scrape content spread spam content or carry out credential stuffing attacks
Bots are simply Telegram accounts operated by software — not people — and they’ll often have AI features. They can do anything — teach, play, search, broadcast, remind, connect, integrate with other services, or even pass commands to the Internet of Things.
Creating a Telegram Bot
It’s quite easy to create a new bot on Telegram:
- Open a conversation with the BotFather.
- Type
/start
followed by/newbot
to create a new bot. Give your bot a display name and a username. - You’ll be provided with a link to start a conversation with your bot and a unique API key.
A bot will be created by the name given by the user.
Users can interact with bots in two ways:
- Send messages and commands to bots by opening a chat with them or by adding them to groups.
- Send requests directly from the input field by typing the bot’s @username and a query. This allows sending content from inline bots directly into any chat, group or channel.
By clicking the link with the name of the bot given by the user a chat box will be opened. In the chat box, type /start , then type /on, a text saying “ light is turning on” will appear and a image of light being turned on will also appear. Similarly, type /off, a text saying “light is turning off” will appear and image of light getting turned off will appear.
A feed in Adafruit IO is created using the code.
new = Feed(name=’light’)
result = aio.create_feed(new)
This two lines have to be added in code, after installing Adafruit IO code for python and mentioning the Adafruit IO username and API Key.
When we give a command of ‘on’ and ‘off’ in telegram bot, the value in feed created in Adafruit IO will change automatically based on the command given in the telegram.
My Github link: https://github.com/bsree106/Light-Control-using-Telegram-Bot.git
I would like to Thank INMOVIDU TECH for the online internship provided by in the fields of IoT, Robotics and Embedded Systems. A special thanks to my mentor, Mr.Ameer, who helped in gaining knowledge,during my internship.
Thank you