mirror of
https://github.com/suaveolent/hoymiles-wifi.git
synced 2024-09-20 03:10:11 +00:00
error handling
This commit is contained in:
parent
9cca37d8a9
commit
d7fa6d964b
@ -236,9 +236,12 @@ class Inverter:
|
||||
self.set_state(NetworkState.Offline)
|
||||
return None
|
||||
|
||||
read_length = struct.unpack('>H', buf[6:8])[0]
|
||||
|
||||
try:
|
||||
if len(buf) < 8:
|
||||
raise ValueError("Buffer is too short for unpacking")
|
||||
|
||||
read_length = struct.unpack('>H', buf[6:8])[0]
|
||||
|
||||
parsed = response_type.FromString(buf[10:10 + read_length])
|
||||
|
||||
if not parsed:
|
||||
|
Loading…
Reference in New Issue
Block a user