Sonos state for location badge

I connected my Sonos speakers to OH3 as described in the binding documentation.
Now I would like to get the speakers badge showing up on the location room widgets but they don’t. My Sonos equipment is marked as Receiver so that should be fine.
But it seems Sonos has no item directly usable for the Status/Power combination required for the speakers badge?
I tried to use the “state” channel but that contains strings like “Playing” or “Stopped”.
(How) can I map those states so that the badge recognizes a running Sonos speaker?

Not sure if that would work, as the following is mostly cosmetic, but you could try to define a State Description (meta data, options field) which would translate Playing = ON, Stopped = OFF so that the badge recognizes those (think it uses on/off?). Otherwise you could use a transformation map to do the same on in-coming signal?

edit: also make sure all those properties are correct:

There is a way to directly influence which state is taken into consideration for a specific badge, maybe something like would do the trick:

  label: Home Page
  - component: oh-locations-tab
          expression: state === 'Playing'

Please find more details on the subject here - and you’ll need a 3.1.0.M3 or later …

Thanks for the pointers. Before I read the last comment I already implemented a transformation map and created a second item with the map applied on the channel which works as well.
Obviously I have a more or less redundant additional item but should be fine for the moment.

Now tried this approach for my Echo which does not have a state but the player item which can be PLAY and PAUSE. Seems to work correctly. Thanks.

1 Like