Hubitat driver for a Sonnen battery, using the battery's local API (v2).
Written for Sonnen Core. Might work with other models.
- Install the driver (Hubitat Package Manager, or paste
sonnen_battery_driver.groovyinto Drivers Code) - Create a virtual device
- Assign the Sonnen Battery driver
- Enter your battery's LAN IP (https://find-my.sonnen-batterie.com/)
- Enter your API key (Sonnen dashboard → Software-Integration)
- Choose a refresh interval
- Save Preferences
- Each refresh makes one call to
/api/v2/status. - Once a day (and when preferences are saved) the driver also reads the battery's
rated capacity from
/api/v2/latestdataand battery health from/api/v2/battery. These need the API key. - All requests are asynchronous with a 10 second timeout.
| Attribute | Unit | Description |
|---|---|---|
battery |
% | Usable state of charge (USOC) |
Production_W |
W | Solar production |
Consumption_W |
W | House consumption |
GridFeedIn_W |
W | Grid power: positive = exporting, negative = importing |
Pac_total_W |
W | Battery power: positive = discharging, negative = charging |
power |
W | Production minus consumption |
energy |
kW | Production minus consumption, as a point-in-time value in kW (not a kWh total) |
powerSource |
battery when discharging, otherwise mains |
|
BackupBuffer |
% | Backup buffer reserved for outages |
OperatingMode |
Sonnen operating mode | |
SystemStatus |
Sonnen system status, e.g. OnGrid |
|
FullChargeCapacity |
Wh | Rated full-charge capacity (daily) |
RemainingCapacity_Wh |
Wh | Usable energy currently stored |
MinutesToCharge |
min | Estimated time to full at the current charge rate |
MinutesToDischarge |
min | Estimated time to empty at the current discharge rate |
StateOfHealth |
% | Remaining capacity compared with new (daily) |
CycleCount |
Full charge cycles (daily) | |
MaxCellTemperature / MinCellTemperature |
°F or °C | Hottest and coldest cell at the time of the daily check, in the hub's temperature scale |
healthStatus |
online, or offline after 3 failed polls in a row |
- Refresh: poll the battery now.
- Set Backup Buffer: set the backup buffer percentage. Accepts
0(disabled) or a whole number from5to100.
- Enable Display Flow Tiles in the device preferences
- Add a new tile to your Dashboard
- Select your battery device
- Choose the Attribute template
- Pick
flow_tile_largeorflow_tile_small
The tiles use emoji and Unicode arrows, so they need no internet access. Green arrows show solar and battery flows; red arrows show power drawn from the grid.
Enable Enable Child Devices to create six component devices (production,
consumption, to/from grid, to/from battery). Each reports its flow as energy in kW.
Turning the option off and saving preferences removes the child devices.