Repository navigation
feat(svk): report what the battery can do now (Solis 50-125k, Konja) - #252
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
frahlg
force-pushed
the
battery-limits-g5
branch
from
November 22, 2026 09:26
48ff31b to
afae55f
Compare
frahlg
added a commit
that referenced
this pull request
Nov 22, 2026
With control on, a failed battery-power read (34755) made the Solis self-heal raise: math.abs(nil) in 50-125k-svk, nil - committed in 50-125k-svk-slew. The whole poll failed, so one missed read cost all telemetry for that poll. The check now skips a poll with no battery reading and starts its count again. With a reading it works as before. 50-125k-svk-ac-slew already checked its AC reading. Not checked on hardware. Refs #252 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
force-pushed
the
battery-limits-g5
branch
from
November 22, 2026 09:39
afae55f to
bfc7c16
Compare
frahlg
added a commit
that referenced
this pull request
Nov 22, 2026
…14) (#261) With control on, a failed battery-power read (34755) made the Solis self-heal raise: math.abs(nil) in 50-125k-svk, nil - committed in 50-125k-svk-slew. The whole poll failed, so one missed read cost all telemetry for that poll. The check now skips a poll with no battery reading and starts its count again. With a reading it works as before. 50-125k-svk-ac-slew already checked its AC reading. Not checked on hardware. Refs #252 Signed-off-by: Fredrik Ahlgren <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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]>
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
force-pushed
the
battery-limits-g5
branch
from
November 22, 2026 09:45
bfc7c16 to
b10fd88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Core will judge a battery against what it can do now, not only against the order (#250). This PR brings four SvK drivers in line with that contract: the three Solis 50-125 kW drivers and the Konja MG-261. It changes reads and emits only. Control, slew, self-heal and writes stay as they were. The Solis drivers keep main's 60 s cadence for the limit block and add two small temperature reads on that same poll.
Refs #250
Solis: 50-125k-svk 0.3.0, 50-125k-svk-slew 0.2.0, 50-125k-svk-ac-slew 0.3.0
The three drivers share the same poll code, so each gets the same change.
battery.available_charge_W, metricbattery_available_charge_wbattery.available_discharge_W, metricbattery_available_discharge_winverter.available_import_Winverter.available_export_Wbattery.temperature_C, metricbattery_temp_cbattery_cell_temp_min_c/battery_cell_temp_max_cinverter_temp_cWhat changed:
temperature_Cis the middle of the coldest and hottest cell, sent only when both answer and lie in -40 to 100 °C. The inverter module gets -40 to 150 °C, since power electronics derate above 100 °C. A failed read leaves them out; a value is held only until the next read. The two reads go through the drivers' existingbundle_read, so a register a unit lacks stops costing a failed read every minute.battery_available_charge_w,battery_available_discharge_w,battery_temp_c,battery_cell_temp_min_c,battery_cell_temp_max_candinverter_temp_c, on each read.SoC_nom_fract = 0. It is now left out, and so is the Wh headroom when there is no SoC or no configured capacity.Same source as before: the parallel-system figure first, then this unit's (
par_avail_* or avail_*on main). A read never left the parallel value empty, so in practice the drivers send 25012-25019. This unit's own registers, 25004-25011, exist and would matchbattery.W(34755, this unit's battery) more closely. Blixt L1 feedsinverter.available_import_W/available_export_Winto its arbitrator clamp, so switching is a decision for the Solis site owners, not part of this PR. Both sets are logged once at the first read to help with that decision.Source: the driver already read 25004-25019. The temperature addresses, and the meaning of all of them, come from the vendor documents cited by the full
solis_50_125k.luadriver these drivers were cut down from (Blixt gateway history, commitd95e07f): Solis RS485_MODBUS ESINV-33000ID Hybrid (2021-12-28, under NDA) and the "50~125K FCR Application" sheet of Solis's "Modbus Register usage scheme of Application Scenarios" (Ver 20260304/20260310). I could not read either; neither is public, so they are named in a code comment rather than inupstream_docs.Not confirmed: the notes on hand do not say outright that 25004-25019 follow the BMS live. They are read-only (FC04) registers in the Remote Control block, next to 25003, whose bits flag a BMS, inverter or grid limit. That suggests figures the inverter works out, not settings, but nobody has confirmed it. The temperature addresses are also unverified on hardware, and which battery (Batt1 or both) 34350/34351 cover is not stated.
Konja: konja-261-svk 0.4.0
No new reads. Everything comes from the BMS and PCS blocks the driver already reads every poll.
battery.temperature_C, metricbattery_temp_cbattery.available_charge_W, metricbattery_available_charge_wbattery.available_discharge_W, metricbattery_available_discharge_winverter_temp_c(and the existinginverter.heatsink_C)Source: Konja
261_EMS_Protocol_V116 - PCS - EN.xlsx(V1.16), as already decoded in the driver. I did not have the workbook itself.What changed:
Wwas sent as 0 W when the PCS block failed. It is now left out. The control path keeps its own 0 fallback, unchanged.Not confirmed: 2758-2761 are read-only values in the BMS block, and the forbid flag next to them is clearly live. But the workbook rows quoted in the driver do not say that the powers follow temperature and SoC. No grid headroom is reported: no row the driver decodes gives one. PCS 8255/8256 and EMS 304/306 are settings and are not used.
Bounds: battery temperature -40 to 100 °C; IGBT temperature -40 to 150 °C, because power electronics derate above 100 °C and a 100 °C cut would hide the reading that explains a derate; power 0 to 1000 kW. The raw 0.1 kW count is checked before scaling, so a 32-bit Lua build cannot wrap a large value back into range.
Found, not changed here
The Solis self-heal does
math.abs(bat_w)(andbat_w - slew_committed_win the slew drivers) while control is on. If 34755 fails, that raises an error. It is control logic, so it gets its own PR.Tests
drivers/tests/lua_harness/test_battery_limits_solis_svk.lua(run once for each Solis driver) andtest_battery_limits_konja.lua, wrapped bydrivers/tests/test_battery_limits_svk.py. Solis: the parallel figure first, with fallback to this unit's only when it is missing; 0 W kept; temperatures with the right scale and sign, below zero included; the limit block and both temperature reads on poll 1 and poll 12 and none between, with values held; fields and metrics cleared after a failed read that follows a good one, and back after recovery; a failed limit block keeps the temperatures and the reverse; out-of-range values dropped at and just past each bound; no 0 % SoC or Wh headroom without a SoC. Konja: scale and sign; the forbid gate; the 10 s metric rate; fields cleared after a failed BMS read; no 0 W battery power without a PCS reading; bounds at and just past each limit. Both scripts fail onorigin/main's drivers.make test-driver ID=50-125k-svk,ID=50-125k-svk-slew,ID=50-125k-svk-ac-slew,ID=konja-261-svk: all pass.make check: 5079 passed, 929 skipped (rebased on main after docs: what a battery can do now (temperature, available power, device state) #250, feat(sungrow): report what the battery can do now (1.7.0) #251 and feat(victron_mqtt, victron, ferroamp_modbus, zap): what the battery can do now #254).driver_pollupvalues stay under LuaJIT's 60 (46 counted byluac5.5, which includes_ENV).Not verified on hardware.
🤖 Generated with Claude Code