Add more tests V2
@@ -351,7 +351,7 @@ class TestBTHome:
assert sensor_msg["mac"] == "5448E68F80A5"
assert sensor_msg["packet"] == "no packet id"
assert sensor_msg["data"]
- assert sensor_msg["light"] == 1
+ assert sensor_msg["lock"] == 1
assert sensor_msg["rssi"] == -52
def test_bthome_v2_motion(self):
@@ -439,7 +439,6 @@ class TestBTHome:
assert sensor_msg["count"] == 8499
assert sensor_msg["rssi"] == -52
-
def test_bthome_v2_count_4_bytes(self):
"""Test BTHome parser for count measurement with 4 bytes"""
data_string = "043E1902010000A5808FE648540D0201060916D2FC403E33AE3221CC"
@@ -456,3 +455,21 @@ class TestBTHome:
assert sensor_msg["data"]
assert sensor_msg["count"] == 556969523
assert sensor_msg["rssi"] == -52
+
+
+ def test_bthome_v2_temperature_2_bytes_1_digit(self):
+ """Test BTHome parser for temperature measurement with 2 bytes and 1 digit"""
+ data_string = "043E1602010000A5808FE648540A0201060616D2FC400101CC"
+ data = bytes(bytearray.fromhex(data_string))
+
+ # pylint: disable=unused-variable
+ ble_parser = BleParser()
+ sensor_msg, tracker_msg = ble_parser.parse_raw_data(data)
+
+ assert sensor_msg["firmware"] == "BTHome V2"
+ assert sensor_msg["type"] == "BTHome"
+ assert sensor_msg["mac"] == "5448E68F80A5"
+ assert sensor_msg["packet"] == "no packet id"
+ assert sensor_msg["data"]
+ assert sensor_msg["temperature"] == 25.7
+ assert sensor_msg["rssi"] == -52
