Skip to content

Commit

Permalink
Merge pull request #1210 from PSMGoossens/main
Browse files Browse the repository at this point in the history
Growatt serial-no buffer overrun + manifest pymodbus
  • Loading branch information
wills106 authored Jan 14, 2025
2 parents 13a64e4 + 2d99211 commit 54ca1b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions custom_components/solax_modbus/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def value_function_rtc(initval, descr, datadict):
rtc_months,
rtc_years,
) = initval
val = f"{rtc_days:02}/{rtc_months:02}/{rtc_years:02} {rtc_hours:02}:{rtc_minutes:02}:{rtc_seconds:02}"
val = f"{rtc_days:02}/{rtc_months:02}/{rtc_years%100:02} {rtc_hours:02}:{rtc_minutes:02}:{rtc_seconds:02}"
return datetime.strptime(val, "%d/%m/%y %H:%M:%S") # ok since sensor.py has been adapted
except:
pass
Expand All @@ -423,7 +423,7 @@ def value_function_rtc_ymd(initval, descr, datadict):
rtc_minutes,
rtc_seconds,
) = initval
val = f"{rtc_days:02}/{rtc_months:02}/{rtc_years:02} {rtc_hours:02}:{rtc_minutes:02}:{rtc_seconds:02}"
val = f"{rtc_days:02}/{rtc_months:02}/{rtc_years%100:02} {rtc_hours:02}:{rtc_minutes:02}:{rtc_seconds:02}"
return datetime.strptime(val, "%d/%m/%y %H:%M:%S") # ok since sensor.py has been adapted
except:
pass
Expand Down
4 changes: 2 additions & 2 deletions custom_components/solax_modbus/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"integration_type": "hub",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/wills106/homsassistant-solax-modbus/issues",
"requirements": ["pymodbus==3.7.4"],
"version": "2025.01.6"
"requirements": ["pymodbus==3.8.3"],
"version": "2025.01.7"
}
4 changes: 2 additions & 2 deletions custom_components/solax_modbus/plugin_growatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
async def async_read_serialnr(hub, address):
res = None
try:
inverter_data = await hub.async_read_holding_registers(unit=hub._modbus_addr, address=address, count=6)
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 54ca1b8

Please sign in to comment.