Repository navigation
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.