WTH Automations - UI one-click copy yaml/one click paste yaml

Whenever I’m creating a new automation sequence in the UI, I often find myself copying and pasting bits of yaml within the sequence. This is particularly prevalent when using the Choose action, where certain conditions are common across some, but not all options (you can’t duplicate a Choose option either, but that’s another issue entirely).

The process for such actions is, at present, a long and clicky one, as demonstrated below.

Click 1: Expand an action
Click 2: Click 3 dot menu
Click 3: Click “Edit in YAML”
Click 4a: Ctrl-A, Ctrl-C or right-click over the YAML text and select “Select All”
Click 4b: Right click and select “Copy”
Click 6a: Click “Add Option” if not already added
Click 6b: Click “Add Action” in the desired Option
Click 8: Select any Action from the list of Actions
Click 9: Expand the newly created action
Click 10: Click the Action’s 3 dot menu
Click 11: Click “Edit in YAML”
Click 12: Ctrl-A or right-click over the YAML text and click “Select All”
Click 13: Ctrl-V or right-click over the highlighted YAML text and select “Paste”

Phew! That’s a process far more lengthy than it really ought to be. Perhaps two extra 3 dot menu items could be added to speed up the process?

Copy All from YAML
Paste to replace YAML

Extra bonus points if the resultant new Action would expand to the newly pasted YAML automatically, making it easy to make swift changes to the newly created action’s variables.

Extra EXTRA bonus points for adding a “Paste YAML” option to the Add Action menu. If nothing to paste, or the YAML is invalid, an error message could then be generated

Extra EXTRA EXTRA!!! bonus points for adding Copy Option and Paste To New Option to the Options branch

Much joy would then be expressed across the entire HA community! Volunteer Programmers be praised!

Yes it would be a little bit simpler, but going into the automations .yaml isn’t hard as well. Just copy paste and change the id. Go to cps test Configuration → Automations and edit an existing automation in the editor · Click the 3 dots menu in top right, select “Edit as YAML” … Task 1: Creating Azure resources … Under Resource group, click Create new. Enter a Name of “partsunlimited” and click OK. In Database details … In other words, bringing the Copy & Paste capabilities to Power Automate flows! … need to select My clipboard tab and select one of the existing snippets.

Hi Matthew,

Do you intend to copy from the same automation or from another? I am asking because the way I do it is that I use duplicate. So, i find the piece i need to copy/paste and in the 3 dots i choose duplicate and then move it to the correct position. Is this solving your problem?

Thanks
Kind Regards
M

Hi Nora,

I already know the available workarounds because I use them almost every time I’m plotting a new automation course, What I’m asking for is an easier way to copy and paste blocks of YAML from different contexts that doesn’t involve multiple menu clicks, endless Ctrl+A Ctrl+C Ctrl +V keyboard shortcuts, scrolling up and down long lists of actions (and often losing my place) or (in extreme cases) deleting spaces from hundreds of lines of YAML.

What for?

I’m quite certain I have no idea what you’re talking about

  • Copy - Paste within the same automation.
  • Copy action is occurring within a single action (including single actions within Choose and If/Then actions), paste action is occurring within a Choose or If/Then actiion. The duplicate option depends on context. If it’s a stand alone action, you’ll get a stand alone duplicate. If it’s within an If/Then action, then the duplicate will appear within the section (If, Then, Else) the original was created in. The duplicate option is not available in the Choose action.
3 Likes

Might I just take a moment to congratulate all who worked on this massively time-saving new feature in our beloved Home Assistant project? Editing unruly automations is now such a breeze as is the construction of complex, new ones. Still waiting for duplicating choose options but really, the work done so far has been more than satisfactory.

I am proud to have contributed in my small way to making Home Assistant even more accessible and fun to use for everyone. Bravo to all and sundry! Matt out

What am I doing wrong if I still are not able to paste in the file editor using a mobile chrome browser on Android?
I’m quite new to HA (used to Domoticz) and normally I’m quite good in learning new tech things but until now the learning curve is next level high when things like copy paste needs to be googled or asked how to do it.