GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rikvdb229/E20toHomeWizard: P1 Smart Meter to Home Wizard API Bridge

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
p1_homewizard.py
p1_homewizard.py
 
 

Repository files navigation

P1 Home Wizard Bridge

A Python bridge that reads P1 smart meter data (DSMR) and exposes it as a Home Wizard compatible REST API.

Features

  • 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

Architecture

┌─────────────┐     TCP:23      ┌──────────────────┐    HTTP:8812    ┌─────────────┐
│  P1 Meter   │ ───────────────>│  p1_homewizard   │<────────────────│  Clients    │
│ (DSMR/E20)  │    DSMR data    │     (bridge)     │   JSON API      │ (Dobiss/HA) │
└─────────────┘                 └──────────────────┘                 └─────────────┘

Quick Start

Run Locally

python p1_homewizard.py -m <METER_IP> -p 8812

Run with Docker

# 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

Build for Raspberry Pi (ARM64)

docker buildx build --platform linux/arm64 -t p1-homewizard:latest -o type=docker,dest=p1-homewizard.tar .

API Endpoints

GET /health

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
}

GET / or GET /api/v1/data

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,
  ...
}

Command Line Options

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)

OBIS Codes Parsed

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

Notifications

Enable push notifications by setting --ntfy-topic:

  1. Install NTFY app on your phone
  2. Subscribe to your topic name
  3. Run with --ntfy-topic your-topic-name

You'll receive notifications when:

  • Meter goes offline (high priority)
  • Meter comes back online (low priority)

License

MIT

About

P1 Smart Meter to Home Wizard API Bridge

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.