Sitemap Visibility - Basic UI

Hello…I have 4 sonos players that I am trying to use visiblity on whether they are playing or not. Quite honestly, I’m lost. I don’t know how to tell if a player is online or not. I have older Sonos devices that don’t have all the channels that some others have posted here.


It seems that I need to set up a rule, and you are the master at that. When the player is off, it’s UNDEF, so I assume I could use this…but I don’t know how.

Can I use NGRE to check the state as UNDEF, then send a command to a dummy item?

You probably don’t need a Rule. You need to find some Channel whose state indicates that the device is playing. I don’t use Sonos so I’ve no idea what that would be, but for Chromecast I use the Media Title Channel. Link that to an Item and in the sitemap for the row you only want to show when it’s playing append visibility=[MediaTitle!=UNDEF]. When it’s not playing, the Chromecast binding sets that Item to UNDEF. When it is playing it sets that Channel to the title of the piece being played.

1 Like

Does it matter if the channel is linked to another item?

No, all that matters is the Item name. But if the Channel is linked to another Item, why not just use that other Item?

1 Like

They are strings…my currentartist channel.

I’m going to throw in a kicker…can I do this to groups?

Actually, I think I understand. Whatever sitemap line I want to hide, add the visibility to the end with my channelname…

So, technically, I could hide a group and an image using the same visibility channel association.

Frame label="Media"{
	Image	item=Sonos_CurrentAlbumArt_Tile		visibility=[sonos:One:RINCON_7828CA16D1A801400:currentalbum!=UNDEF]
	Group item=gSonosTile						label="Tile Selections Sonos"				icon="sonos"
	Image	item=Sonos_CurrentAlbumArt_Rec
	Group item=gSonosRec						label="Reception Sonos"						icon="sonos"
	Image	item=Sonos_CurrentAlbumArt_Kit
	Group item=gSonosKit						label="Kitchen Sonos"						icon="sonos"
	Image	item=Sonos_CurrentAlbumArt_Off
	Group item=gSonosOff						label="Office Sonos"						icon="sonos"

This does not work. The docs are lacking in this area too…

That’s not an Item. That’s a channel.
You can only refer to Items in any sitemap.

Can you expand on what?

1 Like

Ok, I think I may get it then…

The docs don’t tell you where on the line of code it should be placed, or even if it matters where.

I don’t think that it will work with an item that is linked to your “current album”-channel. Even if your Sonos stops, the name of the last album will be held in the items state.
Maybe a better solution could be an item like one of those:

Player AZ_Sonos_Control   "Player[%s]"  <music>        (AZ_Sonos) {channel="sonos:PLAY1:RINCON_xxxxxxxx:control", autoupdate="false"}
Switch AZ_Sonos_Stop      "Stop[%s]"    <sonos_stop>   (AZ_Sonos) {channel="sonos:PLAY1:RINCON_xxxxxxxx:stop", autoupdate="false"}
String AZ_Sonos_State     "State [%s]"  <sonos_state>  (AZ_Sonos) {channel="sonos:PLAY1:RINCON_xxxxxxxx:state", autoupdate="false"}

When your player isn’t in use then
control is PAUSE
stop is ON
state is STOPPED

so if you have one of those channels you can handle your the visibility with it’s item-states in your sitemap.

1 Like

I will look at your advice tomorrow when I’m back in front of it…but, its currently working using the dummy item linked to the artist channel. Watching the logs, when the sonos unit is off, its undefined.