1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add strict typing to abode (#57673)

This commit is contained in:
Robert Hillis
2022-01-10 09:54:09 -05:00
committed by GitHub
parent bc2f4e82e3
commit 7c51d2f159
25 changed files with 304 additions and 221 deletions

View File

@@ -1,4 +1,7 @@
"""Support for the Abode Security System locks."""
from typing import Any
from abodepy.devices.lock import AbodeLock as AbodeLK
import abodepy.helpers.constants as CONST
from homeassistant.components.lock import LockEntity
@@ -6,17 +9,15 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import AbodeDevice
from . import AbodeDevice, AbodeSystem
from .const import DOMAIN
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up Abode lock devices."""
data = hass.data[DOMAIN]
data: AbodeSystem = hass.data[DOMAIN]
entities = []
@@ -29,15 +30,17 @@ async def async_setup_entry(
class AbodeLock(AbodeDevice, LockEntity):
"""Representation of an Abode lock."""
def lock(self, **kwargs):
_device: AbodeLK
def lock(self, **kwargs: Any) -> None:
"""Lock the device."""
self._device.lock()
def unlock(self, **kwargs):
def unlock(self, **kwargs: Any) -> None:
"""Unlock the device."""
self._device.unlock()
@property
def is_locked(self):
def is_locked(self) -> bool:
"""Return true if device is on."""
return self._device.is_locked
return bool(self._device.is_locked)