8f41bfb9d482ad4c1cd6dddc9049b4383b5ae1dd
👀 esp32_home-assistant_telegram-bot 2nd Generation Overview
Home Assistant controlled by telegram bot
🚀 Features
The design aims to provide real-time control and monitoring by leveraging a Telegram bot to verify collected data. This core functionality is extended to enable immediate awareness through voice notifications delivered directly via both the user's mobile device and the home system.
🔎 Preparation
1. Components
'1' ESP32-CAM'1' Flammable gas sensor (MQ-2)
'1' Temperature and humidity sensor (DHT11)
'1' Motion sensor (PIR Sensor Hc-Sr501)
'1' 5V Active Buzzer
'1' Breadboard Power Supply Module (Mb102)
Find your wifi's name and password
3. Open the Telegram for the Bot Token and follow these steps:
- Open Telegram and search for
@BotFather. - Start a chat with BotFather by typing
/start. - Create a new bot with the
/newbotcommand. - Follow the prompts to name your bot and choose a username.
- Copy the API token provided by BotFather.
4. Get your Telegram Chat ID:
- Open Telegram and search for
@userinfobotor@get_id_bot. - Start a chat with the bot by typing
/start. - The bot will reply with your numeric user ID.
- For group chat ID:
- Add your bot to the group.
- Send a message in the group mentioning the bot.
- Use the API call:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates- Look for
"chat":{"id": ...}in the JSON response. - The
chat.idis your group chat ID (usually negative for groups, e.g.,-1001234567890).
- Look for
📦 Setup
Refer to the circuit diagramInstall the 'Arduino IDE' software and open 'esp32_home-assistan_telegram.ino' filePaste your wifi, bot token and chat id inf.File>Preferences>Additional Boards Manager URLs:(Click the double window button)
Paste this code
https://dl.espressif.com/dl/package_esp32_index.json
Click 'OK'Tools>Board>Boards Manager...Search 'esp32' by Espressif Systems, and install it
⚠️ Warning: Make sure you have installed the correct USB driver (CH340, CH341, FT232R / FTDI Driver, CP2102) before connecting the ESP32CAM to your computer.
Plug the ESP32CAM into your computerTools>Board>esp32>'ESP32 Wrover Module'
Apply these changes:
- Core Debug Level: None
- Erase All Flash Before Sketch Upload: Disabled
- Flash Frequency: 80MHz
- Flash Mode: QIO
- Partition Scheme: Huge APP (3MB No OTA/1MB SPIFFS)
- Upload Speed: 115200
- 115200 baud
Tools>Port>'Select the esp's port'Tools>Manage Libraries...>Install the libraries used in the codeClick the 'upload ➡️' button
✅ To make sure it has been uploaded successfully, you should see the message 'Done uploading'
🎉 Run
Disconnect the IO0-GND connection(disable programming mode)Press the reset button on the esp32camYou are ready to use '/start' command in your telegram bot
You can explore more projects in myprojects page
🔒 License
📜 GPL-3.0 License
Languages
C++
100%