My system is configured entirely with MainUI, and Location cards are automatically created by the Model.
I’m using a wholehome amplifier to drive speakers in 6 locations and on each Location card there is selector to choose a Source.
You have the Channels. You have the Channels linked to Items.
As described you have a separate set of metadata Items per location. So just add those Item to the model under the speaker’s equipment.
Maybe it’s unclear what you are asking here.
It sounds like it. You need an Item that represents the data and that Item needs to be a part of the Equipment it’s relevant to. Then all is done.
That’s also an option if you don’t want or for some reason cannot put the Item into the model where it needs to go. There are lots of media player list item widgets on the marketplace to use or take inspiration from. Pages - Custom Widgets | openHAB walks through the creation of custom list item widget that works with more than one Item.
obviously my problem statement was not clear.
Yes, I have Items connected to channels, but what I’m trying to do is change the channels sent to the Items when I select a new source of audio.
Here are my channels
When I select “brian” as a source at a location, I want to display the “brian” metadata and when I change to “sarah” as a source I’d like the Item to display “sarah” metadata.
Stated another way I want the Source, Title, and Artist Items to be dependent on the state of the Airplay Source Item.
Create separate Items for each location and have a rule to update those Items when you change the source to whatever the source Items are currently set to. You’ll need a rule for this as well as rule to update the Items as well when they change.
For example, you’ll have separate album, artist, et. al. Items for the kitchen. Those are part of the model. When the source is changed to brian, the rule copies the states from the brian Items to the kitchen Items.
Create a custom widget and use expressions to choose the brian Items when the source for the Kitchen Item indicates that’s the source. This approach will depend on being able to construct all the Item names based on the state of the Item indicating the source.
For option 1, the changes to the brian state will happen far more often than the source state, so maybe the primary trigger should be brian state changes and then copy them to all locations using brian. One disadvantage to this approach would be that metadata only gets updated when the song changes and not immediately when the source is changed for a location.
I’m thinking this could be three rules, one for each source triggered by state change. Seems too complex to be one large rule with multiple triggers.
For option 2, this may be simpler once once I learn how to create a custom widget. How difficult is it to mimic the style of the default cards?
There is no such thing as a “primary trigger”. There are only triggers. You need to trigger the rule any time there is an event (e.g. an Item changes) that requires an action (e.g. Cooking that change to the kitchen Items).
That’s why you need to trigger the rule for any change that requires data to be copied from one Item to the other.
I’m certain with only a little bit of effort and taking advantage of being consistent with the Item names this can be done in one role l rule.
Sometimes a little bit of complexity is worth but having to update multiple colors of the same code when you need to change something. And it’s not that complex really. You have the name of the Item that triggered the rule. All you need to do is map that Item to the location using that source and update the corresponding location Item.
I don’t know how to answer that. It’s not like you are starting from scratch. The basic building blocks of custom widgets are the same as used by the default widgets. So they are going to look lately the same.