Skip to content

Parameter type annotations for Call service automation UI? (fancy parameter selection) #329

Answered by HealsCodes
HealsCodes asked this question in Q&A
Discussion options

You must be logged in to vote

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:

@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

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by HealsCodes
Comment options

You must be logged in to vote
2 replies
@HealsCodes
Comment options

@rct
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants