Skip to content

Commit

Permalink
Remove passive detection of contact sensors
Browse files Browse the repository at this point in the history
We cannot tell these apart from the new Curtain v3
with only passive data so best not to be wrong about
what the device is
  • Loading branch information
bdraco committed Sep 16, 2023
1 parent 8c38ab8 commit c53de4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
1 change: 0 additions & 1 deletion switchbot/adv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class SwitchbotSupportedType(TypedDict):
"modelFriendlyName": "Contact Sensor",
"func": process_wocontact,
"manufacturer_id": 2409,
"manufacturer_data_length": 13,
},
"H": {
"modelName": SwitchbotModel.BOT,
Expand Down
26 changes: 4 additions & 22 deletions tests/test_adv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,28 +593,10 @@ def test_contact_sensor_mfr_no_service_data():
rssi=-70,
)
result = parse_advertisement_data(ble_device, adv_data)
assert result == SwitchBotAdvertisement(
address="aa:bb:cc:dd:ee:ff",
data={
"data": {
"battery": None,
"button_count": 4,
"contact_open": True,
"contact_timeout": True,
"is_light": False,
"motion_detected": False,
"tested": None,
},
"isEncrypted": False,
"model": "d",
"modelFriendlyName": "Contact Sensor",
"modelName": SwitchbotModel.CONTACT_SENSOR,
"rawAdvData": None,
},
device=ble_device,
rssi=-70,
active=False,
)
# Passive detection of contact sensor is not supported
# anymore since the Switchbot Curtain v3 was released
# which uses the heuristics for the contact sensor.
assert result is None


def test_contact_sensor_srv():
Expand Down

0 comments on commit c53de4b

Please sign in to comment.