This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Sonos old function
#1
Hi,

I use the old code/function in LM to integrate with Sonos. I need a door-bell-function; stop music, play a door bell .mp3 and then back to music. I have tested with
http://192.168.1.193/user/sonos.lp?action=say&audiofile=192.168.1.193/user/svararinte.mp3&volume=50&duration=1&uuid=RINCON_000G166F5B8001400

192.168.1.193 is LM.

When I run the link, the music stops on the Sonos. I can see "svararinte.mp3" in my sonos-program:

BUT, it never starts. Nothing more hapends. Can anyone help me please? 
If I manually click on "PLAY" in the Sonos program, it plays "svararinte.mp3"..

BR Alexander

Attached Files Thumbnail(s)
       
Reply
#2
(25.01.2020, 21:58)zuuper Wrote: Hi,

I use the old code/function in LM to integrate with Sonos. I need a door-bell-function; stop music, play a door bell .mp3 and then back to music. I have tested with
http://192.168.1.193/user/sonos.lp?action=say&audiofile=192.168.1.193/user/svararinte.mp3&volume=50&duration=1&uuid=RINCON_000G166F5B8001400

192.168.1.193 is LM.

When I run the link, the music stops on the Sonos. I can see "svararinte.mp3" in my sonos-program:

BUT, it never starts. Nothing more hapends. Can anyone help me please? 
If I manually click on "PLAY" in the Sonos program, it plays "svararinte.mp3"..

BR Alexander
Not sure if your audio url is correct. Doesn't it need http:// as a prefix? Like http://192.168.1.193/user/svararinte.mp3
What happens  when you copy paste the url in your webbrowser? Does the audio file play?
Another solution is to check the complete API from the old Sonos script and use playlist or favorite to play this audio file.
Reply
#3
I've tested with http like you say. It does not help.

>Another solution is to check the complete API from the old Sonos script and use playlist or favorite to play this audio file.

Isn't that what I use?

My code is:

audiofile = socket.url.escape('http://admin:admin@192.168.1.193/Music/svararinte.mp3')
http.request('http://admin:admin@192.168.1.193/user/sonos.lp?action=say&uuid=RINCON_000F5668G5B8001400&audiofile=' .. audiofile .. '&volume=40&duration=1')


My Http:request return:

* arg: 1
  * string: true

* arg: 2
  * number: 200
* arg: 3
  * table:
  ["access-control-request-method"]
    * string: GET, POST
  ["transfer-encoding"]
    * string: chunked
  ["connection"]
    * string: close
  ["date"]
    * string: Sat, 01 Feb 2020 20:17:45 GMT
  ["access-control-allow-headers"]
    * string: authorization
  ["content-type"]
    * string: text/html; charset=utf-8
  ["access-control-allow-origin"]
    * string: *
* arg: 4
  * string: HTTP/1.1 200 OK


Can anyone please help me so it works? I can pay € 100 to the one who fixes it for me Smile
Reply
#4
Hi,

I created the API so I guess i can make it work for you (:

Few questions:

1) Do you use old or new Sonos app and uploaded only the .lp file? I guess the last.
2) Where did you store the mp3, given the url it seems to be on the normal FTP correct?
3) If you open a new browser session (don’t login to controller!) and open the url (without credentials in the url!) to the mp3, does your pc play the file?

Reasons why it might not work:

1) I think you use the sonos.lp file as a single file without ever running the old Sonos app, this can work but the old sonos app triggered a API action on startup to detect all Sonos devices and created a table in the storage with IP addresses and Rincon Id’s. All API actions are using this lookup table, when it’s not created once it won’t ever work. To trigger the action to create the lookup table manually (that the old app did on startup) you can try this: 
Code:
require('socket.http')
socket.http.timeout = 5
socket.http.request('http://127.0.0.1/user/sonos.lp?action=getsonosdata')

or

socket.http.request('http://127.0.0.1/user/sonos.lp?action=refreshsonosdata')
2) I see you have the file in Music folder, i think the URL that is passed is on a secured location and Sonos is not able to play it. Move the file to the apps ftp user folder and disable the need for password on the user folder in the user settings on the user tab.

BR,

Erwin
Reply
#5
1.
I use the old sonos app. But if possible, I'd rather use the new app in market. When I Use the new app and I click add Widget, it cant find any Floor or Rooms. So i cant add it Sad Have tested everything I guess..
I would like to use the new app if it works with a doorbell there.


2. Yes, the PC play it.

When I change the duration-time to higher value it seems to work. BUT,

when it has finished, it should return to previous music. And it doesn't :S
Reply
#6
Hi,

What source do you use from previous music? Do you use Spotify or another online service? I tested it with local music playlists and online radio, the online services like Deezer, Spotify etc might require some changes as they are not supported at this moment.

Can you try with a radio station playing?

BR,

Erwin
Reply
#7
>1) Why are you passing the admin:admin to audiofile URL?

I changed my password to 'admin', just for hide it here :/ In real I send the correct password there.

2. I dont know. I thought it was my only chans. Can I delete the .lp-file and use the NEW Sonosapp created in 2019-03 ? But I cant add widgets with it...

3. I send to group-master, I think

4. It was a miss. I have changed it to 10 now.


ALSO:
The problem is now that the previously played music does not continue afterwards.
Reply
#8
Hi,

To be able to select a floor / room for adding it to a widget you need to create at least 1 floor and 1 room in Mosaic when you have a LM or in Touch when you have a W4K or SL, then you will be able to add it to a widget.

BR,

Erwin
Reply
#9
(01.02.2020, 22:32)Erwin van der Zwart Wrote: Hi,

To be able to select a floor / room for adding it to a widget you need to create at least 1 floor and 1 room in Mosaic when you have a LM or in Touch when you have a W4K or SL, then you will be able to add it to a widget.

BR,

Erwin


I have created a floor / rooms in Mosaic 3.0.
See the pictures.

But it still doesn't work?

Attached Files Thumbnail(s)
       
Reply
#10
Hi,

I’m not sure that the Sonos app is compatible with Mosaic 3, Schneider version of mosaic is Touch and is not based on version 3, i know we are working on a new version of Touch that is based on version 3.

Perhaps Daniel can eleborate on this...

Can you try to create floor/room in previous version Mosaic?

BR,

Erwin
Reply
#11
>Can you try to create floor/room in previous version Mosaic?

Yes, and its works with Mosaic 2.

BR
Alexander
Reply
#12
Hi. When creating the widget from the Sonos App, it creates some group addresses in the 1/1 / x structure, I need to change them for others since I want to use some internal addresses and structure it to my liking. When I enter the widget parameters I change them but they don't obey. How can i solve it? Thank you
Reply
#13
Hi,

Under Utilities -> General Configuration -> Automatic address range start you can set the start address for automatic generated objects, set it to the desired address range, remove the widget (and objects if needed) and create the widget again, now the objects are created from the scope you have entered.

BR,

Erwin
Reply
#14
(19.02.2020, 19:07)Erwin van der Zwart Wrote: Hi,

Under Utilities -> General Configuration -> Automatic address range start you can set the start address for automatic generated objects, set it to the desired address range, remove the widget (and objects if needed) and create the widget again, now the objects are created from the scope you have entered.

BR,

Erwin
Thanks Erwin, but I would like to use internal group addresses. No possibility to change them?  Huh
Reply


Forum Jump: