I’m new so maybe I’m doing this totally wrong but I created an automation using the regular front end. It takes a button push from an Insteon Keypad and plays a favorite on my Sonos speakers. It worked great except that I prefer the tracks to be in random order. So I figured out how to display the Media command in YAML, looked up the code for shuffle play, and inserted it. Bam! It worked! This was really cool.
Then, a couple days later, I noticed it wasn’t shuffling tracks any more. I checked the automation and the YAML updates I made had disappeared. I added them back. Once again, things worked for a couple of days and then the changes disappeared again.
Really strange that it worked for a little while… Anyways, I tried editing the whole automation in YAML (not just the media player part) and then it errored off. I was able to look up the error and find my mistake. I also found I could use the Visual Editor to add shuffle and repeat using the Call a Service → Media Player. Cool!!