Skip to content

Commit

Permalink
fix: Ignore incorrect datetime while parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Sep 2, 2024
1 parent e0ce0a4 commit 60bd1e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/solarman/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ def try_parse_datetime(self, rawData, definition, start, length):
if value.endswith(":"):
value = value[:-1]

self.set_state(key, datetime.strptime(value, '%y/%m/%d %H:%M:%S'))
try:
self.set_state(key, datetime.strptime(value, '%y/%m/%d %H:%M:%S'))
except Exception as e:
_LOGGER.debug(f"ParameterParser.try_parse_datetime: start: {start}, length: {length}, rawData: {rawData}, definition: {definition} [{format_exception(e)}]")

return

Expand Down

0 comments on commit 60bd1e0

Please sign in to comment.