ESP-NOW is Espressif’s peer-to-peer protocol that allows your Gadget CO₂ sensors to communicate with one another without a router or Wi-Fi, with a range of hundreds of metres in open terrain. Useful for sensor networks in classrooms, offices or large spaces where you don’t want to overload the Wi-Fi.
What is ESP-NOW?
ESP-NOW is a radio communications protocol for long range and low fuel consumption developed by Espressif. It uses the same Wi-Fi radio but does not require a router or access point — the devices communicate directly with one another (peer-to-peer) using their MAC addresses.
Enable ESP-NOW
ESP-NOW It is not enabled by default in the pre-compiled binaries. To use it, you need to enable SUPPORT_ESPNOW in the section [features] from platformio.ini and compile from the source code:
[features]
SUPPORT_ESPNOW = ON
After compiling and flashing, the firmware displays a menu ESP-NOW Config on the serial port and on /preferences.html.
Configuration
| NVS parameter | Default | Description |
|---|---|---|
| `activeESPNow` | `false` | Enable/disable ESP-NOW |
| `tToPubESPNow` | 60 s | Time between posts |
| `tKeepAlESPNow` | 300 s | Keepalive interval |
| `boardID` | Device MAC address | Unique number plate identifier |
| Peer MAC | `FF:FF:FF:FF:FF:FF` (broadcast) | Destination MAC (broadcast by default) |
ESP-NOW shares the Wi-Fi radio; it operates in parallel if your AP is on the same channel (or if `ESPNOW_WIFI_CH = 1` is used). If the router changes channels, ESP-NOW stops receiving until it resynchronises. Be aware of the dynamic channel switching feature on modern routers.
Remote commands (killer feature)
ESP-NOW allows you to send remote commands between devices. The set of supported commands is:
| Command | Value | Function |
|---|---|---|
| `cmdCO2GadgetNone` | 0 | No-op |
| `cmdCO2GadgetCalibration` | 1 | Forced calibration (parameter: 400–2000 ppm) |
| `cmdCO2GadgetDeepSleepPeriod` | 2 | Change to the deep sleep period (parameter: seconds) |
| `cmdCO2GadgetTest` | 10 | Test/debug |
For example, you can calibrate remotely Another CO₂ meter – a gadget that doesn’t require physical contact.
Types of message
| Type | Value | Payload |
|---|---|---|
| `MSG_JSON` | 0 | Generic JSON |
| `MSG_RESERVED` | 1 | Confidential |
| `MSG_CO2GADGET` | 2 | CO2 Telemetry Gadget (boardID, temp, hum, co2, battery, readingId, command, parameter) |
| `MSG_PULSECOUNTER` | 3 | Pulse counter |
| `WS_OTHER` | 128 | Other protocols |
Threshold gating
ESP-NOW posts also go through the ThresholdManager (channel ESPNOW_SEND). They are only published when the value crosses the configured threshold, thereby preventing the network from being overwhelmed with unnecessary messages.
Use cases
- Meters in multiple rooms without a dedicated Wi-Fi connection
- ESP-NOW Gateway → MQTT for sending telemetry to Home Assistant without Wi-Fi on the original meter
- Outdoor monitoring (garage, workshop, greenhouse)
- Remote calibration of field meters
Notes
- ESP-NOW and BTHome can coexist (BLE and Wi-Fi share the same band, but ESP-NOW only transmits in short TX slots)
- The range depends on the antenna and the environment; typical 100–200 m indoors and up to ~200 m in open terrain with a peer on the same channel
- The CO2 Gadget with ESP-NOW outperforms any commercial meter in terms of range and versatility
Did you find this helpful? Share this article. Have a look at the Menu Guide. Any questions? Ask on the Telegram group.