Add setup type hints to homeassistant (#63439)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/63522/head
parent
4c48705fe8
commit
ef309182fe
|
@ -34,7 +34,9 @@ from homeassistant.helpers import (
|
|||
config_validation as cv,
|
||||
entity_platform,
|
||||
)
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.loader import async_get_integration
|
||||
|
||||
|
||||
|
@ -162,7 +164,12 @@ def entities_in_scene(hass: HomeAssistant, entity_id: str) -> list[str]:
|
|||
return list(entity.scene_config.states)
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up Home Assistant scene entries."""
|
||||
_process_scenes_config(hass, async_add_entities, config)
|
||||
|
||||
|
@ -252,7 +259,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
scene_config = SceneConfig(None, call.data[CONF_SCENE_ID], None, entities)
|
||||
entity_id = f"{SCENE_DOMAIN}.{scene_config.name}"
|
||||
if (old := platform.entities.get(entity_id)) is not None:
|
||||
if not old.from_service:
|
||||
if not isinstance(old, HomeAssistantScene) or not old.from_service:
|
||||
_LOGGER.warning("The scene %s already exists", entity_id)
|
||||
return
|
||||
await platform.async_remove_entity(entity_id)
|
||||
|
|
Loading…
Reference in New Issue