mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-18 23:06:31 +00:00
Update service documentation to add target and selector info (#819)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
93d46225e5
commit
95249a105a
@ -59,20 +59,39 @@ Services are published under the domain name of your integration, so in `service
|
||||
```yaml
|
||||
# Example services.yaml entry
|
||||
|
||||
# Service ID
|
||||
set_speed:
|
||||
# Service name as shown in UI
|
||||
name: Set speed
|
||||
# Description of the service
|
||||
description: Sets fan speed.
|
||||
# If the service accepts entity IDs, target allows the user to specify entities by entity, device, or area. If `target` is specified, `entity_id` should not be defined in the `fields` map. By default it shows only targets matching entities from the same domain as the service, but if further customization is required, target supports the entity, device, and area selectors (https://www.home-assistant.io/docs/blueprint/selectors/). Entity selector parameters will automatically be applied to device and area, and device selector parameters will automatically be applied to area.
|
||||
target:
|
||||
# Different fields that your service accepts
|
||||
fields:
|
||||
# Key of the field
|
||||
entity_id:
|
||||
# Description of the field
|
||||
description: Name(s) of the entities to set
|
||||
# Example value that can be passed for this field
|
||||
example: "fan.living_room"
|
||||
speed:
|
||||
# Field name as shown in UI
|
||||
name: Speed
|
||||
# Description of the field
|
||||
description: Speed setting
|
||||
# Whether or not field is required
|
||||
required: true
|
||||
# Advanced options are only shown when the advanced mode is enabled for the user
|
||||
advanced: true
|
||||
# Example value that can be passed for this field
|
||||
example: "low"
|
||||
# The default value
|
||||
default: "high"
|
||||
# Selector (https://www.home-assistant.io/docs/blueprint/selectors/) to control the input UI for this field
|
||||
selector:
|
||||
select:
|
||||
options:
|
||||
- "off"
|
||||
- "low"
|
||||
- "medium"
|
||||
- "high"
|
||||
|
||||
```
|
||||
|
||||
## Entity Services
|
||||
|
Loading…
x
Reference in New Issue
Block a user