Using Sonos via MiOS binding

Tags: #<Tag:0x00007faf834338b8>

OH1 setup.

I’d like to use the Sonos via MiOS due to memory issues listed in the OH1 Sonos Binding and to have the ability to use TTS. I’m really confused about how to put this into my sitemap though.

I’d like the ability to select which Sonos to group (I have three) and choose between a couple of Pandora stations. I understand I may have to put the Pandora stations into a favorite list.

Here is the item list for one of the Sonos’ created by the MiOS binding, I really have no clue where to start though as the only “switch” I see is the mute.

Does anybody that use Sonos via MiOS/Vera have a suggestion of what direction to go? The examples I can find only deal with the Sonos binding and not the MiOS one.

/* Device - Office Sonos */
Number   OfficeSonosId "ID [%d]" (GDevices) {mios="unit:house,device:132/id"}
String   OfficeSonosDeviceStatus "Office Sonos Device Status [MAP(miosDeviceStatusUI.map):%s]" (GDevices) {mios="unit:house,device:132/status"}
String   OfficeSonosPluginVersion "Office Sonos Plugin Version [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/PluginVersion"}
String   OfficeSonosDiscoveryResult "Office Sonos Discovery Result [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/DiscoveryResult"}
String   OfficeSonosRouterIp "Office Sonos Router IP [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/RouterIp"}
String   OfficeSonosRouterPort "Office Sonos Router Port [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/RouterPort"}
String   OfficeSonosCheckStateRate "Office Sonos FIXME CheckStateRate [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/CheckStateRate"}
String   OfficeSonosDebugLogs "Office Sonos Debug Logs [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/DebugLogs"}
String   OfficeSonosFetchQueue "Office Sonos Fetch Queue [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/FetchQueue"}
String   OfficeSonosDiscoveryPatchInstalled "Office Sonos FIXME DiscoveryPatchInstalled [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/DiscoveryPatchInstalled"}
String   OfficeSonosDefaultLanguageTTS "Office Sonos Default TTS Language [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/DefaultLanguageTTS"}
String   OfficeSonosDefaultEngineTTS "Office Sonos Default TTS Engine [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/DefaultEngineTTS"}
String   OfficeSonosGoogleTTSServerURL "Office Sonos Google TTS URL [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/GoogleTTSServerURL"}
String   OfficeSonosOSXTTSServerURL "Office Sonos OSX TTS URL [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/OSXTTSServerURL"}
String   OfficeSonosMaryTTSServerURL "Office Sonos Mary TTS URL [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/MaryTTSServerURL"}
String   OfficeSonosMicrosoftClientSecret "Office Sonos Microsoft Client Secret [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/MicrosoftClientSecret"}
String   OfficeSonosZoneName "Office Sonos Zone Name [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/DeviceProperties/ZoneName"}
String   OfficeSonosSonosID "Office Sonos Sonos ID [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/DeviceProperties/SonosID"}
String   OfficeSonosSonosModelName "Office Sonos Sonos Model Name [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/SonosModelName"}
String   OfficeSonosSonosModel "Office Sonos Sonos Model [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/SonosModel"}
String   OfficeSonosProxyUsed "Office Sonos Proxy Used [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/ProxyUsed"}
String   OfficeSonosSonosOnline "Office Sonos Sonos Online [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/SonosOnline"}
String   OfficeSonosTransportState "Office Sonos Transport State [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/TransportState"}
String   OfficeSonosTransportStatus "Office Sonos Transport Status [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/TransportStatus"}
String   OfficeSonosTransportPlaySpeed "Office Sonos Transport Play Speed [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/TransportPlaySpeed"}
String   OfficeSonosCurrentPlayMode "Office Sonos Current Play Mode [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentPlayMode"}
String   OfficeSonosCurrentCrossfadeMode "Office Sonos Current Crossfade Mode [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentCrossfadeMode"}
String   OfficeSonosCurrentTransportActions "Office Sonos Current Transport Actions [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentTransportActions"}
String   OfficeSonosNumberOfTracks "Office Sonos Number of Tracks [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/NumberOfTracks"}
String   OfficeSonosCurrentMediaDuration "Office Sonos Current Media Duration [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentMediaDuration"}
String   OfficeSonosAVTransportURI "Office Sonos AV Transport URI [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/AVTransportURI"}
String   OfficeSonosAVTransportURIMetaData "Office Sonos FIXME AVTransportURIMetaData [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/AVTransportURIMetaData"}
String   OfficeSonosCurrentRadio "Office Sonos Current Radio [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentRadio"}
String   OfficeSonosCurrentService "Office Sonos Current Service [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/CurrentService"}
String   OfficeSonosCurrentTrack "Office Sonos Current Track [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentTrack"}
String   OfficeSonosCurrentTrackDuration "Office Sonos Current Track Duration [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentTrackDuration"}
String   OfficeSonosCurrentTrackURI "Office Sonos Current Track URI [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentTrackURI"}
String   OfficeSonosCurrentTrackMetaData "Office Sonos Current Track Meta-Data [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentTrackMetaData"}
String   OfficeSonosCurrentStatus "Office Sonos Current Status [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentStatus"}
String   OfficeSonosCurrentTitle "Office Sonos Current Title [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentTitle"}
String   OfficeSonosCurrentArtist "Office Sonos Current Artist [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentArtist"}
String   OfficeSonosCurrentAlbum "Office Sonos Current Album [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentAlbum"}
String   OfficeSonosCurrentDetails "Office Sonos Current Details [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentDetails"}
String   OfficeSonosCurrentAlbumArt "Office Sonos Current Album Art [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/CurrentAlbumArt"}
String   OfficeSonosRelativeTimePosition "Office Sonos Relative Time Position [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/AVTransport/RelativeTimePosition"}
Dimmer   OfficeSonosVolume "Office Sonos Volume [%d %%]" (GDevices,GRoom5) {mios="unit:house,device:132/service/RenderingControl/Volume"}
Switch   OfficeSonosMute "Office Sonos Mute" (GDevices,GRoom5) {mios="unit:house,device:132/service/RenderingControl/Mute"}
String   OfficeSonosSavedQueues "Office Sonos FIXME SavedQueues [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/ContentDirectory/SavedQueues"}
String   OfficeSonosFavoritesRadios "Office Sonos FIXME FavoritesRadios [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/ContentDirectory/FavoritesRadios"}
String   OfficeSonosFavorites "Office Sonos Favorites [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/ContentDirectory/Favorites"}
String   OfficeSonosQueue "Office Sonos FIXME Queue [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/ContentDirectory/Queue"}
String   OfficeSonosGroupCoordinator "Office Sonos Group Co-ordinator [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/GroupCoordinator"}
String   OfficeSonosZonePlayerUUIDsInGroup "Office Sonos FIXME ZonePlayerUUIDsInGroup [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/ZoneGroupTopology/ZonePlayerUUIDsInGroup"}
String   OfficeSonosZoneGroupState "Office Sonos Zone Group State [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/ZoneGroupTopology/ZoneGroupState"}
DateTime OfficeSonosLastUpdate "Office Sonos Last Update [%1$ta, %1$tm/%1$te %1$tR]" <calendar> (GDevices,GRoom5) {mios="unit:house,device:132/service/HaDevice1/LastUpdate"}
String   OfficeSonosMicrosoftClientId "Office Sonos Microsoft Client Id [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/MicrosoftClientId"}
String   OfficeSonosSonosServicesKeys "Office Sonos Sonos Service Keys [%s]" (GDevices,GRoom5) {mios="unit:house,device:132/service/Sonos1/SonosServicesKeys"}

You can start with a basic snippet like:

Text     item=OfficeSonosTransportState {
    Switch   item=OfficeSonosTransportState label="Current State" mappings=[PLAYING="Play", STOPPED="Stop", PAUSED="Pause"]
    Switch   item=OfficeSonosMute
    Slider   item=OfficeSonosVolume
    Text     item=OfficeSonosCurrentStatus
    Text     item=OfficeSonosCurrentAlbumArt
}

I tend not to switch stations on My Sonos via openHAB (I use the native iDevice app for that).

If you want to see what to set, you can watch the openHAB events.log file as you play with the UI of the Sonos Plugin on MiOS or via the native Sonos interface.

The events.log will show you all of the changes made to the Items (UPnP StateVariables of the Sonos). And will often show you what needs to be “set” via a call to the Sonos.

From there, use the MiOS Action Binding to make invocations similar to those described in Making a Sonos play something and Making a Sonos say something

NB: Some of stateVariables are read-only “status” indicators.

Thank you so much Guessed! I couldn’t figure out what was the item to actually make it play.

Choosing a station from the app isn’t a main priority, 90% of the time we listen to the same one anyway.

Thanks for the start and the idea of how to proceed. All I really used from the MiOS plugin was TTS though, we did all control via the Sonos app. Just trying to consolidate a little bit. I didn’t realize actions on the Sonos app would transfer through onto the OpenHab log.