Skip to content

Conversation

@jkiddo
Copy link

@jkiddo jkiddo commented Jan 4, 2026

• Added a small MQTT forwarder plus systemd wiring so a Pi can read the meter once at startup and then every 5 minutes and push results into Home Assistant.

  • examples/home_assistant_mqtt.py: long-running helper that reads the meter serial once, then polls registers 60 68 80 74 86 87 266 every PYKMP_INTERVAL_SECONDS (default 300),
    publishing serial/state/per-register JSON to MQTT with optional HA discovery; config comes from env vars (MQTT_HOST, MQTT_* and PYKMP_*).
  • contrib/systemd/pykmp-ha.env.example: sample env file for MQTT and meter settings (base topic, discovery toggle, poll interval).
  • contrib/systemd/pykmp-ha-mqtt.service: systemd unit pointing at the helper script; adjust User/WorkingDirectory/ExecStart to your venv/repo path.
  • docs/home-assistant-mqtt.md (+ nav entry in mkdocs.yml): step-by-step Raspberry Pi setup, install command (pip install ".[tool]" paho-mqtt), service install, and published
    topics.

Notes: paho-mqtt is an extra dependency; ensure the service user can access the serial device (dialout group). The script publishes discovery payloads to Home Assistant by
default.

@jkiddo jkiddo marked this pull request as ready for review January 4, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant