Move core services.yaml file to Home Assistant integration (#22489)

* Move services.yaml to correct dir

* Remove special case for HA servicesgs
This commit is contained in:
Paulus Schoutsen 2019-03-29 20:48:45 -07:00 committed by GitHub
parent 8e975395be
commit 95a7077b41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 45 deletions

View File

@ -0,0 +1,39 @@
check_config:
description: Check the Home Assistant configuration files for errors. Errors will be displayed in the Home Assistant log.
reload_core_config:
description: Reload the core configuration.
restart:
description: Restart the Home Assistant service.
stop:
description: Stop the Home Assistant service.
toggle:
description: Generic service to toggle devices on/off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to toggle on/off.
example: light.living_room
turn_on:
description: Generic service to turn devices on under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to turn on.
example: light.living_room
turn_off:
description: Generic service to turn devices off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to turn off.
example: light.living_room
update_entity:
description: Force one or more entities to update its data
fields:
entity_id:
description: One or multiple entity_ids to update. Can be a list.
example: light.living_room

View File

@ -1,35 +0,0 @@
# Describes the format for available component services
homeassistant:
check_config:
description: Check the Home Assistant configuration files for errors. Errors will be displayed in the Home Assistant log.
reload_core_config:
description: Reload the core configuration.
restart:
description: Restart the Home Assistant service.
stop:
description: Stop the Home Assistant service.
toggle:
description: Generic service to toggle devices on/off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to toggle on/off.
example: light.living_room
turn_on:
description: Generic service to turn devices on under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to turn on.
example: light.living_room
turn_off:
description: Generic service to turn devices off under any domain. Same usage as the light.turn_on, switch.turn_on, etc. services.
fields:
entity_id:
description: The entity_id of the device to turn off.
example: light.living_room
update_entity:
description: Force one or more entities to update its data
fields:
entity_id:
description: One or multiple entity_ids to update. Can be a list.
example: light.living_room

View File

@ -163,11 +163,7 @@ async def async_get_all_descriptions(hass):
def domain_yaml_file(domain):
"""Return the services.yaml location for a domain."""
if domain == ha.DOMAIN:
from homeassistant import components
component_path = path.dirname(components.__file__)
else:
component_path = path.dirname(get_component(hass, domain).__file__)
component_path = path.dirname(get_component(hass, domain).__file__)
return path.join(component_path, 'services.yaml')
def load_services_files(yaml_files):
@ -195,7 +191,6 @@ async def async_get_all_descriptions(hass):
loaded = await hass.async_add_job(load_services_files, missing)
# Build response
catch_all_yaml_file = domain_yaml_file(ha.DOMAIN)
descriptions = {}
for domain in services:
descriptions[domain] = {}
@ -207,10 +202,7 @@ async def async_get_all_descriptions(hass):
# Cache missing descriptions
if description is None:
if yaml_file == catch_all_yaml_file:
yaml_services = loaded[yaml_file].get(domain, {})
else:
yaml_services = loaded[yaml_file]
yaml_services = loaded[yaml_file]
yaml_description = yaml_services.get(service, {})
description = description_cache[cache_key] = {