Strange Preset Behavior

Hey guys, I’m running into a weird preset issue that I’m not sure if I’m potentially misunderstanding is not possible.

I have a couple presets I’m trying to setup. However the issue seems more apparent when focusing on my main “Default” one.

My zones are as follows:

  • Family Room
  • Kitchen
  • Office
  • Master Bedroom
  • Living Room
  • Rear Porch

I go to set a “Default” preset to my liking using all four sources, with four zones, leaving two zones out and unselected anywhere. I go to Settings → Presets → Name my preset, select “Show inactive” and select “All” (have tried also without Show Inactive selected)

Suddenly I go to change my settings, then go to restore back to my “Default” preset". However, it seems to always place my “Office” zone in there somewhere without my selecting.

It seems like not having a zone selected for somewhere specific ends up causing a random placement for them. For now, I ended up putting them in random sources and muting them which works fine but obviously not the preferred method.

First off, sorry you are having trouble with this. As it stands presets are a decently advanced feature and our UI attempts to make them easy to use. What you are trying to do is not completely supported by the UI yet. (I’ll insert a GH feature request here in a bit).

The underlying issue here is the zones that aren’t covered by the preset are not being changed when the preset is activated. Those extra zones keep the source they have connected as well as their current volume/mute state. The reason for this is that presets are designed to be a partial configuration update and the extra zones are not being updated. From your perspective I could see how this behavior appears random.

The UI is effectively creating a preset that looks something like this:

{
  "name": "Default",
  "state": {
    "sources": [
      {
        "id": 0,
        "input": "stream=1005"
      },
      {
        "id": 1,
        "input": "stream=1006"
      },
      {
        "id": 2,
        "input": "stream=1007"
      },
      {
        "id": 3,
        "input": "stream=1008"
      },
    ],
    "zones": [
      {
        "id": 0,
        "source_id": 0,
        "vol_f": 0.5,
        "mute": false
      },
      {
        "id": 1,
        "source_id": 1,
        "vol_f": 0.5,
        "mute": false
      },
      {
        "id": 2,
        "source_id": 2,
        "vol_f": 0.5,
        "mute": false
      },
      {
        "id": 5,
        "source_id": 3,
        "vol_f": 0.5,
        "mute": false
      }
    ]
  }
}

In this example Zone ids 3 and 4 are missing from this preset. Those zones will not be configured when this preset is activated.

To fix that we need to add them to the preset and set their source_id's to -1. This will effectively disconnect zones 3 and 4 from any source (NOTE: at a hardware level they are just connected to source 0 and muted). Here is what that looks like:

{
  "name": "Default",
  "state": {
    "sources": [
      {
        "id": 0,
        "input": "stream=1005"
      },
      {
        "id": 1,
        "input": "stream=1006"
      },
      {
        "id": 2,
        "input": "stream=1007"
      },
      {
        "id": 3,
        "input": "stream=1008"
      },
    ],
    "zones": [
      {
        "id": 0,
        "source_id": 0,
        "vol_f": 0.5,
        "mute": false
      },
      {
        "id": 1,
        "source_id": 1,
        "vol_f": 0.5,
        "mute": false
      },
      {
        "id": 2,
        "source_id": 2,
        "vol_f": 0.5,
        "mute": false
      },
      {
        "id": 3,
        "source_id": -1
      },
      {
        "id": 4,
        "source_id": -1
      },
      {
        "id": 5,
        "source_id": 3,
        "vol_f": 0.5,
        "mute": false
      }
    ]
  }
}

I would suggest using our interactive API to make the changes to your presets. Check it out at http://amplipi.local/doc.

Use Presets - Get Preset to get the preset content to modify and Presets - Set Preset to update the preset with the suggested changes.

Another potential fix for this would be to add a flag that indicates whether a preset should be applied as a full update or a partial update. Maybe something like this

{ 
  "name": "preset with full state change",
  "update_type": "full" //default: "partial" for backwards compatibility,
  "state": {
    ...
  }
}

Porting this to the UI would be easy as well since it would probably just add another checkbox.

Thanks for the explanation @linknum23 ! I figured it may had been something similar to this, I can just set them to muted for now or use the direct API like you suggested. Thanks for taking a look