This release fixes the long-standing battery power/direction reporting, restores battery controls that stopped responding, and corrects the naming of two battery modes.
⚠️ Breaking change: battery_power is now signed
battery_power previously reported an unsigned magnitude. It is now positive when discharging and negative when charging.
If you have automations, template sensors, or dashboard cards that assumed the old unsigned value — or that worked around it by deriving the direction themselves — they need updating. Long-term statistics recorded before this release keep their old (unsigned) values.
Battery power and flow direction (#42, #33, #11)
The Hoymiles API always returns bms_power as a positive magnitude; the actual charge/discharge direction lives in the flows array of the same response, which the integration ignored. As a result battery_power never showed direction, and battery_flow_direction was effectively stuck on "charging" almost permanently.
Both now read the real direction from flows. The battery_charging binary sensor had the same defect and is fixed too — it had been reporting "charging" unconditionally. When the battery is idle, the direction sensors now report unknown rather than guessing.
Thanks to @birdie1 for the fix and for verifying it against a real S-Miles account, and to @TopPV, @humphrey4711 and @pdizzle1110 for the reports.
Battery controls work again (#43)
Reserve SOC and battery mode writes could silently do nothing — the slider would snap back with nothing in the log. Three separate defects:
- Successful API responses carrying an empty
datafield were misread as failures. - The write transport had been switched to an undocumented endpoint, leaving the documented job-based flow unused. Writes now try the direct endpoint and fall back to the documented flow.
- Write failures were swallowed instead of surfacing. They now raise a proper Home Assistant error, so you see what happened.
Entity cleanup: reserve-SOC entity IDs changed in an earlier version without a migration, which left orphaned duplicates behind (this is why some users have an entity ending in _2 — that suffix is Home Assistant's duplicate counter, not a battery mode). This release migrates or removes those orphans automatically. If an automation referenced an old, un-suffixed reserve-SOC entity, it has been silently inactive and should be re-pointed at the current entity.
Force Charge and Force Discharge modes (#34)
Battery modes 5 and 6 were exposed under guessed names ("Self-Consumption + Max Power", "Backup + Max Power"). They are actually Force Charge and Force Discharge, now labelled correctly in the mode selector and in the Battery Max Power (…) entity names, with the mapping and payloads recorded in the API docs.
These modes only appear if your account reports them; availability is model- and firmware-dependent. Thanks to @TopPV for the report and @ocd154 for confirming it against a station that exposes them.
Quieter logs (#47)
Battery-only systems (HiBattery, MS-A2) logged API returned success but microinverters list is empty on every poll — over a hundred entries a day. An empty microinverter list is correct for these systems; it is now a debug message.
Also in this release
- Battery flow logic moved into the unit-testable core, with test coverage (73 tests, up from 57).
ctl_mode_setmode filtering is now logged and exposed in diagnostics, so a missing control can be told apart from a failed write.
Known issues
- #39 — per-channel PV values still missing on some HMS-800-2T setups where the API never reports the second channel.
- #41 — device discovery returns empty inverter/battery lists for some S-Miles Home accounts. Under investigation; a diagnostics improvement is in progress.
- #32 — "Battery Power always 0 W" on some 1920AC setups appears to be a separate measurement-point issue and is not fixed by the sign change above.
Full Changelog: v1.1.0...v1.2.0