Skip to content

Commit

Permalink
add real Exception Log for WaitForAck
Browse files Browse the repository at this point in the history
add real Exception Log for WaitForAck
  • Loading branch information
reserve85 authored Sep 11, 2024
1 parent 8022dd7 commit 22c1cf4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### script
* fix Priority Limit Calculation in Priority Mode and Mixed Mode (https://github.com/reserve85/HoymilesZeroExport/issues/228)
* added a "Debug" Reader and DTU just for debugging.
* Log the real "error message" in Function WaitForAck
### config
* added a "Debug" Reader and DTU just for debugging.

Expand Down
15 changes: 10 additions & 5 deletions HoymilesZeroExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ def SetLimit(pLimit):
if not DTU.WaitForAck(i, SET_LIMIT_TIMEOUT_SECONDS):
SetLimit.LastLimitAck = False
LASTLIMITACKNOWLEDGED[i] = False

except:
logger.error("Exception at SetLimit")
SetLimit.LastLimitAck = False
Expand Down Expand Up @@ -1090,8 +1089,11 @@ def WaitForAck(self, pInverterId: int, pTimeoutInS: int):
else:
logger.info('Ahoy: Inverter "%s": Limit timeout!', NAME[pInverterId])
return ack
except:
logger.info('Ahoy: Inverter "%s": Limit timeout!', NAME[pInverterId])
except Exception as e:
if hasattr(e, 'message'):
logger.error('Ahoy: Inverter "%s" WaitForAck: "%s"', NAME[pInverterId], e.message)
else:
logger.error('Ahoy: Inverter "%s" WaitForAck: "%s"', NAME[pInverterId], e)
return False

def SetLimit(self, pInverterId: int, pLimit: int):
Expand Down Expand Up @@ -1227,8 +1229,11 @@ def WaitForAck(self, pInverterId: int, pTimeoutInS: int):
else:
logger.info('OpenDTU: Inverter "%s": Limit timeout!', NAME[pInverterId])
return ack
except:
logger.info('OpenDTU: Inverter "%s": Limit timeout!', NAME[pInverterId])
except Exception as e:
if hasattr(e, 'message'):
logger.error('OpenDTU: Inverter "%s" WaitForAck: "%s"', NAME[pInverterId], e.message)
else:
logger.error('OpenDTU: Inverter "%s" WaitForAck: "%s"', NAME[pInverterId], e)
return False

def SetLimit(self, pInverterId: int, pLimit: int):
Expand Down

0 comments on commit 22c1cf4

Please sign in to comment.