Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Growatt serial-no buffer overrun + manifest pymodbus #1210

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading