I have some automations set up to play audio in the announcement channel on triggers. The issue I’m seeing is that every time the automation runs it creates a new stream instead of just using a single announcement channel. That means I end up getting like 1500 new media devices in home assistant and in AmpliPi I get that may streams as well. Is there a better way to handle this or fix it?
and is there a good way to mass delete all of these streams outside of doing it one by one manually? Perhaps through terminal?
After playing with it some more tonight, it looks like my rest command in HA is using post which causes it to create a new “announcement” stream every single time. I have a script that can go through and manually delete all new ones from time to time but would love a better way to handle this.
I’m not sure if I can use patch, but the issue with patch would be the inability to set custom volume control and then specific zones I want to target with different automations…post works to create it right away, but keeps adding new announcements…would showing my automations and rest commands help others understand what I’m saying?
Hey Matchmee!
I’d like to see your flows, as I can’t replicate this behavior (the temp stream being seen and codified as an entity by hacs_amplipi) on my end with our recent AmpliPi 0.4.7 and hacs_amplipi 0.2.1 updates. I’ve made a PR that might fix this or at least negate your need for custom scripts, though that could take up to a week to actually make it into a release that would allow us to verify that on your end.
though that could take up to a week to actually make it into a release that would allow us to verify that on your end
This is now in release version 0.2.2 of our home assistant plugin, out now. Let me know if that solves your troubles!
It looks like sometimes it did, but usually didn’t. I am now completely updated as well. I will try to show how I built it all to work. Again, I think it’s because I’m using POST instead of PATCH. I may try moving over to PATCH so I do not need to keep deleting streams once a week for every single door open/close command.
alias: Front Door Close Announcement
sequence:
- condition: state
entity_id: input_boolean.front_door_announce_cooldown
state: "off"
- data:
file_name: DoorClose.wav
volume: 0.43
zones:
- 10
- 13
- 14
- 16
- 17
action: rest_command.amplipi_announce
- target:
entity_id: input_boolean.front_door_announce_cooldown
action: input_boolean.turn_on
data: {}
- delay: "00:00:15"
- target:
entity_id: input_boolean.front_door_announce_cooldown
action: input_boolean.turn_off
data: {}
rest_command:
amplipi_announce:
url: "http://xxx.xxx.x.xxx/api/announce"
method: post
payload: '{"media": "https://xxx.xxxxxx.xxxx/local/{{ file_name }}","vol_f": {{ volume }},"zones": {{ zones }}}'
headers:
content-type: 'application/json'