Skip to content

0.26.0

Choose a tag to compare

@darkrain-nl darkrain-nl released this 08 Nov 16:11
· 49 commits to main since this release
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.