UI+YAML: Universal comment/description for actions, triggers, etc

Editing in YAML has a big advantage of being able to put comments within the code → to explain what a specific part of code does, or WHY is it that way.

It’s currently not possible in any way within UI. What’s even worse, if I add my comments in YAML and edit the automation/script via UI → the comments get deleted!

Feature Request 1: add a possibility to “comment” anything in automations, scripts, service calls, etc. I propose description field added “universally” for everything feasible.

Example:

- id: '123'
  alias: Some automation
  description: 'The description of the whole automation - currently possible to do, nice :)'
  trigger:
  - platform: device
    domain: mqtt
    device_id: 12345
    type: action
    subtype: 1_single
    description: 'Some explanation for the trigger - FR!'
  condition: []
  action:
  - if:
    - condition: state
      entity_id: input_select.home_state
      state: Bedtime
      description: 'Some explanation for the condition - FR!'
    then:
    - service: input_select.select_option
      description: 'Some explanation for the service call - FR!'
      metadata: {}
      data:
        description: 'Why not even more nested "comments"? – FR!'
        option: Daytime
      target:
        entity_id: input_select.home_state
  mode: single

This would allow for the “comments” (“descriptions”) not to be removed by the UI → BUT ALSO: they could/should be handled by the UI.

Feature Request 2: show and allow to add/edit/remove those description fields within the UI.


Side note: if description is too generic, could be name-clashing, let’s make it more special like _description, or just _desc to be shorter, or _comment, or $comment, or some any other way. The point being: special key as a replacement for YAML comments, that would also be handled by the UI.


Side note 2: it would also be great for Lovelace dashboards!

Why are using a device trigger in your example? :rofl: (I kid).

I agree with this. I currently rename actions much longer than I want to so that I can better describe what the section is doing.

I explained that in a YAML comment which got deleted by the UI editor :face_with_monocle:

1 Like

Please search before posting. Vote on existing FRs if you find one.

Do not request more than one feature per post. Multiple FRs in one post are difficult to manage.

And…

This is not technically possible.

UI automations and scripts are saved as json data and json does not support comments.

A workaround of including a comment key (comment: blah blah ) for each section was discussed but rejected last time this was suggested. You do have the description: and alias: keys available. Also this {# #} for templates.

Closing as a duplicate of:

Please vote and comment there.