From 521d52a8b90cd1e6c4f5c6f303a8f0d434b33867 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 16 Jun 2022 10:20:34 +0200 Subject: [PATCH] Add lock typing in nuki (#73545) --- homeassistant/components/nuki/lock.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/nuki/lock.py b/homeassistant/components/nuki/lock.py index 765fc5f711f..33d7465e12d 100644 --- a/homeassistant/components/nuki/lock.py +++ b/homeassistant/components/nuki/lock.py @@ -2,6 +2,7 @@ from abc import ABC, abstractmethod from typing import Any +from pynuki import NukiLock, NukiOpener from pynuki.constants import MODE_OPENER_CONTINUOUS import voluptuous as vol @@ -73,11 +74,6 @@ class NukiDeviceEntity(NukiEntity, LockEntity, ABC): """Return a unique ID.""" return self._nuki_device.nuki_id - @property - @abstractmethod - def is_locked(self): - """Return true if lock is locked.""" - @property def extra_state_attributes(self): """Return the device specific state attributes.""" @@ -108,8 +104,10 @@ class NukiDeviceEntity(NukiEntity, LockEntity, ABC): class NukiLockEntity(NukiDeviceEntity): """Representation of a Nuki lock.""" + _nuki_device: NukiLock + @property - def is_locked(self): + def is_locked(self) -> bool: """Return true if lock is locked.""" return self._nuki_device.is_locked @@ -137,8 +135,10 @@ class NukiLockEntity(NukiDeviceEntity): class NukiOpenerEntity(NukiDeviceEntity): """Representation of a Nuki opener.""" + _nuki_device: NukiOpener + @property - def is_locked(self): + def is_locked(self) -> bool: """Return true if either ring-to-open or continuous mode is enabled.""" return not ( self._nuki_device.is_rto_activated