1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Custom component loading cleanup (#14211)

* Clean up custom component loading

* Fix some tests

* Fix some stuff

* Make imports work again

* Fix tests

* Remove debug print

* Lint
This commit is contained in:
Paulus Schoutsen
2018-05-01 14:57:30 -04:00
committed by Pascal Vizeli
parent 5d96751168
commit 83d300fd11
50 changed files with 315 additions and 392 deletions

View File

@@ -92,7 +92,7 @@ def extract_entity_ids(hass, service_call, expand_group=True):
if not (service_call.data and ATTR_ENTITY_ID in service_call.data):
return []
group = get_component('group')
group = hass.components.group
# Entity ID attr can be a list or a string
service_ent_id = service_call.data[ATTR_ENTITY_ID]
@@ -100,10 +100,10 @@ def extract_entity_ids(hass, service_call, expand_group=True):
if expand_group:
if isinstance(service_ent_id, str):
return group.expand_entity_ids(hass, [service_ent_id])
return group.expand_entity_ids([service_ent_id])
return [ent_id for ent_id in
group.expand_entity_ids(hass, service_ent_id)]
group.expand_entity_ids(service_ent_id)]
else:
@@ -128,7 +128,7 @@ async def async_get_all_descriptions(hass):
import homeassistant.components as components
component_path = path.dirname(components.__file__)
else:
component_path = path.dirname(get_component(domain).__file__)
component_path = path.dirname(get_component(hass, domain).__file__)
return path.join(component_path, 'services.yaml')
def load_services_files(yaml_files):