Skip to content

Commit

Permalink
Decrease string size as byte size is also smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
PSMGoossens committed Jan 12, 2025
1 parent 7941126 commit cf79b12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/solax_modbus/plugin_growatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def async_read_serialnr(hub, address):
inverter_data = await hub.async_read_holding_registers(unit=hub._modbus_addr, address=address, count=5)
if not inverter_data.isError():
decoder = BinaryPayloadDecoder.fromRegisters(inverter_data.registers, byteorder=Endian.BIG)
res = decoder.decode_string(12).decode("ascii")
res = decoder.decode_string(10).decode("ascii")
hub.seriesnumber = res
except Exception as ex: _LOGGER.warning(f"{hub.name}: attempt to read firmware failed at 0x{address:x}", exc_info=True)
if not res: _LOGGER.warning(f"{hub.name}: reading firmware number from address 0x{address:x} failed; other address may succeed")
Expand Down

0 comments on commit cf79b12

Please sign in to comment.