How ngoviet/lumentreeha works
Lumentree Solar Inverter is a Home Assistant integration for real-time inverter telemetry and historical energy statistics. A user configures a device through the integration flow; setup initializes cloud/API and MQTT access, then Home Assistant entities expose live readings and daily, monthly, yearly, and lifetime statistics. The statistics path fetches and aggregates API data, persists cache data, and supplies period coordinators and sensors. The README documents extensive battery, grid, load, savings, and chart-series capabilities; some unsampled subsystem wiring is therefore represented only where supported by the tree and excerpts.
Main entry points: __init__.py Entry lifecycle · mqtt_client.py MQTT client · aggregator.py Stats aggregator · sensor.py Sensor entities
Components 20
Setup and integration
- Config flow
config_flow.py - Entry lifecycle
__init__.py - HTTP API client
core/api_client.py
Live telemetry
- MQTT client
core/mqtt_client.py - Realtime parser
core/realtime_parser.py
Energy statistics
- Daily coordinator
coordinators/daily_coordinator.py - Monthly coordinator
coordinators/monthly_coordinator.py - Yearly coordinator
coordinators/yearly_coordinator.py - Lifetime coordinator
coordinators/total_coordinator.py - Stats aggregator
services/aggregator.py - Stats cache
services/cache.py - Backfill services
services/smart_backfill.py
Home Assistant entities
- Sensor entities
entities/sensor.py - Binary sensors
entities/binary_sensor.py - Diagnostics
diagnostics.py
Other components
- Home Assistant user
- Home Assistant
- Lumentree API
- MQTT broker
- Solar inverter
Connections 35
- Home Assistant user → Config flow: configures
- Config flow → Home Assistant: registers entry
- Home Assistant → Entry lifecycle: sets up entry
- Entry lifecycle → HTTP API client: fetches device info
- HTTP API client → Lumentree API: requests data
- Entry lifecycle → MQTT client: starts client
- MQTT client → MQTT broker: connects
- MQTT broker → MQTT client: delivers frames
- Solar inverter → MQTT broker: publishes telemetry
- MQTT client → Solar inverter: publishes reads
- MQTT client → Realtime parser: parses payload
- MQTT client → Home Assistant: dispatches updates
- Entry lifecycle → Stats aggregator: creates aggregator
- Daily coordinator → Stats aggregator: fetches daily stats
- Monthly coordinator → Stats aggregator: fills period data
- Yearly coordinator → HTTP API client: fetches yearly data
- Yearly coordinator → Stats cache: reads cached totals
- Lifetime coordinator → Stats cache: reads lifetime data
- Stats aggregator → HTTP API client: fetches history
- Stats aggregator → Stats cache: updates cache
- Backfill services → Stats aggregator: runs backfill
- Backfill services → Stats cache: purges cache
- Entry lifecycle → Daily coordinator: creates coordinator
- Entry lifecycle → Monthly coordinator: creates coordinator
- Entry lifecycle → Yearly coordinator: creates coordinator
- Entry lifecycle → Lifetime coordinator: creates coordinator
- Home Assistant → Sensor entities: sets up entities
- Home Assistant → Binary sensors: sets up entities
- MQTT client → Sensor entities: updates live state
- MQTT client → Binary sensors: updates status
- Daily coordinator → Sensor entities: provides stats
- Monthly coordinator → Sensor entities: provides stats
- Yearly coordinator → Sensor entities: provides stats
- Lifetime coordinator → Sensor entities: provides stats
- Home Assistant → Diagnostics: requests diagnostics