Skip to content

Commit e0a4ca3

Browse files
committed
error handling
1 parent d867f0a commit e0a4ca3

File tree

1 file changed

+11
-1
lines changed
  • custom_components/ble_monitor/ble_parser

1 file changed

+11
-1
lines changed

custom_components/ble_monitor/ble_parser/oras.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,17 @@ def parse_oras(self, data: bytes, mac: str):
3838
except ValueError:
3939
return None
4040

41-
sensor_data = int(data[8:11].decode("ASCII"))
41+
try:
42+
sensor_data = int(data[8:11].decode("ASCII"))
43+
except ValueError:
44+
error_code = data[8:11].decode("ASCII")
45+
_LOGGER.error(
46+
"Garnet SeeLevel II 709-BTP3 is reporting error %s for sensor %s",
47+
error_code,
48+
sensor_type
49+
)
50+
return None
51+
4252
if sensor_id == 13:
4353
sensor_data /= 10
4454

0 commit comments

Comments
 (0)