Skip to content

Releases

0.32.0

Choose a tag to compare

@darkrain-nl darkrain-nl released this 14 Nov 13:11
fb2fb7d

Every public name now has one spelling and one import path. This is the API 1.0 will promise.

Breaking

  • sofar_modbus.modern is removed. Import from sofar_modbus, or sofar_modbus.tuning for link measurement. PR #100.
  • The aliases BatConfigCellType, BatConfigProtocol, BatConfigWriteStatus and FeedinLimitationMode are removed. Use BatteryConfigCellType, BatteryConfigProtocol, BatteryConfigWriteStatus and FeedInLimitationMode. PR #100.

No behaviour change; the library snapshots are unchanged and Core's sofar suite passes on dev unchanged. PR #100.

0.31.0

Choose a tag to compare

@darkrain-nl darkrain-nl released this 14 Nov 12:03
2407796

The public names settle before 1.0, and the parallel-system settings read as the spec defines them.

Breaking

  • RtcSyncResult is now RtcSync, so it no longer reads like the SyncRtcResult enum. inverter.rtc_sync is unchanged. PR #99.
  • ParallelMasterslave is now ParallelRole, with members PRIMARY and SECONDARY, and the field parallel_masterslave is now parallel_role. PR #99.
  • matches and identify are no longer exported. PR #99.
  • expected_readings_components and expected_settings_components are removed; expected_components covers both. PR #99.
  • sofar_modbus.tuning declares __all__ (LinkStats, LinkTuning, TimedUnit), and WINDOW is private. PR #99.

Changed

  • FeedinLimitationMode is now FeedInLimitationMode, and BatConfigProtocol, BatConfigCellType and BatConfigWriteStatus are now BatteryConfigProtocol, BatteryConfigCellType and BatteryConfigWriteStatus. The old names remain as aliases until Core moves, and go with sofar_modbus.modern. PR #99.

Fixed

  • parallel_control (0x1035) reads as ParallelControlMode: DISABLED, AC or AC_AND_BATTERY. As a boolean, an inverter with AC+battery parallel enabled read None. 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

Choose a tag to compare

@darkrain-nl darkrain-nl released this 14 Nov 11:06
0674e6c

Groundwork for 1.0.0: the library now promises only what can be tested on real hardware, and says which names that covers.

Breaking

  • SofarLegacyInverter and 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> --legacy reads the serial number and raw register blocks to share in an issue. PR #97.
  • InverterType.AC, MIC and DCB are removed, along with their module-level aliases in sofar_modbus.variants. Nothing read them. PR #97.
  • LinkTuner is private and its restore() is gone. inverter.link_tuning and inverter.link_stats are unchanged. PR #97.

Changed

  • The register map moves out of sofar_modbus.modern into sofar_modbus, and every public name is exported from the package itself. sofar_modbus.modern keeps 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__ plus sofar_modbus.tuning. Other submodules and underscored names are internal. PR #98.
  • The package carries the Development Status :: 5 - Production/Stable and Typing :: Typed classifiers. PR #98.

No behaviour change for modern inverters; the library snapshots are unchanged. PRs #97 and #98.

0.29.0

Choose a tag to compare

@darkrain-nl darkrain-nl released this 14 Nov 08:06
7fb446a

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_packs and async_ensure_setup no longer take raise_when_silent. On an open link they always raise InverterSilentError or BatteryTowerSilentError when the inverter or tower is silent, including a gateway that answers with a target failure for every component. async_detect still raises a gateway's GatewayTargetError as is. PR #96.
  • A silent battery tower on a closed link raises ModbusTimeoutError with the failure as its cause, as the inverter polls already did. PR #96.
  • PvString and BatteryString no longer have component_name, and BatteryPack.async_select() and LinkTuner.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

Choose a tag to compare

@darkrain-nl darkrain-nl released this 13 Nov 13:44
d7c517a

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 raises InverterSilentError, as a timeout already did. Before, the first poll through a gateway with a silent inverter raised a raw GatewayTargetError. Without the flag, setup and async_detect raise 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

Choose a tag to compare

@darkrain-nl darkrain-nl released this 13 Nov 12:41
4827b5b

A silent inverter or battery tower can now be told apart from a dead link by type.

Added

  • SilentError, a ModbusTimeoutError, with InverterSilentError and BatteryTowerSilentError under it. Existing except ModbusTimeoutError handlers still catch them.
  • A timeout before anything answered, with the link still open, raises InverterSilentError from the polls, setup and async_detect. A closed link still raises the plain ModbusTimeoutError.
  • raise_when_silent on async_update_readings, async_update_settings, async_update and async_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_packs on an inverter without a battery tower reports a no battery tower failure 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

Choose a tag to compare

@darkrain-nl darkrain-nl released this 10 Nov 09:06
d373005

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_soc and off_grid_recovery_soc: the cut-offs as charge left, in %, matching async_write_battery_cutoffs. Each is None when an input register is unread.

Not hardware-verified. PR #91.

0.26.0

Choose a tag to compare

@darkrain-nl darkrain-nl released this 08 Nov 16:11
d35a35b

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 raises BatteryConfigWriteError, a ModbusError carrying BatConfigWriteStatus.
  • async_update_packs() polls every pack of a BTS tower into its own BatteryPack in battery_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 with answered=False. Its report names the BATTERY_PACKS component, which is in neither poll. battery_tower holds the layout, and cell_voltages and cell_temperatures give a pack's cells in order.
  • query.py --packs runs that poll twice, and --debug prints the library's log.

Changed

  • has_battery_tower comes 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 as has_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

Choose a tag to compare

@darkrain-nl darkrain-nl released this 07 Nov 11:52
7e7aab7

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

Choose a tag to compare

@darkrain-nl darkrain-nl released this 30 Oct 07:51
9dff683

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.