Repository navigation
Releases
0.32.0
Every public name now has one spelling and one import path. This is the API 1.0 will promise.
Breaking
sofar_modbus.modernis removed. Import fromsofar_modbus, orsofar_modbus.tuningfor link measurement. PR #100.- The aliases
BatConfigCellType,BatConfigProtocol,BatConfigWriteStatusandFeedinLimitationModeare removed. UseBatteryConfigCellType,BatteryConfigProtocol,BatteryConfigWriteStatusandFeedInLimitationMode. PR #100.
No behaviour change; the library snapshots are unchanged and Core's sofar suite passes on dev unchanged. PR #100.
0.31.0
The public names settle before 1.0, and the parallel-system settings read as the spec defines them.
Breaking
RtcSyncResultis nowRtcSync, so it no longer reads like theSyncRtcResultenum.inverter.rtc_syncis unchanged. PR #99.ParallelMasterslaveis nowParallelRole, with membersPRIMARYandSECONDARY, and the fieldparallel_masterslaveis nowparallel_role. PR #99.matchesandidentifyare no longer exported. PR #99.expected_readings_componentsandexpected_settings_componentsare removed;expected_componentscovers both. PR #99.sofar_modbus.tuningdeclares__all__(LinkStats,LinkTuning,TimedUnit), andWINDOWis private. PR #99.
Changed
FeedinLimitationModeis nowFeedInLimitationMode, andBatConfigProtocol,BatConfigCellTypeandBatConfigWriteStatusare nowBatteryConfigProtocol,BatteryConfigCellTypeandBatteryConfigWriteStatus. The old names remain as aliases until Core moves, and go withsofar_modbus.modern. PR #99.
Fixed
parallel_control(0x1035) reads asParallelControlMode:DISABLED,ACorAC_AND_BATTERY. As a boolean, an inverter with AC+battery parallel enabled readNone. PR #99.
Not hardware-verified: every capture we hold has parallel control disabled. Core's sofar suite passes on dev unchanged. PR #99.
0.30.0
Groundwork for 1.0.0: the library now promises only what can be tested on real hardware, and says which names that covers.
Breaking
SofarLegacyInverterand the legacy register map are removed. The map was never verified on an older inverter and is known to be off against the G1 spec. Owners of an older inverter are invited to help bring it back:script/query.py <address> --legacyreads the serial number and raw register blocks to share in an issue. PR #97.InverterType.AC,MICandDCBare removed, along with their module-level aliases insofar_modbus.variants. Nothing read them. PR #97.LinkTuneris private and itsrestore()is gone.inverter.link_tuningandinverter.link_statsare unchanged. PR #97.
Changed
- The register map moves out of
sofar_modbus.modernintosofar_modbus, and every public name is exported from the package itself.sofar_modbus.modernkeeps thin re-exports for the names in use today and will be removed before 1.0. PR #97. - The README has a Public API section: everything in
sofar_modbus.__all__plussofar_modbus.tuning. Other submodules and underscored names are internal. PR #98. - The package carries the
Development Status :: 5 - Production/StableandTyping :: Typedclassifiers. PR #98.
No behaviour change for modern inverters; the library snapshots are unchanged. PRs #97 and #98.
0.29.0
A silent inverter or battery tower always raises its own error, and the library's lookups are explicit.
Changed
async_update_readings,async_update_settings,async_update,async_update_packsandasync_ensure_setupno longer takeraise_when_silent. On an open link they always raiseInverterSilentErrororBatteryTowerSilentErrorwhen the inverter or tower is silent, including a gateway that answers with a target failure for every component.async_detectstill raises a gateway'sGatewayTargetErroras is. PR #96.- A silent battery tower on a closed link raises
ModbusTimeoutErrorwith the failure as its cause, as the inverter polls already did. PR #96. PvStringandBatteryStringno longer havecomponent_name, andBatteryPack.async_select()andLinkTuner.observe_failure()take no arguments. PR #92.
Fixed
- Any refusal (exception 1, 2 or 3) to the EPS or fault-log probe counts as absence. An inverter answering the EPS probe with exception 3 used to fail setup on every try. PR #92.
Internal
- Components, fault registers and register addresses are named explicitly instead of looked up by string, and pack selection is decoded in one place on
BatteryPack. PR #92.
Hardware-verified on a 4.4 KTLX-G3 through a proxy that forwards, swallows requests or answers with exception 0x0B. The pack changes were verified on a 3-group BTS tower by @rzirzi, who also contributed the ESI-10K-T1 replay fixture. Thanks!
0.28.1
Fixes a gateway's silence during setup leaking past raise_when_silent.
Fixed
- With
raise_when_silent=True, a gateway target error (0x0B) during setup on an open link now raisesInverterSilentError, as a timeout already did. Before, the first poll through a gateway with a silent inverter raised a rawGatewayTargetError. Without the flag, setup andasync_detectraise what they did before.
Hardware-verified on a 4.4 KTLX-G3 by restarting Home Assistant through a proxy that answers with exception 0x0B. PR #95.
0.28.0
A silent inverter or battery tower can now be told apart from a dead link by type.
Added
SilentError, aModbusTimeoutError, withInverterSilentErrorandBatteryTowerSilentErrorunder it. Existingexcept ModbusTimeoutErrorhandlers still catch them.- A timeout before anything answered, with the link still open, raises
InverterSilentErrorfrom the polls, setup andasync_detect. A closed link still raises the plainModbusTimeoutError. raise_when_silentonasync_update_readings,async_update_settings,async_updateandasync_update_packs. It also raises when every component failed with a timeout or a gateway target error, and when the battery tower is silent. Without it the polls behave as before.
Fixed
async_update_packson an inverter without a battery tower reports ano battery towerfailure instead of an empty report.
Hardware-verified on a 4.4 KTLX-G3 through a proxy that swallows requests or answers with exception 0x0B; the tower path is not hardware-verified. PR #94.
0.27.0
Battery cut-offs now read back in the same terms the write takes them.
Added
BatteryConfig.on_grid_discharge_cutoff_soc,off_grid_discharge_cutoff_socandoff_grid_recovery_soc: the cut-offs as charge left, in %, matchingasync_write_battery_cutoffs. Each isNonewhen an input register is unread.
Not hardware-verified. PR #91.
0.26.0
Writes the battery cut-offs and polls every pack of a BTS battery tower.
Added
SofarInverter.async_write_battery_cutoffs()sets the on-grid and off-grid discharge cut-offs, the off-grid recovery SOC and, where the 0x1040 mask declares 0x105B, the charge cut-off, in the SofarCloud app's percentages and ranges (#75). It writes the battery config back from 0x1044 with only those values changed, then reads it back, since the status register can report success for an older commit. Values already set are not written. Three-phase hybrids only, and lead-acid batteries are refused unless the protocol is BTS 5K. A refused or unkept commit raisesBatteryConfigWriteError, aModbusErrorcarryingBatConfigWriteStatus.async_update_packs()polls every pack of a BTS tower into its ownBatteryPackinbattery_packs, keyed by(group_nr, pack_nr). It skips groups the online bitmap (0x9022) reports offline, and flags a pack that fails or that the tower did not switch to withanswered=False. Its report names theBATTERY_PACKScomponent, which is in neither poll.battery_towerholds the layout, andcell_voltagesandcell_temperaturesgive a pack's cells in order.query.py --packsruns that poll twice, and--debugprints the library's log.
Changed
has_battery_towercomes from a setup probe of the tower layout (0x9007-0x900D), not from the serial alone, so a hybrid running another battery over CAN no longer claims a tower. A refusal or an empty layout means no tower; a silent block keeps the verdict a caller passes back ashas_battery_tower=True, and costs one link timeout.
Fixed
async_read_pack()sets the pack numbers inside the pack lock, so overlapping reads no longer report each other's pack.
Hardware-verified on an ESI-10K-T1 with a three-pack BTS 5K tower: the pack poll, both cut-off write sizes, the skip and the validation. PRs #86 and #88.
0.25.4
Fixes components settled wrongly when a mask read gets a transient error answer during setup, such as a busy inverter or a gateway that lost its target.
Fixed
- A mask read answered with a transient Modbus exception (device failure, acknowledge, busy, memory parity, gateway path or gateway target) or a garbled frame no longer reads as "no mask". Before, one such answer dropped a declared charge cut-off until the next setup and left an unknown serial unrecognized. Setup now fails and the next poll asks again; only an illegal function, address or value answer means the block publishes no mask. A gateway-target answer on the battery tower block still means no tower.
Not hardware-verified. PR #85.
0.25.3
Fixes components settled wrongly when a mask read times out during setup, such as while an inverter wakes at dawn.
Fixed
- A timed-out mask read no longer settles what the inverter serves. Before, a denied meter block was kept and polled indeterminate values (on a 4.4 KTLX-G3, load consumption total echoed the solar total), a declared charge cut-off was dropped, and a higher PV string count was missed, each until the next setup. Setup now fails on such a timeout and the next poll asks again; a refusal is still final.
Reproduced and verified on a 4.4 KTLX-G3 by dropping the mask read through a proxy. PR #82.