Skip to content

Commit 4af053e

Browse files
authored
Changed lock model constructor to not require advertisement data (#167)
1 parent 427188c commit 4af053e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

switchbot/devices/lock.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import logging
66
from typing import Any
77

8+
from bleak.backends.device import BLEDevice
89
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
910

1011
from ..const import LockStatus
11-
from ..models import SwitchBotAdvertisement
1212
from .device import SwitchbotDevice
1313

1414
COMMAND_HEADER = "57"
@@ -31,7 +31,7 @@ class SwitchbotLock(SwitchbotDevice):
3131

3232
def __init__(
3333
self,
34-
advertisement: SwitchBotAdvertisement,
34+
device: BLEDevice,
3535
key_id: str,
3636
encryption_key: str,
3737
interface: int = 0,
@@ -50,8 +50,7 @@ def __init__(
5050
self._key_id = key_id
5151
self._encryption_key = bytearray.fromhex(encryption_key)
5252
self._notifications_enabled: bool = False
53-
super().__init__(advertisement.device, None, interface, **kwargs)
54-
self.update_from_advertisement(advertisement)
53+
super().__init__(device, None, interface, **kwargs)
5554

5655
async def lock(self) -> bool:
5756
"""Send lock command."""

0 commit comments

Comments
 (0)