A Python bridge that reads P1 smart meter data (DSMR) and exposes it as a Home Wizard compatible REST API.
- P1 Meter Support: Reads DSMR telegrams via TCP from P1 meters (tested with E20)
- Home Wizard API: Serves data in Home Wizard P1 meter format for easy integration
- Resilient: Background reconnection loop - never crashes if meter is temporarily offline
- Notifications: Push notifications via NTFY.sh when meter goes offline/online
- Health Endpoint: Monitor service status at
/health - Stale Cache: Returns cached data when meter is temporarily unreachable
- Docker Ready: Includes Dockerfile for easy deployment on Raspberry Pi
┌─────────────┐ TCP:23 ┌──────────────────┐ HTTP:8812 ┌─────────────┐
│ P1 Meter │ ───────────────>│ p1_homewizard │<────────────────│ Clients │
│ (DSMR/E20) │ DSMR data │ (bridge) │ JSON API │ (Dobiss/HA) │
└─────────────┘ └──────────────────┘ └─────────────┘
python p1_homewizard.py -m <METER_IP> -p 8812
# Build docker build -t p1-homewizard . # Run docker run -d --name p1-homewizard \ --restart unless-stopped \ -p 8812:8812 \ p1-homewizard \ python p1_homewizard.py -m 192.168.0.220 -p 8812 --ntfy-topic my-alerts
docker buildx build --platform linux/arm64 -t p1-homewizard:latest -o type=docker,dest=p1-homewizard.tar .Returns service health status.
{
"status": "ok",
"meter_ip": "192.168.0.220",
"meter_port": 23,
"meter_online": true,
"meter_last_seen": 1705776000.123,
"meter_last_error": null,
"cache_ttl": 30
}Returns current energy data in Home Wizard format.
{
"total_power_import_t1_kwh": 12345.678,
"total_power_export_t1_kwh": 1234.567,
"total_power_import_t2_kwh": 9876.543,
"total_power_export_t2_kwh": 876.543,
"active_power_w": 1500,
"active_power_l1_w": 500,
"active_power_l2_w": 600,
"active_power_l3_w": 400,
"total_gas_m3": 5678.901,
"gas_timestamp": "2401201200"
}When serving stale cached data (meter offline), response includes:
{
"stale": true,
"stale_age_seconds": 45,
...
}| Option | Default | Description |
|---|---|---|
-m, --meter-ip |
(required) | P1 meter IP address |
--meter-port |
23 | P1 meter TCP port |
-p, --port |
8812 | HTTP server port |
--timeout |
10 | Socket timeout (seconds) |
--cache-ttl |
30 | Cache TTL (seconds) |
--max-retries |
3 | Connection retry attempts |
--ntfy-topic |
None | NTFY.sh topic for notifications |
--reconnect-interval |
30 | Meter check interval (seconds) |
--log-level |
INFO | Log level (DEBUG/INFO/WARNING/ERROR) |
| Code | Description |
|---|---|
| 1.8.1 / 1.8.2 | Total import kWh (tariff 1/2) |
| 2.8.1 / 2.8.2 | Total export kWh (tariff 1/2) |
| 1.7.0 / 2.7.0 | Current import/export power (kW) |
| 21.7.0 / 22.7.0 | Phase L1 import/export power |
| 41.7.0 / 42.7.0 | Phase L2 import/export power |
| 61.7.0 / 62.7.0 | Phase L3 import/export power |
| 24.2.3 | Gas meter reading |
Enable push notifications by setting --ntfy-topic:
- Install NTFY app on your phone
- Subscribe to your topic name
- Run with
--ntfy-topic your-topic-name
You'll receive notifications when:
- Meter goes offline (high priority)
- Meter comes back online (low priority)
MIT