diff --git a/homeassistant/components/homeassistant/services.yaml b/homeassistant/components/homeassistant/services.yaml new file mode 100644 index 00000000000..2219564abb8 --- /dev/null +++ b/homeassistant/components/homeassistant/services.yaml @@ -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 diff --git a/homeassistant/components/services.yaml b/homeassistant/components/services.yaml deleted file mode 100644 index 40c76376531..00000000000 --- a/homeassistant/components/services.yaml +++ /dev/null @@ -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 diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index 43b8318abc5..f8af3bdb1c5 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -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] = {