Skip to content

Commit

Permalink
Merge pull request #12 from salberin/error-handling-modbus-latest
Browse files Browse the repository at this point in the history
Update error handling for compatibility with latest pyModbusTCP
  • Loading branch information
peplin authored Feb 28, 2024
2 parents 5d83510 + e4a1965 commit 280b12d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions solaredge.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,10 @@ def decode_value(data, scalefactor):

await solar_client.write(datapoint)
else:
# Error during data receive
if client.last_error() == 2:
logger.error(
f"Failed to connect to SolarEdge inverter {client.host()}!"
)
elif client.last_error() == 3 or client.last_error() == 4:
logger.error("Send or receive error!")
elif client.last_error() == 5:
logger.error("Timeout during send or receive operation!")
logger.error(
"Failed while connecting or receiving data from "
f"SolarEdge inverter {client.host}: {client.last_error_as_txt}"
)
except InfluxDBWriteError as e:
logger.error(f"Failed to write to InfluxDb: {e}")
except IOError as e:
Expand Down

0 comments on commit 280b12d

Please sign in to comment.