Helper UI -> generate YAML button

Kindly requesting a button in the UI → to generate YAML config upon a Helper defined in the UI.

Above is the Settings window for a Template Helper defined in the UI. When you click Template options, yet another window opens that allows to edit the state template:

My proposition:

  • Add a button in the Settings windows that would “generate” the YAML equivalent of the helper. In this particular case, it should generate:
    # https://www.home-assistant.io/integrations/template/
    template:
      # https://www.home-assistant.io/integrations/binary_sensor/
      - binary_sensor:
          - name: FP2 as motion detector
            unique_id: fp2_as_motion_detector
            device_class: motion
            state: "{{ states('binary_sensor.ps1_aqara_fp2_e267_presence_sensor_bathroom_general_presence') }}"
    
  • The comments to the docs in generated YAML could be skipped – although I personally find them useful :wink:
  • Instead of opening a window with code to copy → the button could just copy the YAML into memory (allowing pasting in the favorite editor).
  • Or maybe even the button (or an extra buton) could immediately (or after confirmation ;-)) just put the YAML into the config.

This should allow easier migration of the helpers defined in the UI into YAML config.

I think this would also be a great opportunity for people wanting to learn how to write YAML config entries – as one could immediately see what is the YAML equivalent of the helpers they configured using the convinient UI.

I find the UI helpers pretty useful to discover and learn available options → but after experimentation phase, I’d eventually want to store configuration in… a config file :slight_smile:

I would like to just have the option to switch between UI and YAML mode. Similar to this option for Automations, scripts and dashboards (the last ones are stored in JSON, but nicely allow to be edit in YAML)