The diagram is shown in the picture. This is how the entire system is managed: the message sent to the bot is processed by the MYEWWT device. If additional devices are added to the system - smart sockets, relays, etc., the command from the bot is first processed by the MYEWWT device, then transmitted to the devices connected to the system using ESP-NOW technology.
More about firmware
I started the code in the Arduino IDE using the Espressif SDK for the ESP-12F microcontroller, then developed it in the VS Code environment using the PlatformIO toolkit.
Most of the project's code is commented and broken into convenient parts in the form of several files:
- the main one, with a common loop and the declaration of global variables and some functions,
- for functions called when sending and receiving messages via ESP-NOW,
- functions used to operate the addressable LEDs,
- block with functions for server operation (captive portal),
- message handler function from the Telegram bot,
- block with other system functions: timing, firmware update, time synchronization, etc.
My smart home system uses two types of connections:
- From the Telegram server to the MYEWWT gateway.
- From the MYEWWT gateway to other devices in the system (sockets, relays, switches, etc.).