ESP-NOW is a protocol developed by Espressif that lets ESP32 and ESP8266 devices talk to each other over a 2.4 GHz radio link without a Wi-Fi router. It is fast (data rates up to 1 Mbps according to the Espressif ESP-NOW documentation), has low latency, and is ideal for battery-powered sensors. But as soon as you have a dozen ESP-NOW nodes scattered around your house—temperature sensors, door contacts, motion detectors—you hit a wall: the mesh speaks ESP-NOW, while you want to read telemetry on your phone, receive Telegram alerts, or ask an AI assistant to "keep the living room above 20 °C".
That is exactly where ASI Biont fits. Instead of writing custom firmware, an MQTT bridge, and a pile of parsing scripts, you describe your hardware in the chat. The AI agent writes the integration code, connects to your gateway over MQTT, subscribes to sensor topics, and publishes control commands in response to natural-language requests. Everything happens through the chat—no dashboard panels, no "add device" buttons, and no waiting for vendor plugins.
The Problem: A Smart Home That Refuses to Be Unified
In a typical DIY smart-home build, a few ESP32 nodes collect temperature and humidity using DHT22 sensors, a reed switch reports whether the balcony door is open, and an LED strip provides accent lighting. Each node uses ESP-NOW to send short JSON messages to a central gateway. The gateway is the only device connected to Wi-Fi; the nodes themselves never touch the router, which makes them cheap, power-efficient, and resilient to network outages.
The pain starts after the first week of data collection. The raw JSON payloads accumulate in a serial monitor, the gateway rewrites its firmware every time you add a sensor, and there is no convenient way to say "turn off the lights" or "send me a message if the fridge gets too warm". You need a brain—an agent that can read the MQTT stream, understand context, and act on it.
Solution Architecture: ESP-NOW + MQTT + ASI Biont
The bridge between the ESP-NOW mesh and ASI Biont is an ESP32 gateway that does two jobs: it receives ESP-NOW packets from sensor nodes, and it publishes them to an MQTT broker (for example, Mosquitto). ASI Biont connects to that same broker using its execute_python sandbox, which has the paho-mqtt library available. From there the AI can subscribe to topics, parse JSON, detect anomalies, and publish commands back to the gateway.
| Component | Role | Communication |
|---|---|---|
| ESP32 sensor nodes | Measure temperature, humidity, door/window state | ESP-NOW (2.4 GHz, router-free) |
| ESP32 gateway | Aggregates telemetry and forwards it | ESP-NOW receive; MQTT publish/subscribe over Wi-Fi |
| MQTT broker (Mosquitto) | Message bus between gateway and AI | MQTT over TCP/IP |
| ASI Biont | AI agent, runs Python scripts in sandbox | execute_python + industrial_command with MQTT |
This design keeps the sensor mesh independent from your home Wi-Fi network: even if your internet goes down, the ESP-NOW nodes keep reporting to the gateway, and the gateway holds the last state.
Step 1: Sensor Node Firmware (ESP32 + DHT22)
The sender node is deliberately simple. It wakes every 30 seconds, reads the DHT22, and sends a short UTF-8 JSON payload to the gateway’s MAC address. The following Arduino code is a minimal example (for production, add deep sleep and packet-loss handling):
// sender.ino (ESP32 + DHT22)
#include <esp_now.h>
#include <WiFi.h>
#include <DHT.h>
uint8_t gatewayMAC[] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
DHT dht(4, DHT22);
void sendReading() {
float t = dht.readTemperature();
float h = dht.readHumidity();
char payload[64];
snprintf(payload, 64, "{\"t\":%.1f,\"h\":%.1f}", t, h);
esp_now_send(gatewayMAC, (uint8_t*)payload, strlen(payload));
}
void setup() {
WiFi.mode(WIFI_STA);
esp_now_init();
esp_now_add_peer(gatewayMAC, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);
dht.begin();
Serial.begin(115200);
}
void loop() {
sendReading();
delay(30000);
}
The gateway, in turn, listens for ESP-NOW data and forwards it to an MQTT topic (home/sensors). The PubSubClient library keeps the Wi-Fi connection alive; the ESP-NOW receive callback is registered once in setup().
// gateway.ino (ESP32 + MQTT)
#include <esp_now.h>
#include <WiFi.h>
#include <PubSubClient.h>
const char* ssid = "your-wifi";
const char* password = "your-password";
const char* mqttServer = "192.168.1.50";
WiFiClient wifiClient;
PubSubClient mqtt(wifiClient);
void onData(const uint8_t* mac, const uint8_t* data, int len) {
char payload[64];
memcpy(payload, data, len); payload[len] = 0;
mqtt.publish("home/sensors", payload);
}
void setup() {
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) delay(100);
mqtt.setServer(mqttServer, 1883);
mqtt.connect("gateway");
mqtt.subscribe("home/cmd");
esp_now_init();
esp_now_register_recv_cb(onData);
}
void loop() {
mqtt.loop();
}
Step 2: Connecting ASI Biont to the MQTT Broker
With the hardware running, the only part left is the AI agent. Open the ASI Biont chat and describe the setup: "Connect to my Mosquitto broker at 192.168.1.50, subscribe to home/sensors, parse the JSON payload, log the temperature, and send an alert if it exceeds 30 degrees."
ASI Biont uses its execute_python sandbox to run a Python script with paho-mqtt. The tool has a 30-second timeout, so the script is written to connect, subscribe, wait for a fixed period, and exit gracefully:
import paho.mqtt.client as mqtt
import json, time
def on_message(client, userdata, msg):
try:
data = json.loads(msg.payload.decode())
temp = data["t"]
hum = data["h"]
if temp > 30:
print(f"ALERT: temperature {temp} C exceeded threshold!")
else:
print(f"telemetry: temp={temp} C, hum={hum} %")
except Exception as e:
print(f"parse error: {e}")
client = mqtt.Client()
client.on_message = on_message
client.connect("192.168.1.50", 1883, 60)
client.subscribe("home/sensors")
client.loop_start()
time.sleep(15) # listen for 15 seconds, then stop
client.loop_stop()
client.disconnect()
Because execute_python runs in the cloud, the MQTT broker must be reachable from the internet. For a home lab, a simple solution is to run Mosquitto on a small VPS, or to expose your local broker through a secure tunnel. In production setups, many users keep the broker on a local network and use the Hardware Bridge on a PC at the edge—but the cleanest path for most ESP-NOW projects is a publicly reachable MQTT endpoint.
Step 3: From Chat to Actuator
Sensor reading is only half the story. The same gateway subscribes to the home/cmd topic. When the AI wants to turn on the LED strip, it uses the industrial_command tool with the MQTT protocol:
industrial_command(protocol="mqtt", command="publish", topic="home/cmd", message="LED_ON")
The gateway receives LED_ON in its MQTT callback, sets an LED pin high, and responds with a new ESP-NOW acknowledgment if needed. The controller for the actuator can live on the gateway itself or be a separate ESP32 node that listens for commands relayed over ESP-NOW. This way you can say in the chat: "Turn off the lights" or "Make the office colder at 6 PM", and the AI converts that into the right MQTT payload.
This conversational control is what makes ASI Biont different from a traditional home-automation dashboard. You do not create rules through a web interface; you simply describe the desired behavior. The AI writes the Python script, calls the publish command, and even logs the history into a database if you ask.
Results and Benefits
What does this architecture actually change? Before, monitoring the sensors meant opening a serial terminal and scrolling through raw packets. After, you have a chat-based interface that gives you a concise summary: "Temperature is 23.4 °C, humidity 41%, balcony door closed. No alerts." The mesh never depended on a Wi-Fi router, so the sensor network keeps working during internet outages; only the gateway needs power and a stable connection to the broker.
| Aspect | Before | After |
|---|---|---|
| Sensor data access | Serial monitor / manual logging | Chat query: "What is the temperature?" |
| Alerts | None | AI sends notifications when thresholds are exceeded |
| Actuation | Physical button or separate app | Natural language command, e.g. "turn on the LED strip" |
| Adding a sensor | Rewrite gateway firmware | Explain sensor type; AI parses new JSON keys automatically |
| Integration code | Hand-written and version-controlled by user | AI generates and runs code in seconds via execute_python |
There is a deeper benefit: you can connect literally any device to ASI Biont right now. The execute_python sandbox includes paho.mqtt, pymodbus, paramiko, aiohttp, opcua-asyncio, and many other libraries. Instead of waiting for a manufacturer to release a supported plugin, you describe in the chat which device you have—an ESP-NOW mesh, a Modbus PLC, a Raspberry Pi camera, or an Arduino on COM3—and specify the connection parameters (IP, port, baud rate, API key). The AI writes the code for you and executes it, if it can run in the sandbox, or gives you a ready-to-run script for your local machine. All communication with the agent happens through the chat window; there is no dashboard to configure.
Is There Any Catch?
The main limitation is that the AI's Python sandbox runs in the cloud. For an MQTT-based setup, the broker needs to be accessible from outside your local network. If you prefer to keep everything air-gapped or if your MQTT broker is on a private LAN, use the ASI Biont Hardware Bridge—a small Python application you run on a PC or Raspberry Pi. The bridge connects outbound to the AI via WebSocket and forwards serial://, arduino://, or bridge:// commands to local ports. For this ESP-NOW project, however, a public or tunneled MQTT broker is the simplest and most reliable path.
Conclusion
ESP-NOW is an excellent radio protocol for battery-powered smart-home sensors because it removes the router dependency and keeps power consumption low. The missing piece was always an intelligent layer that understands the data and acts on it. ASI Biont fills that gap: it writes the MQTT integration script, subscribes to your telemetry, alerts you when something out of the ordinary happens, and turns your words into actuator commands—all in a matter of seconds.
If you have a box of ESP32s and some sensors you have been meaning to connect, try it yourself. Go to asibiont.com, open the chat, and tell the AI agent about your hardware. You will be surprised how quickly a pile of microcontrollers turns into a conversational smart home.
Sources: Espressif ESP-NOW API Reference, Eclipse Paho MQTT client documentation, and the ASI Biont product documentation.
Comments