# \[APP\]\[Pro\] Sonos (LocalAPI)

**URL:** <https://community.homey.app/t/app-pro-sonos-localapi/147985>\
**Category:** Apps\
**Tags:** app, homey-pro\
**Created:** [December 28, 2025, 12:48pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985 "2025-12-28T12:48:49Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![xiutit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xiutit/32/175860_2.png) [@xiutit](https://community.homey.app/u/xiutit)\
**Post date:** [May 4, 2026, 11:41am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/206 "2026-05-04T11:41:55Z")

</div>

> [@SunBeech](#):
>
> It’s a dashboard widget showing favorite radio stations. When tapping on an icon my Sonos starts playing that favorite station. I made a tutorial for how to create this widget over here:

This does indeed look great. I’m currently experimenting with implementing a widget showing Sonos favorites to recreate this functionality. Still in very early stage so this will take some time.

---

<div class="post-metadata">

**Author:** ![John\_William\_Brekke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_william_brekke/32/111887_2.png) [@John\_William\_Brekke](https://community.homey.app/u/John_William_Brekke)\
**Post date:** [May 4, 2026, 11:48am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/207 "2026-05-04T11:48:18Z")

</div>

Is it also possible getting songs straight from Spotify? Would be nice being able to play songs even if you haven’t favorited them.

---

<div class="post-metadata">

**Author:** ![xiutit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xiutit/32/175860_2.png) [@xiutit](https://community.homey.app/u/xiutit)\
**Post date:** [May 4, 2026, 12:43pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/208 "2026-05-04T12:43:29Z")

</div>

> [@SunBeech](#):
>
> Hi @xiutit, would it be possible for you to add the following two settings to you app? Those are relevant only when a TV/other device is connected to a speaker (Playbar in my case).

Are you able to test v1.11.0?

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [May 4, 2026, 2:12pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/209 "2026-05-04T14:12:31Z")

</div>

The new flowcards work!

Am I correct that currently there are no boolean tags available that indicate the state of both auto-play setings? I could not find them in the list of available tags.

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [May 4, 2026, 2:26pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/210 "2026-05-04T14:26:17Z")

</div>

Unfortunately I have not an iPhone.

([[APP][Pro] Sonos (LocalAPI) - #176 by John\_William\_Brekke](https://community.homey.app/t/app-pro-sonos-localapi/147985/176))

@xiutit : do you see any chance to have a trigger for having different flows if a stream is coming form network/tv or via a bluetooth source

---

<div class="post-metadata">

**Author:** ![xiutit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xiutit/32/175860_2.png) [@xiutit](https://community.homey.app/u/xiutit)\
**Post date:** [May 4, 2026, 7:20pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/211 "2026-05-04T19:20:09Z")

</div>

> [@SunBeech](#):
>
> Am I correct that currently there are no boolean tags available that indicate the state of both auto-play setings? I could not find them in the list of available tags.

Can you try v1.11.1? Added the tags 🙂

> [@owuerker](#):
>
> @xiutit : do you see any chance to have a trigger for having different flows if a stream is coming form network/tv or via a bluetooth source

I will look into this and see if it’s possible.

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [May 4, 2026, 7:29pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/212 "2026-05-04T19:29:05Z")

</div>

> [@xiutit](#):
>
> > [@SunBeech](#):
> >
> > Am I correct that currently there are no boolean tags available that indicate the state of both auto-play setings? I could not find them in the list of available tags.
> 
> Can you try v1.11.1? Added the tags 🙂

Yes, found them! Thank you 👍.

---

<div class="post-metadata">

**Author:** ![Geronimo206](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/geronimo206/32/29921_2.png) [@Geronimo206](https://community.homey.app/u/Geronimo206)\
**Post date:** [May 5, 2026, 2:55pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/213 "2026-05-05T14:55:26Z")

</div>

Hi @xiutit !

Thanks again for the awesome updates, I’ve tested most of it by now and everything seems to work as intended.

The thing I’m still missing though is a way to pause from **any** speaker, whenever a group of speakers is playing. This works on the physical devices themselves with the pause button, and this also worked in the older cloud based Homey Sonos app (pausing any speaker that was playing would put the entire group that the speaker was in on pause).

Now, when I try to pause from a different device that is not the “group master” so to speak, I get this error:

 ![Schermafbeelding 2026-05-05 om 16.34.55](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/4/14543546e04d6ec289a13ab190b9d82ba69a8a88.png)

Even more problematic: I have a separate office that has it’s own Sonos speaker that groups with the rest of the house whenever you enter it, or that starts playing music individually if nothing else is playing in the house. The tiny dashboard in that office shows the dedicated office speaker, but whenever this speaker is grouped and I try to pause the music from the dashboard there is no reaction: I suppose the same error is thrown but the dashboard does not seem to give the same error feedback as it does in the app, so now the behavior is very confusing. The only thing that happens is the pause icon becomes a play icon (and the music in the office keeps playing):

 ![IMG_4418](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/a/3aee196034fcb24eb3875cfac5bfa7c9fe407c60.jpeg)

So when I’m in the office and the Sonos there is grouped with the rest of the house my only option to pause from the office is to hit the pause button on the Sonos amp that is hidden away in a closet 😅.

I hope I’m explaining this right, it’s a bit obscure maybe.

Also not sure if it’s fixable, but if it is it would add a bit more user friendliness for people using separate dashboards per room with the ability to start/stop either the group or the individual speaker using the same pause button/action.

Let me know what you think!

---

<div class="post-metadata">

**Author:** ![Amersfoort](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Amersfoort](https://community.homey.app/u/Amersfoort)\
**Post date:** [May 6, 2026, 8:43am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/214 "2026-05-06T08:43:20Z")

</div>

> [@owuerker](#):
>
> do you see any chance to have a trigger for having different flows if a stream is coming form network/tv or via a bluetooth source

Inspired by the question above, you will find a Homey script below to determine the sound source of the Sonos speaker. Unfortunately, I cannot test this for Bluetooth.  
I tested this on my Sonos Playbar; other speakers might react differently.

Perhaps this could be an input for @xiutit

```auto
/**
 * Sonos Direct API Reader
 * Retrieves the current playback source from a Sonos speaker via UPnP/SOAP.
 */

// Configuration: The IP address of the target Sonos speaker
const SPEAKER_IP = '192.168.178.36';

async function getSonosSource() {
    // Construct the endpoint URL for the AVTransport service
    const endpointUrl = 'http://' + SPEAKER_IP + ':1400/MediaRenderer/AVTransport/Control';
    
    // Define the SOAP XML body to request position and track information
    // Using string concatenation (+) as per requested coding style
    const soapBody = 
        '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
            '<s:Body>' +
                '<u:GetPositionInfo xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">' +
                    '<InstanceID>0</InstanceID>' +
                '</u:GetPositionInfo>' +
            '</s:Body>' +
        '</s:Envelope>';

    try {
        // Execute the POST request to the speaker
        const response = await fetch(endpointUrl, {
            method: 'POST',
            headers: {
                'Content-Type': 'text/xml; charset="utf-8"',
                'SOAPACTION': '"urn:schemas-upnp-org:service:AVTransport:1#GetPositionInfo"'
            },
            body: soapBody
        });

        // Parse the XML response text
        const responseXml = await response.text();
        
        // Extract the TrackURI using a Regular Expression
        const uriMatch = responseXml.match(/<TrackURI>(.*?)<\/TrackURI>/);
        let trackUri = uriMatch ? uriMatch[1] : "";
        
        // Decode the URI to make it human-readable for checking
        trackUri = decodeURIComponent(trackUri);

        // Default value if no specific source is identified
        let detectedSource = "Other / Unknown";

        // --- Logic: Source Identification ---

        // 1. Check for Spotify or Sonos Virtual Line-In
        if (trackUri.includes("spotify") || trackUri.includes("x-sonos-vli")) {
            detectedSource = "Spotify";
        } 
        
        // 2. Check for Radio streams (TuneIn or direct MP3 streams)
        else if (trackUri.includes("Tunein") || trackUri.includes("x-rincon-mp3radio")) {
            detectedSource = "Radio";
        }

        // 3. Check for TV input (Home Theater Audio Stream)
        else if (trackUri.includes("x-sonos-htastream")) {
            detectedSource = "TV";
        } 

        // 4. Check if the speaker is idle or in standby (Queue is empty or URI is blank)
        else if (trackUri === "" || trackUri.includes("x-rincon-queue")) {
            detectedSource = "No media / Standby";
        }

        // Log results for debugging purposes
        console.log("Current URI: " + trackUri);
        console.log("Detected Source: " + detectedSource);
        
        return detectedSource;

    } catch (error) {
        // Handle network errors or unreachable speakers
        console.error("Error: " + error.message);
        return "Error: Speaker unreachable";
    }
}

// Execute the function and return the result to Homey
return await getSonosSource();

```

---

<div class="post-metadata">

**Author:** ![xiutit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xiutit/32/175860_2.png) [@xiutit](https://community.homey.app/u/xiutit)\
**Post date:** [May 6, 2026, 10:37am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/215 "2026-05-06T10:37:52Z")

</div>

> [@owuerker](#):
>
> do you see any chance to have a trigger for having different flows if a stream is coming form network/tv or via a bluetooth source

Are you able to test v1.12.0 (test)? I have added a tag and a trigger card. I’m currently not at home so I could only test switching from TV to Music and back, but not Bluetooth. Let me know if this works.

> [@Geronimo206](#):
>
> The thing I’m still missing though is a way to pause from **any** speaker, whenever a group of speakers is playing.

I changed the pause behavior in v1.12.0 (test). Now pausing any speaker should pause the group as expected.

---

<div class="post-metadata">

**Author:** ![John\_William\_Brekke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_william_brekke/32/111887_2.png) [@John\_William\_Brekke](https://community.homey.app/u/John_William_Brekke)\
**Post date:** [May 6, 2026, 10:38am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/216 "2026-05-06T10:38:48Z")

</div>

You’re amazing!

---

<div class="post-metadata">

**Author:** ![Blauwvinger](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/blauwvinger/32/79109_2.png) [@Blauwvinger](https://community.homey.app/u/Blauwvinger)\
**Post date:** [May 6, 2026, 12:00pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/217 "2026-05-06T12:00:01Z")

</div>

```auto

```

I’ve recently started using this app. Very happy with it. It works well. I have a SONOS Playbar. When I listen to the radio, I notice that under “Track” it shows the artist info, and under “Artist” it shows the track info. Is this a problem specific to the SONOS Playbar?

---

<div class="post-metadata">

**Author:** ![Amersfoort](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Amersfoort](https://community.homey.app/u/Amersfoort)\
**Post date:** [May 6, 2026, 4:00pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/219 "2026-05-06T16:00:06Z")

</div>

Case: I use a Homey script to retrieve all my favorite TuneIn stations and Spotify playlists via the local Sonos API. The result is a list of names, image URLs, and URIs.

It seems impossible to me to play music based on a URI.

I would like to use a Sonos card to play the TuneIn or Spotify URI. Is it technically possible to send the URI in a variable to a Sonos card to play the selected music?

I want to avoid having to create dozens of conditions in a flow to control a Sonos favorites card based on a playlist/TuneIn name, aside from maintenance such as changing favorites.

EDIT - better not this (only half of the favorites, the other half are favorite Spotify playlists):

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/8/783f3b7c3a0e1cd8074c396649922dd772657b35.png)

> [@xiutit](#):
>
> I have added a tag and a trigger card

Switching from TuneIn to Spotify (or back) doesn’t activate one of the cards below on my Sonos playbar. Or is my test wrong?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/2/12e2cfe7069ac92dc6aaf89d390acf2d92d5f8bb.png)

---

<div class="post-metadata">

**Author:** ![John\_William\_Brekke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_william_brekke/32/111887_2.png) [@John\_William\_Brekke](https://community.homey.app/u/John_William_Brekke)\
**Post date:** [May 6, 2026, 5:16pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/220 "2026-05-06T17:16:28Z")

</div>

Question: should the Bluetooth show when connected to Bluetooth and playing music started or the moment it goes into Bluetooth mode?

Edit: it does say Bluetooth, but not before the music plays?

---

<div class="post-metadata">

**Author:** ![John\_William\_Brekke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_william_brekke/32/111887_2.png) [@John\_William\_Brekke](https://community.homey.app/u/John_William_Brekke)\
**Post date:** [May 6, 2026, 7:13pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/221 "2026-05-06T19:13:28Z")

</div>

How did you even find this?

---

<div class="post-metadata">

**Author:** ![Amersfoort](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Amersfoort](https://community.homey.app/u/Amersfoort)\
**Post date:** [May 6, 2026, 7:43pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/222 "2026-05-06T19:43:57Z")

</div>

A little bit from me and from AI. Gemini AI can do quite nice things with Homey script.

---

<div class="post-metadata">

**Author:** ![John\_William\_Brekke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_william_brekke/32/111887_2.png) [@John\_William\_Brekke](https://community.homey.app/u/John_William_Brekke)\
**Post date:** [May 6, 2026, 8:23pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/223 "2026-05-06T20:23:18Z")

</div>

Ooo, thanks!

---

<div class="post-metadata">

**Author:** ![xiutit](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xiutit/32/175860_2.png) [@xiutit](https://community.homey.app/u/xiutit)\
**Post date:** [May 10, 2026, 9:03pm UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/224 "2026-05-10T21:03:08Z")

</div>

> [@Amersfoort](#):
>
> It seems impossible to me to play music based on a URI.

Can you try the Play URI flowcard in v1.12.1 in test?

---

<div class="post-metadata">

**Author:** ![John\_William\_Brekke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_william_brekke/32/111887_2.png) [@John\_William\_Brekke](https://community.homey.app/u/John_William_Brekke)\
**Post date:** [May 11, 2026, 12:57am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/225 "2026-05-11T00:57:04Z")

</div>

Can you add “play song from …” Card?

---

<div class="post-metadata">

**Author:** ![Amersfoort](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Amersfoort](https://community.homey.app/u/Amersfoort)\
**Post date:** [May 11, 2026, 6:54am UTC](https://community.homey.app/t/app-pro-sonos-localapi/147985/226 "2026-05-11T06:54:02Z")

</div>

It works great and fast. Thank you.

[Previous page](https://community.homey.app/t/app-pro-sonos-localapi/147985.md?page=10)

[Next page](https://community.homey.app/t/app-pro-sonos-localapi/147985.md?page=12)
