# Playing Sonos favorite from HomeyScript

**URL:** <https://community.homey.app/t/playing-sonos-favorite-from-homeyscript/47262>\
**Category:** Developers\
**Created:** [May 10, 2021, 5:07pm UTC](https://community.homey.app/t/playing-sonos-favorite-from-homeyscript/47262 "2021-05-10T17:07:19Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Marcel\_Ubels](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_ubels/32/18860_2.png) [@Marcel\_Ubels](https://community.homey.app/u/Marcel_Ubels)\
**Post date:** [May 11, 2021, 6:06pm UTC](https://community.homey.app/t/playing-sonos-favorite-from-homeyscript/47262/10 "2021-05-11T18:06:46Z")

</div>

Have you thougt of using the api from Sonos?  
[Sonos Api](https://github.com/jishi/node-sonos-http-api). Here a link with a how to [Sonos api how to](https://community.homey.app/t/sonos-say/6697)

You can install it on a server(with Docker) and or a Rpi. With get requests you are able to control Sonos. It works great. This is a flow i use to play a radiostation or a playlist from Sonos favorites

> **[Radiozender opzoeken | Homey](https://homey.app/en-us/flow/nUkCsB/)**

This are some possibilities with the Sonos api

## Favorites

It now has support for starting favorites. Simply invoke:

`http://localhost:5005/living room/favorite/[favorite name]`

and it will replace the queue with that favorite. Bear in mind that favorites may share name, which might give unpredictable behavior at the moment.

## Playlist

Playing a Sonos playlist is now supported. Invoke the following:

`http://localhost:5005/living room/playlist/[playlist name]`

and it will replace the queue with the playlist and starts playing.

With a script i shuffle my radiostations and playlists every 2 weeks

This way you also have the ability to easily raise or lower the volume

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/7/d70c15a60bbb07e1b00b834808484c1b128e5e6f.jpeg)

---

_[View the full topic](https://community.homey.app/t/playing-sonos-favorite-from-homeyscript/47262)._
