|
@@ -940,6 +940,29 @@ def test_wosensor_passive_only():
|
|
|
)
|
|
|
|
|
|
|
|
|
+def test_wosensor_active_zero_data():
|
|
|
+ """Test parsing wosensor with active data but all values are zero."""
|
|
|
+ ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|
|
|
+ adv_data = generate_advertisement_data(
|
|
|
+ manufacturer_data={},
|
|
|
+ service_data={"0000fd3d-0000-1000-8000-00805f9b34fb": b"T\x00\x00\x00\x00\x00"},
|
|
|
+ tx_power=-127,
|
|
|
+ rssi=-50,
|
|
|
+ )
|
|
|
+ result = parse_advertisement_data(ble_device, adv_data)
|
|
|
+ assert result == SwitchBotAdvertisement(
|
|
|
+ address="aa:bb:cc:dd:ee:ff",
|
|
|
+ data={
|
|
|
+ "data": {},
|
|
|
+ "isEncrypted": False,
|
|
|
+ "model": "T",
|
|
|
+ "rawAdvData": b"T\x00\x00\x00\x00\x00",
|
|
|
+ },
|
|
|
+ device=ble_device,
|
|
|
+ rssi=-50,
|
|
|
+ active=True,
|
|
|
+ )
|
|
|
+
|
|
|
def test_woiosensor_passive_and_active():
|
|
|
"""Test parsing woiosensor as passive with active data as well."""
|
|
|
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
|