Skip to content

docs: what a battery can do now (temperature, available power, device state) - #250

Merged
frahlg merged 2 commits into
mainfrom
battery-limits-contract
Nov 22, 2026
Merged

frahlg merged 2 commits into
mainfrom
battery-limits-contract

Conversation

@frahlg

@frahlg frahlg commented Nov 22, 2026

Copy link
Copy Markdown
Member

Core will judge a battery against what it can do now, not only against FTW's order. On the home box, 20 of 23 "not following" notices in two weeks came from a battery that did all it could. The inverter held grid import at about 4.3 kW during night charging, and discharge stopped at about 22.5 A. Neither was a loss of control.

This PR names the fields a driver reports for that, so the drivers can be filled in one by one:

  • temperature_C on battery, the battery's own temperature. The older temp_c means the same.
  • available_charge_W / available_discharge_W on battery: the live limit from the BMS or inverter.
  • available_import_W / available_export_W on the inverter stream: grid headroom, when the device reports it.
  • device_state ("standby" / "starting") on battery, when the device says it is not running.

The names are the canonical keys already in spec/host-api-profile.json; only device_state is new, and test_emit_fields.py now allows it. The text also names the history metrics and repeats the rule that a failed read is left out. Several drivers send a battery temperature of 0 when the read fails, which looks like a cold battery.

Docs and one test allowance; no driver changes here. make check: 5013 passed.

🤖 Generated with Claude Code

… state)

Core is to judge a battery against what it can do now, not only against
the order. Name the fields drivers report for that, using the canonical
keys already in spec/host-api-profile.json: temperature_C,
available_charge_W, available_discharge_W on battery, and
available_import_W, available_export_W on the inverter stream. Add
device_state for a device that says it is not running.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T08:57:20.407226Z 69ae11f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…nt 0 °C

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Read the pack temperature (documented 13025), the BMS's max charge and
discharge current (5635/5636) and map the running state the driver
already reads (13000) to device_state. Emit temperature_C,
available_charge_W, available_discharge_W (amps times this poll's
battery voltage) and device_state on the battery blob, plus the
battery_* metrics from docs/WRITING-A-DRIVER.md.

The two new reads run on the full poll only. Fast polls carry the
last values only while the battery read succeeds; a failed read leaves
its field out. Out-of-range values and Sungrow's "not available"
values are dropped. Running-state values are matched whole, as
Appendix 2 of Sungrow's protocol V1.1.9 lists them.

No available_import_W: the protocol has no register for it. No control
path, write or command changed. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…edges

Cite the owner's box beside NOT_RUNNING and in the test header: in all
14 standby episodes the state went 0x0800 -> 0x0008 -> 0x0020 -> 0x0800,
with 0x0010 in 3 of them. Test that device_state leaves when a later
full poll reads 0x0800 or 0x0040. Compare the battery temperature in
the register's tenths, so -40.0 and 100.0 stay in on any float width,
and test both edges. Say in the CHANGELOG and the manifest notes that
whether 5635/5636 follow the BMS live is unconfirmed on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
@frahlg
frahlg merged commit c37188b into main Nov 22, 2026
5 checks passed
@frahlg
frahlg deleted the battery-limits-contract branch November 22, 2026 09:17
frahlg added a commit that referenced this pull request Nov 22, 2026
Read the pack temperature (documented 13025), the BMS's max charge and
discharge current (5635/5636) and map the running state the driver
already reads (13000) to device_state. Emit temperature_C,
available_charge_W, available_discharge_W (amps times this poll's
battery voltage) and device_state on the battery blob, plus the
battery_* metrics from docs/WRITING-A-DRIVER.md.

The two new reads run on the full poll only. Fast polls carry the
last values only while the battery read succeeds; a failed read leaves
its field out. Out-of-range values and Sungrow's "not available"
values are dropped. Running-state values are matched whole, as
Appendix 2 of Sungrow's protocol V1.1.9 lists them.

No available_import_W: the protocol has no register for it. No control
path, write or command changed. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…edges

Cite the owner's box beside NOT_RUNNING and in the test header: in all
14 standby episodes the state went 0x0800 -> 0x0008 -> 0x0020 -> 0x0800,
with 0x0010 in 3 of them. Test that device_state leaves when a later
full poll reads 0x0800 or 0x0040. Compare the battery temperature in
the register's tenths, so -40.0 and 100.0 stay in on any float width,
and test both edges. Say in the CHANGELOG and the manifest notes that
whether 5635/5636 follow the BMS live is unconfirmed on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
* feat(sungrow): report what the battery can do now (1.7.0)

Read the pack temperature (documented 13025), the BMS's max charge and
discharge current (5635/5636) and map the running state the driver
already reads (13000) to device_state. Emit temperature_C,
available_charge_W, available_discharge_W (amps times this poll's
battery voltage) and device_state on the battery blob, plus the
battery_* metrics from docs/WRITING-A-DRIVER.md.

The two new reads run on the full poll only. Fast polls carry the
last values only while the battery read succeeds; a failed read leaves
its field out. Out-of-range values and Sungrow's "not available"
values are dropped. Running-state values are matched whole, as
Appendix 2 of Sungrow's protocol V1.1.9 lists them.

No available_import_W: the protocol has no register for it. No control
path, write or command changed. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* fix(sungrow): back the running-state codes with field data, test the edges

Cite the owner's box beside NOT_RUNNING and in the test header: in all
14 standby episodes the state went 0x0800 -> 0x0008 -> 0x0020 -> 0x0800,
with 0x0010 in 3 of them. Test that device_state leaves when a later
full poll reads 0x0800 or 0x0040. Compare the battery temperature in
the register's tenths, so -40.0 and 100.0 stay in on any float width,
and test both edges. Say in the CHANGELOG and the manifest notes that
whether 5635/5636 follow the BMS live is unconfirmed on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Core will judge a battery against what it can do now, not only against
the order. These four SvK drivers now report their live limits without
resending old ones, so a device limit is not taken for lost control.

Solis 50-125k-svk 0.3.0, 50-125k-svk-slew 0.2.0, 50-125k-svk-ac-slew
0.3.0: available power keeps its source (parallel system first, then
this unit) and its 60 s read. A failed read now clears the values
instead of resending them. Out-of-range values are dropped, and the
limits go to history as metrics. Switching to this unit's registers and
reading temperatures are left for the site owners and hardware evidence.

Konja konja-261-svk 0.4.0: temperature_C and available power from this
poll's BMS block only, so a failed read no longer replays old limits.
Metrics once every 10 s, not at the 20 Hz poll. No new reads.

All four drop out-of-range values and no longer send a missing SoC as
0 %. Control, slew and writes are unchanged. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Review of #253:

- deye: register 111 had probe_read's give-up, so three early timeouts
  turned the BMS limits off until restart. It now has its own retry: the
  next poll after a miss, and every 60 polls after three in a row. A late
  answer turns the limits on.
- foxess_h3_smart: the cell temperatures (37617/37618) had the same
  give-up. Each now retries every 60 polls after three misses.
- foxess_h3_smart: the comment on 46018 now states the trade-off of
  leaving out a 0: a cold or full pack that truly refuses charge reads 0,
  the field is absent, and Core sees "unknown" rather than "limited".
- alphaess: note that senalse lists the cell temperatures as uint16 and
  0x0111 as a present BMS limit, against Alpha2MQTT.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…an do now

victron_mqtt 1.1.0 reports the BMS's charge and discharge current limits
(CCL/DCL) as available_charge_W / available_discharge_W, times the voltage
the same BMS reports, plus battery and cell temperatures, and the matching
metrics. It picks the BMS the GX names in ActiveBmsInstance. Battery SoC,
voltage, current and temperature no longer start at 0, and a null or empty
payload clears a value.

victron 2.2.0 stops reading register 844 as a temperature: it is the
battery state. A failed battery read sends no battery reading.

ferroamp_modbus 2.2.0 leaves out battery fields whose read failed and
decodes floats on 16-bit halves.

zap 3.2.0 takes the battery temperature only from data model 2.7.0's
temperature_C, drops temperatures outside -40..100 °C and adds
inverter_temp_c.

ferroamp is unchanged: its External API (Rev E) publishes no battery
temperature or live limit.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…attery field that answered

victron_mqtt: the watts need the BMS's voltage from the last 60 s, the
BMS's limits and cell temperatures count only while that BMS has sent
something in the last 60 s, and 60 s with no message at all forgets every
battery value (Venus stops publishing 60 s after the last keep-alive, and a
null sent meanwhile is lost). The manifest says that several battery
services and no ActiveBmsInstance send no limits.

ferroamp_modbus: a failed power read no longer drops a good SoC and energy
counters; the battery reading carries whatever answered.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…an do now (#254)

* feat(victron_mqtt, victron, ferroamp_modbus, zap): what the battery can do now

victron_mqtt 1.1.0 reports the BMS's charge and discharge current limits
(CCL/DCL) as available_charge_W / available_discharge_W, times the voltage
the same BMS reports, plus battery and cell temperatures, and the matching
metrics. It picks the BMS the GX names in ActiveBmsInstance. Battery SoC,
voltage, current and temperature no longer start at 0, and a null or empty
payload clears a value.

victron 2.2.0 stops reading register 844 as a temperature: it is the
battery state. A failed battery read sends no battery reading.

ferroamp_modbus 2.2.0 leaves out battery fields whose read failed and
decodes floats on 16-bit halves.

zap 3.2.0 takes the battery temperature only from data model 2.7.0's
temperature_C, drops temperatures outside -40..100 °C and adds
inverter_temp_c.

ferroamp is unchanged: its External API (Rev E) publishes no battery
temperature or live limit.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* fix(victron_mqtt, ferroamp_modbus): age cached BMS values, send any battery field that answered

victron_mqtt: the watts need the BMS's voltage from the last 60 s, the
BMS's limits and cell temperatures count only while that BMS has sent
something in the last 60 s, and 60 s with no message at all forgets every
battery value (Venus stops publishing 60 s after the last keep-alive, and a
null sent meanwhile is lost). The manifest says that several battery
services and no ActiveBmsInstance send no limits.

ferroamp_modbus: a failed power read no longer drops a good SoC and energy
counters; the battery reading carries whatever answered.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…can do now (#253)

* feat(battery): report what deye, foxess_h3_smart, alphaess and kstar can do now

Core will judge a battery against what it can do now, not only against
the order. These drivers now report the device's own temperature and
live limits where an open register map documents them, and leave a value
out when its read fails or it falls outside -40..100 C or 0..100 kW.

- deye 2.2.0: BMS charge/discharge current limits (212/213) as
  available_charge_W / available_discharge_W at the battery voltage read
  in the same poll, on three-phase hybrids whose battery runs on its BMS
  (register 111 = 1). Heatsink temperature (541) now takes off the 1000
  offset; it read 100 C too high. Failed temperature reads no longer send
  0 C.
- foxess_h3_smart 0.10.0: 46018 as available_charge_W when above 0 (an
  idle pack reads 0 and still charges). battery_temp_c metric, cell
  temperature range (37617/37618) every sixth poll.
- alphaess 1.2.0: cell temperature range (0x010D/0x0110) to history.
- kstar 1.2.0: battery temperature (input 3067) and inverter radiator
  temperature (input 3055).

Atmoce, Varta and Ambibox are unchanged: no documented temperature or
live limit, and no fabricated temperature to remove. Not verified on
hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* fix(battery): retry deye mode and foxess cell temps after misses

Review of #253:

- deye: register 111 had probe_read's give-up, so three early timeouts
  turned the BMS limits off until restart. It now has its own retry: the
  next poll after a miss, and every 60 polls after three in a row. A late
  answer turns the limits on.
- foxess_h3_smart: the cell temperatures (37617/37618) had the same
  give-up. Each now retries every 60 polls after three misses.
- foxess_h3_smart: the comment on 46018 now states the trade-off of
  leaving out a 0: a cold or full pack that truly refuses charge reads 0,
  the field is absent, and Core sees "unknown" rather than "limited".
- alphaess: note that senalse lists the cell temperatures as uint16 and
  0x0111 as a present BMS limit, against Alpha2MQTT.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Core will judge a battery against what it can do now, not only against
the order. These four SvK drivers now report their live limits without
resending old ones, so a device limit is not taken for lost control.

Solis 50-125k-svk 0.3.0, 50-125k-svk-slew 0.2.0, 50-125k-svk-ac-slew
0.3.0: available power keeps its source (parallel system first, then
this unit) and its 60 s read. A failed read now clears the values
instead of resending them. Out-of-range values are dropped, and the
limits go to history as metrics. Switching to this unit's registers and
reading temperatures are left for the site owners and hardware evidence.

Konja konja-261-svk 0.4.0: temperature_C and available power from this
poll's BMS block only, so a failed read no longer replays old limits.
Metrics once every 10 s, not at the 20 Hz poll. No new reads.

All four drop out-of-range values and no longer send a missing SoC as
0 %. Control, slew and writes are unchanged. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
34350/34351 (min/max cell temperature) give temperature_C as their
middle plus the cell min/max metrics, and 33093 gives inverter_temp_c.
Both are read with the 25004 limit block, on poll 1 and then every 12th
poll: two small reads a minute. A failed read leaves them out; a value
is held only until the next read. The addresses come from the full Blixt
Solis driver (d95e07f), which cites Solis documents we could not read,
and are not yet verified on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…y can do now

Core will judge a battery against what the device says it can do now
(docs/WRITING-A-DRIVER.md, "What a battery can do now"). Each driver now
reports what its vendor documents, and leaves out what did not answer.

- huawei 2.2.0: available_charge_W/available_discharge_W from 37046/37048
  ("[Energy storage] Maximum charge/discharge power", U32 W). Huawei does
  not say how fast they follow the BMS.
- kostal 2.2.0: temperature_C from 0xD6 and available_* from 0x434/0x436,
  "Maximum charge/discharge power limit (read-out from battery)", Floats
  in the word order register 0x05 reports, read only when 0x24C shows a
  battery.
- sigenergy 1.2.0: available_* from plant 30047/30049 ("[ESS] Available
  max charging/discharging power") and temperature_C from 30286 (average
  cell temperature), read only when the ESS answered.
- sma 2.2.0, huawei, kostal: battery and inverter temperatures are left
  out when the read fails, is NaN or is outside -40..100 C, instead of 0.
- fronius 2.2.0: the inverter temperature comes from TmpCab (40109).
  40111 is TmpSnk, which Fronius marks not supported, so it sent 0 C.

SMA and Fronius document no live charge or discharge limit, so they send
none. No driver documents grid import/export headroom. Metrics follow the
same rules. No control path, write or command changed. Not checked on
hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…e the caveats

Review of #259.

- huawei: a SUN2000 with no LUNA2000 may answer 37001/37004 with 0, so
  that answer does not prove a battery. The temperature (37022) and the
  limits (37046/37048) are now read only once energy storage unit 1
  reports a rated charge or discharge power above 0 (37007/37009, U32 W).
  Otherwise 0 W would read as "may not charge now". The finding is kept
  for the run; until then it is read on each poll the battery answers.
  Tests cover a unit that answers 0, a rating that does not answer, and
  one rating above 0.
- huawei: CHANGELOG, manifest and code say plainly that 37046/37048 are
  not shown to be live on hardware, and that only unit 1 is read.
- kostal: the code comment says that taking register 5 as the word order
  of every Float is unverified on hardware, that a wrong order gives
  plausible but wrong values, and that the learned order and battery type
  hold until a driver restart.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Core will judge a battery against what it can do now, not only against
the order. These four SvK drivers now report their live limits without
resending old ones, so a device limit is not taken for lost control.

Solis 50-125k-svk 0.3.0, 50-125k-svk-slew 0.2.0, 50-125k-svk-ac-slew
0.3.0: available power keeps its source (parallel system first, then
this unit) and its 60 s read. A failed read now clears the values
instead of resending them. Out-of-range values are dropped, and the
limits go to history as metrics. Switching to this unit's registers and
reading temperatures are left for the site owners and hardware evidence.

Konja konja-261-svk 0.4.0: temperature_C and available power from this
poll's BMS block only, so a failed read no longer replays old limits.
Metrics once every 10 s, not at the 20 Hz poll. No new reads.

All four drop out-of-range values and no longer send a missing SoC as
0 %. Control, slew and writes are unchanged. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
34350/34351 (min/max cell temperature) give temperature_C as their
middle plus the cell min/max metrics, and 33093 gives inverter_temp_c.
Both are read with the 25004 limit block, on poll 1 and then every 12th
poll: two small reads a minute. A failed read leaves them out; a value
is held only until the next read. The addresses come from the full Blixt
Solis driver (d95e07f), which cites Solis documents we could not read,
and are not yet verified on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…252)

* feat(svk): report what the battery can do now (Solis 50-125k, Konja)

Core will judge a battery against what it can do now, not only against
the order. These four SvK drivers now report their live limits without
resending old ones, so a device limit is not taken for lost control.

Solis 50-125k-svk 0.3.0, 50-125k-svk-slew 0.2.0, 50-125k-svk-ac-slew
0.3.0: available power keeps its source (parallel system first, then
this unit) and its 60 s read. A failed read now clears the values
instead of resending them. Out-of-range values are dropped, and the
limits go to history as metrics. Switching to this unit's registers and
reading temperatures are left for the site owners and hardware evidence.

Konja konja-261-svk 0.4.0: temperature_C and available power from this
poll's BMS block only, so a failed read no longer replays old limits.
Metrics once every 10 s, not at the 20 Hz poll. No new reads.

All four drop out-of-range values and no longer send a missing SoC as
0 %. Control, slew and writes are unchanged. Not checked on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* feat(svk): read Solis cell and inverter temperatures on the slow poll

34350/34351 (min/max cell temperature) give temperature_C as their
middle plus the cell min/max metrics, and 33093 gives inverter_temp_c.
Both are read with the 25004 limit block, on poll 1 and then every 12th
poll: two small reads a minute. A failed read leaves them out; a value
is held only until the next read. The addresses come from the full Blixt
Solis driver (d95e07f), which cites Solis documents we could not read,
and are not yet verified on hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* chore: regenerate the catalog after the rebase onto main

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…y can do now

Core will judge a battery against what the device says it can do now
(docs/WRITING-A-DRIVER.md, "What a battery can do now"). Each driver now
reports what its vendor documents, and leaves out what did not answer.

- huawei 2.2.0: available_charge_W/available_discharge_W from 37046/37048
  ("[Energy storage] Maximum charge/discharge power", U32 W). Huawei does
  not say how fast they follow the BMS.
- kostal 2.2.0: temperature_C from 0xD6 and available_* from 0x434/0x436,
  "Maximum charge/discharge power limit (read-out from battery)", Floats
  in the word order register 0x05 reports, read only when 0x24C shows a
  battery.
- sigenergy 1.2.0: available_* from plant 30047/30049 ("[ESS] Available
  max charging/discharging power") and temperature_C from 30286 (average
  cell temperature), read only when the ESS answered.
- sma 2.2.0, huawei, kostal: battery and inverter temperatures are left
  out when the read fails, is NaN or is outside -40..100 C, instead of 0.
- fronius 2.2.0: the inverter temperature comes from TmpCab (40109).
  40111 is TmpSnk, which Fronius marks not supported, so it sent 0 C.

SMA and Fronius document no live charge or discharge limit, so they send
none. No driver documents grid import/export headroom. Metrics follow the
same rules. No control path, write or command changed. Not checked on
hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…e the caveats

Review of #259.

- huawei: a SUN2000 with no LUNA2000 may answer 37001/37004 with 0, so
  that answer does not prove a battery. The temperature (37022) and the
  limits (37046/37048) are now read only once energy storage unit 1
  reports a rated charge or discharge power above 0 (37007/37009, U32 W).
  Otherwise 0 W would read as "may not charge now". The finding is kept
  for the run; until then it is read on each poll the battery answers.
  Tests cover a unit that answers 0, a rating that does not answer, and
  one rating above 0.
- huawei: CHANGELOG, manifest and code say plainly that 37046/37048 are
  not shown to be live on hardware, and that only unit 1 is read.
- kostal: the code comment says that taking register 5 as the word order
  of every Float is unverified on hardware, that a wrong order gives
  plausible but wrong values, and that the learned order and battery type
  hold until a driver restart.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…y can do now (#259)

* feat(huawei, sma, fronius, kostal, sigenergy): report what the battery can do now

Core will judge a battery against what the device says it can do now
(docs/WRITING-A-DRIVER.md, "What a battery can do now"). Each driver now
reports what its vendor documents, and leaves out what did not answer.

- huawei 2.2.0: available_charge_W/available_discharge_W from 37046/37048
  ("[Energy storage] Maximum charge/discharge power", U32 W). Huawei does
  not say how fast they follow the BMS.
- kostal 2.2.0: temperature_C from 0xD6 and available_* from 0x434/0x436,
  "Maximum charge/discharge power limit (read-out from battery)", Floats
  in the word order register 0x05 reports, read only when 0x24C shows a
  battery.
- sigenergy 1.2.0: available_* from plant 30047/30049 ("[ESS] Available
  max charging/discharging power") and temperature_C from 30286 (average
  cell temperature), read only when the ESS answered.
- sma 2.2.0, huawei, kostal: battery and inverter temperatures are left
  out when the read fails, is NaN or is outside -40..100 C, instead of 0.
- fronius 2.2.0: the inverter temperature comes from TmpCab (40109).
  40111 is TmpSnk, which Fronius marks not supported, so it sent 0 C.

SMA and Fronius document no live charge or discharge limit, so they send
none. No driver documents grid import/export headroom. Metrics follow the
same rules. No control path, write or command changed. Not checked on
hardware.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* fix(huawei, kostal): read battery values only for a fitted unit; state the caveats

Review of #259.

- huawei: a SUN2000 with no LUNA2000 may answer 37001/37004 with 0, so
  that answer does not prove a battery. The temperature (37022) and the
  limits (37046/37048) are now read only once energy storage unit 1
  reports a rated charge or discharge power above 0 (37007/37009, U32 W).
  Otherwise 0 W would read as "may not charge now". The finding is kept
  for the run; until then it is read on each poll the battery answers.
  Tests cover a unit that answers 0, a rating that does not answer, and
  one rating above 0.
- huawei: CHANGELOG, manifest and code say plainly that 37046/37048 are
  not shown to be live on hardware, and that only unit 1 is read.
- kostal: the code comment says that taking register 5 as the word order
  of every Float is unverified on hardware, that a wrong order gives
  plausible but wrong values, and that the learned order and battery type
  hold until a driver restart.

Refs #250

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…ar, SolaX, SAJ, Growatt, Solinteg)

Core marks a battery "not following" when it gives less than ordered.
Most such warnings on a real site were device limits, so Core will judge
against what the battery can do now. These seven drivers now report the
device's own figures where its map documents them:

- goodwe 2.2.0: BMS pack temperature, charge and discharge current
  limits (37003-37005) as watts at the 35180 battery voltage, cell
  temperature extremes and the heat sink temperature. The old battery
  temperature read 35183, which GoodWe's map gives to battery power.
- solis 2.2.0: BMS current limits 33143/33144 as watts. The lead-acid
  probe's 200.2 C "no probe" value is dropped.
- solax 1.2.0: BMS max currents 0x0024/0x0025 as watts, radiator
  temperature, and the battery temperature in whole degrees (it was
  scaled by 0.1).
- saj 1.3.0: BMS current limits 0xA036/0xA037 as watts (liveness not
  stated by the source) and the heat sink temperature.
- sofar 2.2.0, growatt 2.2.0, solinteg 1.2.0: battery, cell and
  inverter temperatures; no documented live limit, so no watts.

A failed read is left out, never sent as 0; temperatures outside
-40..100 C and powers outside 0..100 kW are dropped. Reads and emits
only; no control path changes. Not verified on hardware.

Refs #250

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Review of #262. A non-zero battery mode or voltage says a battery is
there, not that a BMS talks to the inverter. A lead-acid or BMS-less
pack answers zeros, and 0 C and 0 W read as a cold battery that may not
charge.

- goodwe: use the 37000 block only while 37011 (battery protocol,
  GoodWe Table 8-33) names a BMS: not 0, not 0x11F "EMS Battery" (no
  direct link) and not 0xFFFF. A talking BMS that allows 0 A still
  sends 0 W.
- solis: read 33143-33160 in one read and use the limits only while the
  battery model at 33160 names a maker (Solis map, plus the generic and
  lead-acid codes from Pho3niX90/solis_modbus); an unknown code sends
  nothing.
- Comments: solax 0x0008 may read in tenths on X3 Gen5/Gen6 (history
  only); solis 33096 is the lead-acid probe, not a BMS value; goodwe
  points at #264 for its other reads.

Refs #250

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…ar, SolaX, SAJ, Growatt, Solinteg)

Core marks a battery "not following" when it gives less than ordered.
Most such warnings on a real site were device limits, so Core will judge
against what the battery can do now. These seven drivers now report the
device's own figures where its map documents them:

- goodwe 2.2.0: BMS pack temperature, charge and discharge current
  limits (37003-37005) as watts at the 35180 battery voltage, cell
  temperature extremes and the heat sink temperature. The old battery
  temperature read 35183, which GoodWe's map gives to battery power.
- solis 2.2.0: BMS current limits 33143/33144 as watts. The lead-acid
  probe's 200.2 C "no probe" value is dropped.
- solax 1.2.0: BMS max currents 0x0024/0x0025 as watts, radiator
  temperature, and the battery temperature in whole degrees (it was
  scaled by 0.1).
- saj 1.3.0: BMS current limits 0xA036/0xA037 as watts (liveness not
  stated by the source) and the heat sink temperature.
- sofar 2.2.0, growatt 2.2.0, solinteg 1.2.0: battery, cell and
  inverter temperatures; no documented live limit, so no watts.

A failed read is left out, never sent as 0; temperatures outside
-40..100 C and powers outside 0..100 kW are dropped. Reads and emits
only; no control path changes. Not verified on hardware.

Refs #250

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
Review of #262. A non-zero battery mode or voltage says a battery is
there, not that a BMS talks to the inverter. A lead-acid or BMS-less
pack answers zeros, and 0 C and 0 W read as a cold battery that may not
charge.

- goodwe: use the 37000 block only while 37011 (battery protocol,
  GoodWe Table 8-33) names a BMS: not 0, not 0x11F "EMS Battery" (no
  direct link) and not 0xFFFF. A talking BMS that allows 0 A still
  sends 0 W.
- solis: read 33143-33160 in one read and use the limits only while the
  battery model at 33160 names a maker (Solis map, plus the generic and
  lead-acid codes from Pho3niX90/solis_modbus); an unknown code sends
  nothing.
- Comments: solax 0x0008 may read in tenths on X3 Gen5/Gen6 (history
  only); solis 33096 is the lead-acid probe, not a BMS value; goodwe
  points at #264 for its other reads.

Refs #250

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
frahlg added a commit that referenced this pull request Nov 22, 2026
…ar, SolaX, SAJ, Growatt, Solinteg) (#262)

* feat(drivers): report what the battery can do now (GoodWe, Solis, Sofar, SolaX, SAJ, Growatt, Solinteg)

Core marks a battery "not following" when it gives less than ordered.
Most such warnings on a real site were device limits, so Core will judge
against what the battery can do now. These seven drivers now report the
device's own figures where its map documents them:

- goodwe 2.2.0: BMS pack temperature, charge and discharge current
  limits (37003-37005) as watts at the 35180 battery voltage, cell
  temperature extremes and the heat sink temperature. The old battery
  temperature read 35183, which GoodWe's map gives to battery power.
- solis 2.2.0: BMS current limits 33143/33144 as watts. The lead-acid
  probe's 200.2 C "no probe" value is dropped.
- solax 1.2.0: BMS max currents 0x0024/0x0025 as watts, radiator
  temperature, and the battery temperature in whole degrees (it was
  scaled by 0.1).
- saj 1.3.0: BMS current limits 0xA036/0xA037 as watts (liveness not
  stated by the source) and the heat sink temperature.
- sofar 2.2.0, growatt 2.2.0, solinteg 1.2.0: battery, cell and
  inverter temperatures; no documented live limit, so no watts.

A failed read is left out, never sent as 0; temperatures outside
-40..100 C and powers outside 0..100 kW are dropped. Reads and emits
only; no control path changes. Not verified on hardware.

Refs #250

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(goodwe, solis): send BMS figures only while a BMS talks

Review of #262. A non-zero battery mode or voltage says a battery is
there, not that a BMS talks to the inverter. A lead-acid or BMS-less
pack answers zeros, and 0 C and 0 W read as a cold battery that may not
charge.

- goodwe: use the 37000 block only while 37011 (battery protocol,
  GoodWe Table 8-33) names a BMS: not 0, not 0x11F "EMS Battery" (no
  direct link) and not 0xFFFF. A talking BMS that allows 0 A still
  sends 0 W.
- solis: read 33143-33160 in one read and use the limits only while the
  battery model at 33160 names a maker (Solis map, plus the generic and
  lead-acid codes from Pho3niX90/solis_modbus); an unknown code sends
  nothing.
- Comments: solax 0x0008 may read in tenths on X3 Gen5/Gen6 (history
  only); solis 33096 is the lead-acid probe, not a BMS value; goodwe
  points at #264 for its other reads.

Refs #250

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant