Make use of generic EntityComponent (#78492)

This commit is contained in:
epenet 2022-09-15 11:53:00 +02:00 committed by GitHub
parent 19ea95a6e4
commit b4afb1cb6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 45 deletions

View file

@ -86,7 +86,7 @@ def _scripts_with_x(
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
component: EntityComponent[ScriptEntity] = hass.data[DOMAIN]
return [
script_entity.entity_id
@ -100,7 +100,7 @@ def _x_in_script(hass: HomeAssistant, entity_id: str, property_name: str) -> lis
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
component: EntityComponent[ScriptEntity] = hass.data[DOMAIN]
if (script_entity := component.get_entity(entity_id)) is None:
return []
@ -150,7 +150,7 @@ def scripts_with_blueprint(hass: HomeAssistant, blueprint_path: str) -> list[str
if DOMAIN not in hass.data:
return []
component = hass.data[DOMAIN]
component: EntityComponent[ScriptEntity] = hass.data[DOMAIN]
return [
script_entity.entity_id