What are you trying to do? Do you want to take some action when the state of the soundbar changes or do you want to use an automation to change the soundbar based on some other event?
Depending on how you want to set the source, say you want a button on your lovelace gui then you could just set the action as part of the button setup and not have to write an automation.
Media players have multiple services you can call to change things. All the services are listed here.