Parameter type annotations for Call service
automation UI? (fancy parameter selection)
#329
Answered
by
HealsCodes
HealsCodes
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
HealsCodes
Mar 1, 2022
Replies: 2 comments 2 replies
-
Answering myself here in case anyone else comas across this! pyscript supports passing a yaml description for a service as part of the functions docstring. So this would do what I want: @service
def light_rgb_turn_on(entity_id, transition=0):
"""yaml
description: turn a HUE rgb light on with automatic parameter setting
fields:
entity_id:
description: name of the entity
example: light.bedroom
required: true
selector:
entity:
transition:
description: duration in seconds to transition to the new state
required: false
selector:
number:
min: 0
max: 60
step: 1
mode: slider
"""
# rest of the functions body here |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
HealsCodes
-
@HealsCodes Thanks for this Q and A. I was about to ask the same question because I couldn’t find it. is this documented some where? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answering myself here in case anyone else comas across this!
pyscript supports passing a yaml description for a service as part of the functions docstring.
Parameter descriptions follow the same format described here for normal configuration variables in yaml scripts.
So this would do what I want: