diff --git a/pynuki/bridge.py b/pynuki/bridge.py index 0b27669..b206870 100644 --- a/pynuki/bridge.py +++ b/pynuki/bridge.py @@ -253,38 +253,44 @@ def locks(self): def openers(self): return self._get_devices(device_type=const.DEVICE_TYPE_OPENER) - def lock(self, nuki_id, block=False): + def lock(self, nuki_id, device_type=const.DEVICE_TYPE_LOCK, block=False): return self.lock_action( nuki_id, action=const.ACTION_LOCK_LOCK, - device_type=const.DEVICE_TYPE_LOCK, + device_type=device_type, block=block, ) - def unlock(self, nuki_id, block=False): + def unlock(self, nuki_id, device_type=const.DEVICE_TYPE_LOCK, block=False): return self.lock_action( nuki_id, action=const.ACTION_LOCK_UNLOCK, - device_type=const.DEVICE_TYPE_LOCK, + device_type=device_type, block=block, ) - def lock_n_go(self, nuki_id, unlatch=False, block=False): + def lock_n_go( + self, + nuki_id, + device_type=const.DEVICE_TYPE_LOCK, + unlatch=False, + block=False, + ): action = const.ACTION_LOCK_LOCK_N_GO if unlatch: action = const.ACTION_LOCK_LOCK_N_GO_WITH_UNLATCH return self.lock_action( nuki_id, action=action, - device_type=const.DEVICE_TYPE_LOCK, + device_type=device_type, block=block, ) - def unlatch(self, nuki_id, block=False): + def unlatch(self, nuki_id, device_type=const.DEVICE_TYPE_LOCK, block=False): return self.lock_action( nuki_id, action=const.ACTION_LOCK_UNLATCH, - device_type=const.DEVICE_TYPE_LOCK, + device_type=device_type, block=block, ) diff --git a/pynuki/lock.py b/pynuki/lock.py index 98c2bbf..04c6687 100644 --- a/pynuki/lock.py +++ b/pynuki/lock.py @@ -37,15 +37,24 @@ def battery_critical_keypad(self): return self._json.get("keypadBatteryCritical") def lock(self, block=False): - return self._bridge.lock(nuki_id=self.nuki_id, block=block) + return self._bridge.lock( + nuki_id=self.nuki_id, device_type=self.device_type, block=block + ) def unlock(self, block=False): - return self._bridge.unlock(nuki_id=self.nuki_id, block=block) + return self._bridge.unlock( + nuki_id=self.nuki_id, device_type=self.device_type, block=block + ) def lock_n_go(self, unlatch=False, block=False): return self._bridge.lock_n_go( - nuki_id=self.nuki_id, unlatch=unlatch, block=block + nuki_id=self.nuki_id, + unlatch=unlatch, + device_type=self.device_type, + block=block, ) def unlatch(self, block=False): - return self._bridge.unlatch(nuki_id=self.nuki_id, block=block) + return self._bridge.unlatch( + nuki_id=self.nuki_id, device_type=self.device_type, block=block + )