Add lock typing in components (#73539)
* Add lock typing in components * Revert freedompro amends
This commit is contained in:
parent
8c0ae545c9
commit
f8f1bfde21
15 changed files with 78 additions and 54 deletions
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
|
@ -50,18 +51,18 @@ def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None:
|
|||
class SmartThingsLock(SmartThingsEntity, LockEntity):
|
||||
"""Define a SmartThings lock."""
|
||||
|
||||
async def async_lock(self, **kwargs):
|
||||
async def async_lock(self, **kwargs: Any) -> None:
|
||||
"""Lock the device."""
|
||||
await self._device.lock(set_status=True)
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_unlock(self, **kwargs):
|
||||
async def async_unlock(self, **kwargs: Any) -> None:
|
||||
"""Unlock the device."""
|
||||
await self._device.unlock(set_status=True)
|
||||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def is_locked(self):
|
||||
def is_locked(self) -> bool:
|
||||
"""Return true if lock is locked."""
|
||||
return self._device.status.lock == ST_STATE_LOCKED
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue