Can someone remind me how to get the “Media presets” attributes to refresh in SmartThings for Sonos? I’ve added a couple of playlists and need to know the preset number but it’s still showing the old version. I thought a reboot might do it but alas…
Did you try the refresh command for the device in the AWA?
Any idea where I find that?
You can also use the ST CLI to issue commands like:
`bep@debian12:~$ smartthings devices:commands
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Label Name Type Device Id
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
…
56 iPhone iPhone MOBILE ebd45263-20a8-4a65-9298-702b8b57f9ac
57 Kitchen sonos-player LAN 93a4da76-fb1c-4a9c-856b-c6398e79c0b5
58 Kitchen Light GE Motion/Dimmer Switch ZWAVE 44127f0d-fafd-47e3-942f-529df20f6d40
59 Kitchen Temp Sensor ecobee Sensor VIPER eb25c05f-a4de-4cb5-a755-b2a8ffea5b72
60 Lake Backyard c2c-ring-camera-rtsp VIPER 728a7be4-4501-4d93-af3a-5850ffb700b0
…
? Select a device. 57
Kitchen
Capabilities:
──────────────────────
1 mediaPlayback
2 mediaGroup
3 mediaPresets
4 mediaTrackControl
5 audioMute
6 audioNotification
7 audioTrackData
8 audioVolume
9 refresh
──────────────────────
? Enter capability index or id `
Thanks for that, well for whatever reason it’s not updating. I’ve tried rebooting my hub and my Sonos devices but no luck. Maybe tomorrow I’ll try deleting them and adding them back into ST.
Yeah, I just did some driver logging for the refresh command and I don’t see main.mediaPresets.presets as one of the attributes that is queried for
2024-02-20T23:17:33.444511470+00:00 DEBUG Sonos Emitting group info update for Device Kitchen
2024-02-20T23:17:33.445856616+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"groupRole","capability_id":"mediaGroup","component_id":"main","state":{"value":"ungrouped"}}
2024-02-20T23:17:33.454312720+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"groupPrimaryDeviceId","capability_id":"mediaGroup","component_id":"main","state":{"value":"RINCON_48A6B8E3BDF201400"}}
2024-02-20T23:17:33.475832178+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"groupId","capability_id":"mediaGroup","component_id":"main","state":{"value":"RINCON_48A6B8E3BDF201400:183406752"}}
2024-02-20T23:17:33.558921137+00:00 TRACE Sonos PlayerVolume type message for Kitchen
2024-02-20T23:17:33.560504137+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"volume","capability_id":"audioVolume","component_id":"main","state":{"value":25}}
2024-02-20T23:17:33.568537553+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"mute","capability_id":"audioMute","component_id":"main","state":{"value":"unmuted"}}
2024-02-20T23:17:33.655667345+00:00 TRACE Sonos GroupVolume type message for Kitchen
2024-02-20T23:17:33.657476762+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"groupVolume","capability_id":"mediaGroup","component_id":"main","state":{"value":25}}
2024-02-20T23:17:33.665952595+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"groupMute","capability_id":"mediaGroup","component_id":"main","state":{"value":"unmuted"}}
2024-02-20T23:17:33.714391345+00:00 TRACE Sonos PlaybackStatus type message for Kitchen
2024-02-20T23:17:33.715748491+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"playbackStatus","capability_id":"mediaPlayback","component_id":"main","state":{"value":"paused"}}
2024-02-20T23:17:33.788883824+00:00 TRACE Sonos MetadataStatus type message for Kitchen
2024-02-20T23:17:33.790470657+00:00 INFO Sonos <Device: 93a4da76-fb1c-4a9c-856b-c6398e79c0b5 (Kitchen)> emitting event: {"attribute_id":"audioTrackData","capability_id":"audioTrackData","component_id":"main","state":{"value":{"album":"Can We Get A Witness","albumArtUrl":"https://dyn-images.p-cdn.com/?l=images%2Fbb%2F8c%2F26%2Ff7%2F1c314fac9be2493285b2c609%2F%3Acover()&w=600","artist":"The Georgia Thunderbolts","mediaSource":"Pandora","title":"Dancin' With The Devil"}}}
If I’m reading the source code for the driver correctly, the only time the driver will update the presets is in response to the device emitting an event for a playlist change.
2024-02-20T23:34:34.936197058+00:00 INFO Sonos <Device: 0c678864-06f6-43c5-a918-5a6811e53af5 (Living Room)> emitting event: {"attribute_id":"presets","capability_id":"mediaPresets","component_id":"main","state":{"value":[{"id":"4","name":"Heart of Fire"},{"id":"3","name":"No Roots"}]}}
If that is the case and your hub misses the event, I don’t see any other way for it to get updated.
EDIT:
Hmmm…So, with a little more testing, if I create/modify/delete a Sonos Playlist, no preset event is received by the driver. Only when I add/remove items from the Sonos Favorites page or I rename/delete a grouping on the Sonos Favorites page do I see a presets event. So, once I created a Sonos Playlist, if I added it to the Sonos Favorites page, then an event is received and the playlist is added to the mediaPresets.presets attribute.
@bthrock Any insights?
I always understood the term favourites to be presets and not playlists which would align with @h0ckeysk8er 's observations above.
The driver does present ‘Play a favourite’ and not ‘Select a playlist’…
In the Sonos app under my Sonos and “Playlists” I have a few playlists I’ve made myself.
The playlist on the right in pic shows up in ST under attributes, media presets. I’ve managed to get the media presets list to update by removing another playlist from the same section but the new playlist, one on the left in my pic doesn’t show up.
Unfortunately the Sonos integration is hosed since moving to Edge. I’ve given up on any reliability. It seems SmartThings have too.
I figured it out. In order to get a playlist I’ve made show up in media presets in ST I needed to add it to Sonos favourites, something that’s not possible on the iPhone app, at least I can’t see away to do it, however it’s something you can do with the desktop app. Media presets has updated and includes my new playlist, in the Sonos iPhone app it now shows up under “Songs”.
Yeah, there doesn’t seem to be any way to manage playlists on the mobile app like there is in the desktop version.
As per previous observations from @h0ckeysk8er and myself.
Just for reference it can’t be done in the Android app either although selected other sources it is possible (Audible, Radio - although not podcasts, Artist/Album/Track ect.)…
Wonder why playlists are restricted to the desktop
Sorry, I’ve been overseas and beyond the reach of cellular or internet access for most of February, and I’m just now seeing this conversation. My brain is still 17 hours away from my body this morning, but hopefully I can provide some clarity. If not, feel free to let me know.
While Sonos Playlists can be added to Sonos Favorites via the desktop app, they are otherwise separate and distinct from Favorites in the API. The ability to subscribe to Playlist events, and also get and load (play) Playlists exists within the Sonos API on the same level as Favorites, but few if any developers have ever incorporated this capability within their drivers. Obviously, the SmartThings edge driver hasn’t as yet, if it ever will. (There has been some discussion about adding this capability to the new Sonos integration in HE, but I’m as yet unaware if there was any progress on this in my absence.)
Bottom line: creating, modifying, or deleting a playlist will not produce an event unless and until this capability is added to the Edge driver. For now, an event occurs only if a playlist is added or removed from Favorites via the desktop app.
As to why playlist management is limited to the desktop app, this has always been as much of a mystery to me as it is to @TheHundredthIdiot, because it’s something I use all the time. Of course … discussing the idiosyncrasies of the Sonos app is best left for another forum.
====
On a separate note, shortly before I left for my trip, the engineer that has led the Sonos Edge driver development contacted me to let me knew he was aware of several of the issues raised here. He assured me that these issues were not being ignored, but that he, along with other engineers, were working behind the scenes on what sounded like a pretty significant project to refactor the Lua test framework on the backend so that they can much more easily test and identify issues with LAN drivers, TCP sockets, REST APIs, and WebSocket connections. This is intended to speed development and debugging and will hopefully eliminate some of the “hit-and-miss” updates we’ve seen in the past. I’ll see if I can get a progress report on all that once I’m caught up with everything else stacked up here.