Improve entity type hints [b] (#77012)
This commit is contained in:
parent
dd109839b9
commit
dedf063e43
21 changed files with 73 additions and 59 deletions
|
@ -2,9 +2,11 @@
|
|||
import asyncio
|
||||
from base64 import b64encode
|
||||
from collections import defaultdict
|
||||
from collections.abc import Iterable
|
||||
from datetime import timedelta
|
||||
from itertools import product
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from broadlink.exceptions import (
|
||||
AuthorizationError,
|
||||
|
@ -174,18 +176,18 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity):
|
|||
"""
|
||||
return self._flags
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Call when the remote is added to hass."""
|
||||
state = await self.async_get_last_state()
|
||||
self._attr_is_on = state is None or state.state != STATE_OFF
|
||||
await super().async_added_to_hass()
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on the remote."""
|
||||
self._attr_is_on = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off the remote."""
|
||||
self._attr_is_on = False
|
||||
self.async_write_ha_state()
|
||||
|
@ -198,7 +200,7 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity):
|
|||
self._flags.update(await self._flag_storage.async_load() or {})
|
||||
self._storage_loaded = True
|
||||
|
||||
async def async_send_command(self, command, **kwargs):
|
||||
async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None:
|
||||
"""Send a list of commands to a device."""
|
||||
kwargs[ATTR_COMMAND] = command
|
||||
kwargs = SERVICE_SEND_SCHEMA(kwargs)
|
||||
|
@ -255,7 +257,7 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity):
|
|||
if at_least_one_sent:
|
||||
self._flag_storage.async_delay_save(self._get_flags, FLAG_SAVE_DELAY)
|
||||
|
||||
async def async_learn_command(self, **kwargs):
|
||||
async def async_learn_command(self, **kwargs: Any) -> None:
|
||||
"""Learn a list of commands from a remote."""
|
||||
kwargs = SERVICE_LEARN_SCHEMA(kwargs)
|
||||
commands = kwargs[ATTR_COMMAND]
|
||||
|
@ -419,7 +421,7 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity):
|
|||
self.hass, notification_id="learn_command"
|
||||
)
|
||||
|
||||
async def async_delete_command(self, **kwargs):
|
||||
async def async_delete_command(self, **kwargs: Any) -> None:
|
||||
"""Delete a list of commands from a remote."""
|
||||
kwargs = SERVICE_DELETE_SCHEMA(kwargs)
|
||||
commands = kwargs[ATTR_COMMAND]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue