Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernst79 committed Feb 27, 2024
1 parent d867f0a commit e0a4ca3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion custom_components/ble_monitor/ble_parser/oras.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ def parse_oras(self, data: bytes, mac: str):
except ValueError:
return None

sensor_data = int(data[8:11].decode("ASCII"))
try:
sensor_data = int(data[8:11].decode("ASCII"))
except ValueError:
error_code = data[8:11].decode("ASCII")
_LOGGER.error(
"Garnet SeeLevel II 709-BTP3 is reporting error %s for sensor %s",
error_code,
sensor_type
)
return None

if sensor_id == 13:
sensor_data /= 10

Expand Down

0 comments on commit e0a4ca3

Please sign in to comment.