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>
pull/64411/head
epenet 2022-01-19 07:44:03 +01:00 committed by GitHub
parent fd465df016
commit 4f5859c612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 23 deletions

View File

@ -4,7 +4,6 @@ import logging
from arcam.fmj import SourceCodes
from arcam.fmj.state import State
from homeassistant import config_entries
from homeassistant.components.media_player import BrowseMedia, MediaPlayerEntity
from homeassistant.components.media_player.const import (
MEDIA_CLASS_DIRECTORY,
@ -21,9 +20,11 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_STEP,
)
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.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .config_flow import get_entry_client
from .const import (
@ -39,9 +40,9 @@ _LOGGER = logging.getLogger(__name__)
async def async_setup_entry(
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities,
):
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the configuration entry."""
client = get_entry_client(hass, config_entry)
@ -58,8 +59,6 @@ async def async_setup_entry(
True,
)
return True
class ArcamFmj(MediaPlayerEntity):
"""Representation of a media device."""

View File

@ -17,7 +17,6 @@ from denonavr.exceptions import (
)
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL,
@ -35,10 +34,12 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_COMMAND, CONF_HOST, STATE_PAUSED, STATE_PLAYING
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import CONF_RECEIVER
from .config_flow import (
@ -85,9 +86,9 @@ SERVICE_UPDATE_AUDYSSEY = "update_audyssey"
async def async_setup_entry(
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities: entity_platform.EntityPlatform.async_add_entities,
):
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the DenonAVR receiver from a config entry."""
entities = []
data = hass.data[DOMAIN][config_entry.entry_id]
@ -141,7 +142,7 @@ class DenonDevice(MediaPlayerEntity):
self,
receiver: DenonAVR,
unique_id: str,
config_entry: config_entries.ConfigEntry,
config_entry: ConfigEntry,
update_audyssey: bool,
) -> None:
"""Initialize the device."""

View File

@ -4,7 +4,6 @@ from __future__ import annotations
from haphilipsjs import PhilipsTV
from haphilipsjs.typing import AmbilightCurrentConfiguration
from homeassistant import config_entries
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
@ -16,8 +15,10 @@ from homeassistant.components.light import (
SUPPORT_EFFECT,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
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(
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities,
):
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the configuration entry."""
coordinator = hass.data[DOMAIN][config_entry.entry_id]
async_add_entities([PhilipsTVLightEntity(coordinator)])

View File

@ -3,7 +3,6 @@ from __future__ import annotations
from haphilipsjs import ConnectionFailure
from homeassistant import config_entries
from homeassistant.components.media_player import (
BrowseMedia,
MediaPlayerDeviceClass,
@ -32,9 +31,11 @@ from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_STEP,
)
from homeassistant.components.media_player.errors import BrowseError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import LOGGER as _LOGGER, PhilipsTVDataUpdateCoordinator
@ -64,9 +65,9 @@ def _inverted(data):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities,
):
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the configuration entry."""
coordinator = hass.data[DOMAIN][config_entry.entry_id]
async_add_entities(

View File

@ -3,8 +3,8 @@ from __future__ import annotations
from typing import Any
from homeassistant import config_entries
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -16,9 +16,9 @@ from .const import DOMAIN
async def async_setup_entry(
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
):
) -> None:
"""Set up the configuration entry."""
coordinator: PhilipsTVDataUpdateCoordinator = hass.data[DOMAIN][
config_entry.entry_id

View File

@ -37,7 +37,7 @@ async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: entity_platform.AddEntitiesCallback,
):
) -> None:
"""Set up the Zigbee Home Automation Door Lock from config entry."""
entities_to_create = hass.data[DATA_ZHA][Platform.LOCK]