Add basic type hints to acmeda (#62736)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
6f93ffb7ee
commit
eb7911f951
3 changed files with 33 additions and 9 deletions
|
@ -1,4 +1,6 @@
|
||||||
"""Support for Acmeda Roller Blinds."""
|
"""Support for Acmeda Roller Blinds."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
|
@ -11,19 +13,25 @@ from homeassistant.components.cover import (
|
||||||
SUPPORT_STOP_TILT,
|
SUPPORT_STOP_TILT,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .base import AcmedaBase
|
from .base import AcmedaBase
|
||||||
from .const import ACMEDA_HUB_UPDATE, DOMAIN
|
from .const import ACMEDA_HUB_UPDATE, DOMAIN
|
||||||
from .helpers import async_add_acmeda_entities
|
from .helpers import async_add_acmeda_entities
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
) -> None:
|
||||||
"""Set up the Acmeda Rollers from a config entry."""
|
"""Set up the Acmeda Rollers from a config entry."""
|
||||||
hub = hass.data[DOMAIN][config_entry.entry_id]
|
hub = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
|
||||||
current = set()
|
current: set[int] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_acmeda_covers():
|
def async_add_acmeda_covers():
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
"""Helper functions for Acmeda Pulse."""
|
"""Helper functions for Acmeda Pulse."""
|
||||||
from homeassistant.core import callback
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.device_registry import async_get_registry as get_dev_reg
|
from homeassistant.helpers.device_registry import async_get_registry as get_dev_reg
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DOMAIN, LOGGER
|
from .const import DOMAIN, LOGGER
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_acmeda_entities(
|
def async_add_acmeda_entities(
|
||||||
hass, entity_class, config_entry, current, async_add_entities
|
hass: HomeAssistant,
|
||||||
|
entity_class: type,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
current: set[int],
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
):
|
):
|
||||||
"""Add any new entities."""
|
"""Add any new entities."""
|
||||||
hub = hass.data[DOMAIN][config_entry.entry_id]
|
hub = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
@ -26,7 +34,7 @@ def async_add_acmeda_entities(
|
||||||
async_add_entities(new_items)
|
async_add_entities(new_items)
|
||||||
|
|
||||||
|
|
||||||
async def update_devices(hass, config_entry, api):
|
async def update_devices(hass: HomeAssistant, config_entry: ConfigEntry, api):
|
||||||
"""Tell hass that device info has been updated."""
|
"""Tell hass that device info has been updated."""
|
||||||
dev_registry = await get_dev_reg(hass)
|
dev_registry = await get_dev_reg(hass)
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,27 @@
|
||||||
"""Support for Acmeda Roller Blind Batteries."""
|
"""Support for Acmeda Roller Blind Batteries."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE
|
from homeassistant.const import PERCENTAGE
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .base import AcmedaBase
|
from .base import AcmedaBase
|
||||||
from .const import ACMEDA_HUB_UPDATE, DOMAIN
|
from .const import ACMEDA_HUB_UPDATE, DOMAIN
|
||||||
from .helpers import async_add_acmeda_entities
|
from .helpers import async_add_acmeda_entities
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
|
) -> None:
|
||||||
"""Set up the Acmeda Rollers from a config entry."""
|
"""Set up the Acmeda Rollers from a config entry."""
|
||||||
hub = hass.data[DOMAIN][config_entry.entry_id]
|
hub = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
|
|
||||||
current = set()
|
current: set[int] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_acmeda_sensors():
|
def async_add_acmeda_sensors():
|
||||||
|
|
Loading…
Add table
Reference in a new issue