Device (ESP32-C6)¶
Overview¶
The WattWächter is based on the ESP32-C6 microcontroller and reads energy data from your smart meter via an IR reading head. Data is stored locally and made available via REST API, MQTT, or the cloud portal.
Specifications¶
| Property | Value |
|---|---|
| Microcontroller | ESP32-C6 (RISC-V, 160 MHz) |
| Connectivity | WiFi 6, Bluetooth 5.0 LE |
| Interface | IR reading head (SML protocol, D0 interface) |
| Power supply | USB-C, 5V |
| Storage | SPIFFS filesystem for history data |
| Status indicator | RGB LED |
| Hostname | ww.local (mDNS) |
How It Works¶
Smart Meter ──IR──▶ WattWächter (ESP32-C6) ──WiFi──▶ Home Network / Cloud
│
├── REST API (local)
├── MQTT (Cloud / Smart Home)
└── LED status indicator
- The IR reading head receives SML telegrams from the smart meter
- The ESP32-C6 parses OBIS codes (e.g.,
1-0:1.8.0for total consumption) - Data is stored in SPIFFS (HighRes: 15 days, LowRes: 1 year)
- Served via REST API and/or MQTT
LED Status Indicator¶
The RGB LED shows the current device status. When multiple states are active simultaneously, the one with the highest priority is displayed.
| Status | Color | Mode | Priority | Meaning |
|---|---|---|---|---|
| OK | Green | Solid | 1 | Normal operation, everything fine |
| Startup | Yellow | Solid | 2 | Device starting |
| Info | Yellow | Dimmed | 3 | Information message |
| BLE active | Blue | Pulsing | 4 | Bluetooth waiting for connection |
| BLE connected | Magenta | Pulsing | 5 | Bluetooth device connected |
| OTA active | Magenta | Solid | 6 | Firmware update in progress |
| Error | Red | Pulsing | 7 | Error occurred |
| Reset pending | Red | Solid | 8 | Factory reset in progress |
Disable LED
The LED can be disabled via the API:
curl -X POST http://ww.local/api/v1/settings \
-H "Authorization: Bearer WRITE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"ledEnable": false}'
Data Collection¶
OBIS Codes¶
The WattWächter reads the following values from the smart meter:
| OBIS Code | Description | Unit |
|---|---|---|
1-0:1.8.0 |
Total consumption (import) | kWh |
1-0:2.8.0 |
Total feed-in (export) | kWh |
1-0:16.7.0 |
Current power | W |
History Storage¶
| Resolution | Interval | Retention | Data |
|---|---|---|---|
| HighRes | 15 minutes | 15 days | Import, export, power, deltas |
| LowRes | 1 day | 1 year | Daily import, daily export |
Authentication¶
The API uses two token types:
| Token | Permission | Usage |
|---|---|---|
| READ Token | Read | Fetch data, check status |
| WRITE Token | Write | Change settings, start OTA, reboot |
Tokens are passed in the header:
Authorization: Bearer YOUR_TOKEN
Disable API Auth
For local development, authentication can be disabled:
curl -X POST http://ww.local/api/v1/settings \
-H "Authorization: Bearer WRITE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"api_auth_required": false}'
MQTT Integration¶
The WattWächter can send telemetry data via MQTT to a broker (e.g., for Home Assistant or ioBroker).
Configuration¶
curl -X POST http://ww.local/api/v1/settings \
-H "Authorization: Bearer WRITE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"mqtt": {"enable": true, "host": "mqtt.example.com", "port": 8883}}'
TLS with Custom CA Certificate¶
For MQTT brokers with a self-signed certificate, a custom CA certificate can be uploaded:
curl -X POST http://ww.local/api/v1/mqtt/ca \
-H "Authorization: Bearer WRITE_TOKEN" \
-H "Content-Type: text/plain" \
--data-binary @my_broker_ca.pem
Troubleshooting¶
Device Not Reachable¶
- Check LED status (see table above)
- Test ping:
ping ww.local - Look up IP address in your router
- If LED is solid red: restart device (disconnect/reconnect USB)
No Meter Data¶
- Is the IR reading head correctly placed on the optical interface?
- Does your smart meter have an unlocked PIN? (Some meters require data output to be enabled by the grid operator)
- Check current values:
curl http://ww.local/api/v1/history/latest
Factory Reset¶
Hold the reset button for 10 seconds. The LED turns solid red, then the device restarts in setup mode. All settings are reset.