Announce endpoint zone specific

Hey guys, I dove into the announce API once again playing with my HASS automations. I am testing the announce endpoint and I can’t seem to get a reliable way to play each individual zone.

Is it expected that I should be able to specify the zone and have it play only on that one zone?

{
  "media": "localFile.mp3",
  "zones" : [3]
}

If I do zones:[4] for some reason it works fine in that one zone, but if I do any other zones:[0], zones:[1], zones:[2], zones:[3] I find that it is defaulting to playing in more than one location.

This smells like a bug we had early in 0.3.x releases. What version of amplipi are you running?

I have been holding back from the 0.3.x releases and am still on the last 0.2 release. Would you advise moving over to 0.3.x at this point?

Yeah totally. At this point our 0.3.4 release is fairly robust. It also includes a wholly new UI that should be a fair amount more intuitive to use.

Also I looked back apparently that bug I was talking about was introduced in 0.2.0 by Cleanup and small changes by linknum23 · Pull Request #445 · micro-nova/AmpliPi · GitHub . It was fixed in 0.3.0 with: b7cb4dd23c964848977faac2b5805588e81b9efe

Okay great thanks. Will perhaps try upgrading tonight. I saw some worry and issues after upgrading on this forum and decided to hold back for a couple point releases.

I have some automation / scripts / home assistant TTS stuff that I think you guys would enjoy seeing in the near future.

2 Likes

So I went ahead and upgraded to 0.3.4 this afternoon.

Went and tried the announce endpoint once again and am getting strange results.

If I do:

{
  "media": "/home/pi/Music/attention.mp3",
  "vol_f": "0.2",
  "zones": [4]
}

And am sitting in the Kitchen (Zone 4) the volume is modified and zone only plays in Zone 4 (as intended).

However, if I choose something like:

{
  "media": "/home/pi/Music/attention.mp3",
  "vol_f": "0.2",
  "zones": [0] or [1] or [2]
}

The mp3 still plays in the Kitchen (Zone 4) every-time but at an unmodified volume level. It ALSO plays in the intended zone it’s just always playing on Zone 4 too.

I’m so sorry you are still having problems with this.

Can you try adding the source_id field to the request? Changing that could rule out anything weird going on with the zone muxing. The source_id in an announcement defaults to 3 but 0, 1, or 2 work as well.

{
  "media": "/home/pi/Music/attention.mp3",
  "vol_f": "0.2",
  "zones": [0],
  "source_id": 1
}

Does that change anything?

I would totally love to see some of the stuff you built!

2 Likes

No worries. Yeah I just tried the following:

{
  "media": "/home/pi/Music/attention.mp3",
  "vol_f": "0.6",
  "zones": [0] or [1] or [2] or [3] or [4],
  "source_id": 1
}

and it worked individually when I specified the source_id. No zone 4 playback during the other zones with an unmodified volume.

Is there a drawback to having to specify the source_id here like this for now?

Also, I did notice that when I make an announcement with a source_id that has a “Radio station” paused/stopped (e.g. Groove Salad). When the announcement is done it seems to play the radio station if it’s paused/stopped.

Is there a drawback to having to specify the source_id here like this for now?

The only drawback is that it will temporarily take over whatever source you specify.

When the announcement is done it seems to play the radio station if it’s paused/stopped.

That’s a bug in the internet radio interaction with announcements. I made an issue for it here: Bug: Stopped internet radio station, starts playing after announcement · Issue #683 · micro-nova/AmpliPi · GitHub

1 Like

Hey sorry to bring this back. Am having trouble again with this endpoint. Not sure why it was fine the other day. I changed two inputs around (not zones) and renamed two things but it seems like something is up here once again.

Will post my findings below, just walked around the house a bunch testing all these situations. Not sure what to do here since the source_id isn’t working like it had that other time.

Zone 0 - Family Room
Zone 1 - Ryan’s Office
Zone 2 - Master Bedroom
Zone 3 - Rear Porch
Zone 4 - Kitchen

Input 1 - RCA 1 (Zone 0)
Input 2 - RCA 2 (Zone 3 and Zone 4)
Input 3 - Airplay Source (Zone 2)
Input 4 - Spotify Source (Zone 1)

Testing without the source ID set:

{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [0]
}

Result -> Plays on Zone 0 and Zone 2
{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [1]
}

Result -> Plays on Zone 1

{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [2]
}

Result -> Plays on Zone 2 and Zone 1
{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [3]
}

Result -> Plays on Zone 3 (And overrides mute) and Zone 1
{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [4]
}

Result -> Plays on Zone 4 and Zone 1

Testing with the source ID set:

{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [0],
  "source_id": 1
}

Result -> Plays on Zone 4 (Unmodified loud volume)

{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [1],
  "source_id": 1
}

Result -> Plays on Zone 4 (Unmodified loud volume) and Zone 1
{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [2],
  "source_id": 1
}

Result -> Plays on Zone 4 (Unmodified loud volume) and Zone 2
{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [3],
  "source_id": 1
}

Result -> Plays on Zone 4 (Unmodified loud volume) and Zone 3 (And overrides mute)
{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [4],
  "source_id": 1
}

Result -> Plays on Zone 4 (No unmodified loud volume, expected volume)

Okay, I just rebooted in the Configuration → HW Reboot and tried the following again:

{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [0] or [1] or [2] or [3] or [4],
  "source_id": 1
}

And it all works fine at first, because every source is muted.

Once I unmute all the sources, it once again reverts to the previous issues I have with source_id. I will also note, in the main homepage it shows during the announcement:

  • It mutes the first source in the list
  • Second source shows “First Floor” which is a custom group
  • Does nothing to the third and fourth source

Then reverts back to all the settings I had prior to the announcement.

For now I reverted back to using but still have the extra zones called:

{
  "media": "/home/pi/Music/dryer-done.mp3",
  "vol_f": "0.5",
  "zones": [0] or [1] or [2] or [3] or [4]
}

I replicated your setup and was able to completely reproduce your issues here except for this report:

{
 "media": "/home/pi/Music/dryer-done.mp3",
 "vol_f": "0.5",
 "zones": [0]
}

Result -> Plays on Zone 0 and Zone 2

I’m assuming that you meant Result -> Plays on Zone 0 and Zone 1.

Thanks to your careful reporting I was able to find a bug that has existed in announcements from when they were introduced 3+ years ago.

See: Bug: Zones playing audio on source used for annoncement are not muted while the announcement is playing · Issue #699 · micro-nova/AmpliPi · GitHub

Thanks Lincoln! Appreciate you replicating and investigating. I was hoping this thorough report would be helpful in tracking it down. This would be great to get it all sorted!

Let me double check on that one section you were asking about and get back here. I could have messed up writing it down. Just read your bug report over on GitHub, looking forward to the fix.

I’m assuming that you meant Result -> Plays on Zone 0 and Zone 1 .

This is correct, I just had the chance to try this out again. My mistake.

Just saw the PR got merged for the next release. Looking forward to trying it out again, thanks for the quick turnaround!

1 Like

Hey @linknum23 I was just curious when you think this change would be pushed for release? I know you prob got a lot of other things going on but didn’t know when you think you’d be doing the next 0.3.X release.

Very soon! Either today or very early next week. We have a lot of improvements to push out :slight_smile:

1 Like

Our latest release just got pushed out: Release 0.3.6 · micro-nova/AmpliPi · GitHub

Check it out when you get a chance! It should fix your announcement issues.

1 Like

Excellent! Will upgrade soon and report back! Thanks Lincoln

Just reporting back to say I ran through my same test I listed out a few posts ago and everything seems to be working as expected. No need for source_id either :+1: