mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add lock typing in nuki (#73545)
This commit is contained in:
parent
2b5748912d
commit
521d52a8b9
@ -2,6 +2,7 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from pynuki import NukiLock, NukiOpener
|
||||||
from pynuki.constants import MODE_OPENER_CONTINUOUS
|
from pynuki.constants import MODE_OPENER_CONTINUOUS
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -73,11 +74,6 @@ class NukiDeviceEntity(NukiEntity, LockEntity, ABC):
|
|||||||
"""Return a unique ID."""
|
"""Return a unique ID."""
|
||||||
return self._nuki_device.nuki_id
|
return self._nuki_device.nuki_id
|
||||||
|
|
||||||
@property
|
|
||||||
@abstractmethod
|
|
||||||
def is_locked(self):
|
|
||||||
"""Return true if lock is locked."""
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device specific state attributes."""
|
"""Return the device specific state attributes."""
|
||||||
@ -108,8 +104,10 @@ class NukiDeviceEntity(NukiEntity, LockEntity, ABC):
|
|||||||
class NukiLockEntity(NukiDeviceEntity):
|
class NukiLockEntity(NukiDeviceEntity):
|
||||||
"""Representation of a Nuki lock."""
|
"""Representation of a Nuki lock."""
|
||||||
|
|
||||||
|
_nuki_device: NukiLock
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_locked(self):
|
def is_locked(self) -> bool:
|
||||||
"""Return true if lock is locked."""
|
"""Return true if lock is locked."""
|
||||||
return self._nuki_device.is_locked
|
return self._nuki_device.is_locked
|
||||||
|
|
||||||
@ -137,8 +135,10 @@ class NukiLockEntity(NukiDeviceEntity):
|
|||||||
class NukiOpenerEntity(NukiDeviceEntity):
|
class NukiOpenerEntity(NukiDeviceEntity):
|
||||||
"""Representation of a Nuki opener."""
|
"""Representation of a Nuki opener."""
|
||||||
|
|
||||||
|
_nuki_device: NukiOpener
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_locked(self):
|
def is_locked(self) -> bool:
|
||||||
"""Return true if either ring-to-open or continuous mode is enabled."""
|
"""Return true if either ring-to-open or continuous mode is enabled."""
|
||||||
return not (
|
return not (
|
||||||
self._nuki_device.is_rto_activated
|
self._nuki_device.is_rto_activated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user