mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
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:
parent
8e975395be
commit
95a7077b41
39
homeassistant/components/homeassistant/services.yaml
Normal file
39
homeassistant/components/homeassistant/services.yaml
Normal 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
|
@ -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
|
|
@ -163,11 +163,7 @@ async def async_get_all_descriptions(hass):
|
|||||||
|
|
||||||
def domain_yaml_file(domain):
|
def domain_yaml_file(domain):
|
||||||
"""Return the services.yaml location for a domain."""
|
"""Return the services.yaml location for a domain."""
|
||||||
if domain == ha.DOMAIN:
|
component_path = path.dirname(get_component(hass, domain).__file__)
|
||||||
from homeassistant import components
|
|
||||||
component_path = path.dirname(components.__file__)
|
|
||||||
else:
|
|
||||||
component_path = path.dirname(get_component(hass, domain).__file__)
|
|
||||||
return path.join(component_path, 'services.yaml')
|
return path.join(component_path, 'services.yaml')
|
||||||
|
|
||||||
def load_services_files(yaml_files):
|
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)
|
loaded = await hass.async_add_job(load_services_files, missing)
|
||||||
|
|
||||||
# Build response
|
# Build response
|
||||||
catch_all_yaml_file = domain_yaml_file(ha.DOMAIN)
|
|
||||||
descriptions = {}
|
descriptions = {}
|
||||||
for domain in services:
|
for domain in services:
|
||||||
descriptions[domain] = {}
|
descriptions[domain] = {}
|
||||||
@ -207,10 +202,7 @@ async def async_get_all_descriptions(hass):
|
|||||||
|
|
||||||
# Cache missing descriptions
|
# Cache missing descriptions
|
||||||
if description is None:
|
if description is None:
|
||||||
if yaml_file == catch_all_yaml_file:
|
yaml_services = loaded[yaml_file]
|
||||||
yaml_services = loaded[yaml_file].get(domain, {})
|
|
||||||
else:
|
|
||||||
yaml_services = loaded[yaml_file]
|
|
||||||
yaml_description = yaml_services.get(service, {})
|
yaml_description = yaml_services.get(service, {})
|
||||||
|
|
||||||
description = description_cache[cache_key] = {
|
description = description_cache[cache_key] = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user