I downloaded this addon called Sox_Play that allows you to trigger a local audio file to play through USB speakers connected to the Home Assistant mini PC.
What I don’t understand is where do I put this code below that is used to call the audio file.
You could name it anything you wanted. It would be saved in the same scripts.yaml file in /config that all scripts are saved to.
What’s happening here is that you are using a service that already exists in HA (hassio.addon_stdin) to communicate with the add on. So where ever you call this service (a script, an automation, from a dashboard) doesn’t really have anything directly to do with the add on.
If you wanted to make the sound play in an automation in response to some trigger, then you wouldn’t necessarily have to put it in a script first. But you could if wanted to play the same sound in a lot of different automations, for instance.
Ah got it so I can name it Alert.yaml for example and in the automations when it asks what I want to do in response to a window being opened I can tell it to call the Alert.yaml script that I saved to the scripts folder.
Do I need to include anything else besides the four lines of code used in the example from the addon page ?
Not quite. Go to the scripts page in the UI and choose to create a new script (from scratch). Then click the add action button. From the popup, choose “Call a service”. In the service name field type hassio.addon_stdin and then choose your addon from the drop down that appears. There won’t be a field for input, so you have to add that yourself. From the three dots menu on the right, choose “Edit in YAML”. You’ll see something like this, but with different text in the add on field: