Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion switchbot/adv_parsers/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def process_wolock_pro(
"unclosed_alarm": bool(mfr_data[11] & 0b10000000),
"unlocked_alarm": bool(mfr_data[11] & 0b01000000),
"auto_lock_paused": bool(mfr_data[8] & 0b100000),
"night_latch": bool(mfr_data[9] & 0b00000001),
# Looks like night latch bit is not anymore in ADV
"night_latch": False,
}
_LOGGER.debug(res)
return res
33 changes: 33 additions & 0 deletions tests/test_adv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,39 @@ def test_parsing_lock_pro_passive():
)


def test_parsing_lock_pro_passive_nightlatch_disabled():
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
adv_data = generate_advertisement_data(
manufacturer_data={2409: bytes.fromhex("aabbccddeeff0a8200630000")}, rssi=-67
)
result = parse_advertisement_data(ble_device, adv_data, SwitchbotModel.LOCK_PRO)
assert result == SwitchBotAdvertisement(
address="aa:bb:cc:dd:ee:ff",
data={
"data": {
"battery": None,
"calibration": True,
"status": LockStatus.LOCKED,
"update_from_secondary_lock": False,
"door_open": False,
"double_lock_mode": False,
"unclosed_alarm": False,
"unlocked_alarm": False,
"auto_lock_paused": False,
"night_latch": False,
},
"model": "$",
"isEncrypted": False,
"modelFriendlyName": "Lock Pro",
"modelName": SwitchbotModel.LOCK_PRO,
"rawAdvData": None,
},
device=ble_device,
rssi=-67,
active=False,
)


def test_parsing_lock_active_old_firmware():
"""Test parsing lock with active data. Old firmware."""
ble_device = generate_ble_device("aa:bb:cc:dd:ee:ff", "any")
Expand Down
Loading