mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add setup type hints (platforms) (#64354)
* Add setup type hints to arcam_fmj * Add setup type hints to denonavr * Add setup type hints to philips_js * Add setup type hints to zha Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
fd465df016
commit
4f5859c612
@ -4,7 +4,6 @@ import logging
|
|||||||
from arcam.fmj import SourceCodes
|
from arcam.fmj import SourceCodes
|
||||||
from arcam.fmj.state import State
|
from arcam.fmj.state import State
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components.media_player import BrowseMedia, MediaPlayerEntity
|
from homeassistant.components.media_player import BrowseMedia, MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_CLASS_DIRECTORY,
|
MEDIA_CLASS_DIRECTORY,
|
||||||
@ -21,9 +20,11 @@ from homeassistant.components.media_player.const import (
|
|||||||
SUPPORT_VOLUME_STEP,
|
SUPPORT_VOLUME_STEP,
|
||||||
)
|
)
|
||||||
from homeassistant.components.media_player.errors import BrowseError
|
from homeassistant.components.media_player.errors import BrowseError
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .config_flow import get_entry_client
|
from .config_flow import get_entry_client
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -39,9 +40,9 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities,
|
async_add_entities: AddEntitiesCallback,
|
||||||
):
|
) -> None:
|
||||||
"""Set up the configuration entry."""
|
"""Set up the configuration entry."""
|
||||||
|
|
||||||
client = get_entry_client(hass, config_entry)
|
client = get_entry_client(hass, config_entry)
|
||||||
@ -58,8 +59,6 @@ async def async_setup_entry(
|
|||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class ArcamFmj(MediaPlayerEntity):
|
class ArcamFmj(MediaPlayerEntity):
|
||||||
"""Representation of a media device."""
|
"""Representation of a media device."""
|
||||||
|
@ -17,7 +17,6 @@ from denonavr.exceptions import (
|
|||||||
)
|
)
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components.media_player import MediaPlayerEntity
|
from homeassistant.components.media_player import MediaPlayerEntity
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
@ -35,10 +34,12 @@ from homeassistant.components.media_player.const import (
|
|||||||
SUPPORT_VOLUME_SET,
|
SUPPORT_VOLUME_SET,
|
||||||
SUPPORT_VOLUME_STEP,
|
SUPPORT_VOLUME_STEP,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_COMMAND, CONF_HOST, STATE_PAUSED, STATE_PLAYING
|
from homeassistant.const import ATTR_COMMAND, CONF_HOST, STATE_PAUSED, STATE_PLAYING
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import CONF_RECEIVER
|
from . import CONF_RECEIVER
|
||||||
from .config_flow import (
|
from .config_flow import (
|
||||||
@ -85,9 +86,9 @@ SERVICE_UPDATE_AUDYSSEY = "update_audyssey"
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities: entity_platform.EntityPlatform.async_add_entities,
|
async_add_entities: AddEntitiesCallback,
|
||||||
):
|
) -> None:
|
||||||
"""Set up the DenonAVR receiver from a config entry."""
|
"""Set up the DenonAVR receiver from a config entry."""
|
||||||
entities = []
|
entities = []
|
||||||
data = hass.data[DOMAIN][config_entry.entry_id]
|
data = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
@ -141,7 +142,7 @@ class DenonDevice(MediaPlayerEntity):
|
|||||||
self,
|
self,
|
||||||
receiver: DenonAVR,
|
receiver: DenonAVR,
|
||||||
unique_id: str,
|
unique_id: str,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
update_audyssey: bool,
|
update_audyssey: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the device."""
|
"""Initialize the device."""
|
||||||
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||||||
from haphilipsjs import PhilipsTV
|
from haphilipsjs import PhilipsTV
|
||||||
from haphilipsjs.typing import AmbilightCurrentConfiguration
|
from haphilipsjs.typing import AmbilightCurrentConfiguration
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_EFFECT,
|
ATTR_EFFECT,
|
||||||
@ -16,8 +15,10 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_EFFECT,
|
SUPPORT_EFFECT,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
from homeassistant.util.color import color_hsv_to_RGB, color_RGB_to_hsv
|
from homeassistant.util.color import color_hsv_to_RGB, color_RGB_to_hsv
|
||||||
|
|
||||||
@ -33,9 +34,9 @@ EFFECT_EXPERT_STYLES = {"FOLLOW_AUDIO", "FOLLOW_COLOR", "Lounge light"}
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities,
|
async_add_entities: AddEntitiesCallback,
|
||||||
):
|
) -> None:
|
||||||
"""Set up the configuration entry."""
|
"""Set up the configuration entry."""
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
async_add_entities([PhilipsTVLightEntity(coordinator)])
|
async_add_entities([PhilipsTVLightEntity(coordinator)])
|
||||||
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from haphilipsjs import ConnectionFailure
|
from haphilipsjs import ConnectionFailure
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
BrowseMedia,
|
BrowseMedia,
|
||||||
MediaPlayerDeviceClass,
|
MediaPlayerDeviceClass,
|
||||||
@ -32,9 +31,11 @@ from homeassistant.components.media_player.const import (
|
|||||||
SUPPORT_VOLUME_STEP,
|
SUPPORT_VOLUME_STEP,
|
||||||
)
|
)
|
||||||
from homeassistant.components.media_player.errors import BrowseError
|
from homeassistant.components.media_player.errors import BrowseError
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import LOGGER as _LOGGER, PhilipsTVDataUpdateCoordinator
|
from . import LOGGER as _LOGGER, PhilipsTVDataUpdateCoordinator
|
||||||
@ -64,9 +65,9 @@ def _inverted(data):
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities,
|
async_add_entities: AddEntitiesCallback,
|
||||||
):
|
) -> None:
|
||||||
"""Set up the configuration entry."""
|
"""Set up the configuration entry."""
|
||||||
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
coordinator = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from homeassistant import config_entries
|
|
||||||
from homeassistant.components.switch import SwitchEntity
|
from homeassistant.components.switch import SwitchEntity
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -16,9 +16,9 @@ from .const import DOMAIN
|
|||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: config_entries.ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
):
|
) -> None:
|
||||||
"""Set up the configuration entry."""
|
"""Set up the configuration entry."""
|
||||||
coordinator: PhilipsTVDataUpdateCoordinator = hass.data[DOMAIN][
|
coordinator: PhilipsTVDataUpdateCoordinator = hass.data[DOMAIN][
|
||||||
config_entry.entry_id
|
config_entry.entry_id
|
||||||
|
@ -37,7 +37,7 @@ async def async_setup_entry(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities: entity_platform.AddEntitiesCallback,
|
async_add_entities: entity_platform.AddEntitiesCallback,
|
||||||
):
|
) -> None:
|
||||||
"""Set up the Zigbee Home Automation Door Lock from config entry."""
|
"""Set up the Zigbee Home Automation Door Lock from config entry."""
|
||||||
entities_to_create = hass.data[DATA_ZHA][Platform.LOCK]
|
entities_to_create = hass.data[DATA_ZHA][Platform.LOCK]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user