mirror of
https://github.com/vakius/hassio-addon-lifepo4wered.git
synced 2026-08-01 20:44:12 +03:00
Add MQTT monitor with Home Assistant autodiscovery
Poll lifepo4wered-cli every 30s (configurable), publish all registers as one JSON state payload, and announce sensors/binary sensor via MQTT discovery. run.sh pulls broker credentials from the Supervisor mqtt service (Mosquitto addon) with manual overrides in addon options. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
32
README.md
32
README.md
@@ -1,5 +1,37 @@
|
||||
# hassio-addon-lifepo4wered
|
||||
|
||||
Home Assistant OS addon for the [LiFePO4wered/Pi+](https://lifepo4wered.com/lifepo4wered-pi+.html)
|
||||
UPS: runs `lifepo4wered-daemon` and publishes UPS stats to MQTT with Home
|
||||
Assistant autodiscovery.
|
||||
|
||||
## MQTT monitor
|
||||
|
||||
`lifepo4wered_monitor.py` polls `lifepo4wered-cli get` (default every 30 s)
|
||||
and publishes all registers as one JSON payload to `lifepo4wered/state`.
|
||||
Entities appear automatically under one device, "LiFePO4wered/Pi+":
|
||||
|
||||
- **Sensors**: input/battery/output voltage (V), output current (A)
|
||||
- **Binary sensor** "External power": ON when `VIN >= VIN_THRESHOLD`
|
||||
(i.e. OFF means running on battery)
|
||||
- **Diagnostics**: thresholds, timers, watchdog and state registers
|
||||
- **Availability**: `lifepo4wered/availability` with MQTT Last Will, so
|
||||
entities go *unavailable* if the addon stops
|
||||
|
||||
MQTT connection details are taken automatically from the Supervisor when the
|
||||
Mosquitto addon is installed. Addon options: `poll_interval` (seconds) and
|
||||
optional `mqtt_host`/`mqtt_port`/`mqtt_user`/`mqtt_password` overrides.
|
||||
|
||||
### Testing off the Pi
|
||||
|
||||
```
|
||||
python3 -m unittest discover -s tests # unit tests, no deps needed
|
||||
LIFEPO4WERED_FAKE=1 MQTT_HOST=... python3 hassio-addon-lifepo4wered/lifepo4wered_monitor.py
|
||||
```
|
||||
|
||||
`LIFEPO4WERED_FAKE=1` replaces the CLI with embedded sample data.
|
||||
|
||||
## Setup notes
|
||||
|
||||
|
||||
https://www.linkedin.com/pulse/creating-your-first-home-assistant-add-on-issac-goldstand
|
||||
|
||||
|
||||
Reference in New Issue
Block a user