This add-on fetches energy data from a local PV system via SSH and publishes 15 sensors directly to Home Assistant without requiring MQTT, Node-RED, or external automation.
The add-on:
- Connects to a remote PV system over SSH using key-based authentication
- Extracts SQLite WAL files (
ems_DEU.db) from the PV system - Parses time-series data and stores it in MariaDB (via the Home Assistant MariaDB add-on)
- Publishes 15 sensors to Home Assistant using the Supervisor REST API
- Runs on a configurable schedule (default: every 15 minutes)
- Home Assistant OS with the official MariaDB add-on (
core-mariadb) installed and running - MariaDB add-on configured with
local_infile = 1. Add this to the MariaDB add-on configuration:[mysqld] local_infile = 1 - A MariaDB user with CREATE, INSERT, SELECT, and DELETE privileges on two databases:
dbfilesanddbfiles2 - Network connectivity to the PV system (SSH, port 22 by default)
-
Copy the
hoas_pv/directory to your Home Assistant add-ons directory:- On HAOS:
/addons/pv_sync/(create the directory if needed) - On HA Container/Supervised: check your add-ons path in
configuration.yaml
- On HAOS:
-
In Home Assistant UI: Settings β Add-ons β Add-on Store β (reload icon) β Find "PV Sync" β Install
-
Configure the add-on options:
pv_host: IP address or hostname of the PV systempv_user: SSH username (typicallyroot)interval: How often to sync in minutes (default: 15)db_user: MariaDB usernamedb_password: MariaDB passworddb_name: Database name (default:dbfiles)energy_unit: Unit used by the PV database βWhorkWh(default:Wh). The LG ESS stores energy in Wh per 15-min interval; this option divides by 1000 before publishing sensors so they show correct kWh values.history_hours: How many hours of data to include in the time-series sensors (default:1, max:24)
-
Start the add-on from the UI
On first start, the add-on generates an RSA key pair in /data/ssh/:
- The public key is printed in the add-on log (Settings β Add-ons β Logs)
- Copy the public key and add it to
/root/.ssh/authorized_keyson the PV system - The add-on retries every 30 seconds until SSH succeeds, then enters the main sync loop
Counter Sensors (total_increasing, unit: kWh):
sensor.pv_zaehlerβ PV energy totalsensor.pv_direct_zaehlerβ Direct PV consumptionsensor.batt_charge_zaehlerβ Battery energy chargedsensor.batt_discharge_zaehlerβ Battery energy discharged
Instantaneous Sensors (current values):
sensor.pv_powerβ Current PV output (W)sensor.pv_direct_consumptionβ Direct consumption (W)sensor.batt_chargeβ Battery charge current (W)sensor.batt_dischargeβ Battery discharge current (W)sensor.batt_socβ Battery state of charge (%)sensor.grid_power_purchaseβ Grid import (W)sensor.grid_feed_inβ Grid export (W)sensor.load_powerβ Load consumption (W)
Time-Series Sensors (configurable window, data in attributes):
sensor.pv_1hβ PV power history (history_hourswindow)sensor.battery_1hβ Battery history (history_hourswindow)sensor.consumption_1hβ Consumption history (history_hourswindow)
- SSH connection failed: Check that the public key is correctly added to the PV system's
authorized_keysand that the IP/hostname is reachable - MariaDB connection failed: Verify credentials and that
local_infile = 1is set in the MariaDB add-on config - No sensors appearing: Check the add-on logs for errors; the add-on must complete one full sync cycle to create sensors