Skip to content

Commit

Permalink
Remove passive detection of contact sensors (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Sep 16, 2023
1 parent 8c38ab8 commit 495490d
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 495490d

Please sign in to comment.