Add lock typing in components (#73539)

* Add lock typing in components

* Revert freedompro amends
This commit is contained in:
epenet 2022-06-15 15:23:36 +02:00 committed by GitHub
parent 8c0ae545c9
commit f8f1bfde21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 78 additions and 54 deletions

View file

@ -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