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 app
hi i would like to play a mp3 from ftp, i use that :
audiofile = socket.url.escape('ftp://apps:sonos123@192.168.1.50/user/Meditation-bell-sound.mp3')
socket.http.request('http://admin:sonos123@192.168.1.50/apps/data/sonos/sonos.lp?action=say&ip=192.168.1.6&audiofile=user/Meditation-bell-sound.mp3&volume=30&duration=20') 
log(reply)
192.168.1.50 ip homelynk
192.168.1.6 ip sonos
but did not work....
can you help me
Thank you in advance
Reply
Hi,

Try changing ftp into http and use a valid user like admin:password@ or use credentials from a created user. FTP will nor work for Sonos.

Test first from browser if http://admin:password@192.168.1.50/user/...lename.mp3 does work then use this url in the command you already have.

BR,

Erwin
Reply
in the url i have that with http

here i have upload the mp3
Reply
Hi,

This is good, file is reachable, have you tried this combined with the sonos say command URL?

BR,

Erwin
Reply
hi

i tried and this but nothing
-- Load modules
require('socket.http')

-- Set timout
socket.http.TIMEOUT = 5

socket.http.request('http://admin:sonos123@192.168.1.50/apps/data/sonos/sonos.lp?action=say&ip=192.168.1.6&audiofile=http:admin:sonos123@192.168.1.50/user/Meditation-bell-sound.mp3.mp3&volume=50&duration=10')
log(reply)
Reply
Hi,

You are missing // after http: and the filename has .mp3 extention twice.

BR,

Erwin
Reply
hi
badly does not work
-- Load modules
require('socket.http')

-- Set timout
socket.http.TIMEOUT = 5
socket.http.request('http://admin:sonos123@192.168.1.50/apps/data/sonos/sonos.lp?action=say&ip=192.168.1.8&audiofile=http://admin:sonos123@192.168.1.50/user/Meditation-bell-sound.mp3&volume=50&duration=10')
in the current logs i have : Event for track (32/1/2) 06.04.2018 01:13:13
* nil
thanks
Reply
You must escape the audio file parameter:
Code:
require('socket.url')
require('socket.http')

file = socket.url.escape('http://admin:sonos123@192.168.1.50/user/Meditation-bell-sound.mp3')
socket.http.TIMEOUT = 5
reply = socket.http.request('http://admin:sonos123@127.0.0.1/apps/data/sonos/sonos.lp?action=say&ip=192.168.1.6&audiofile=' .. file .. '&volume=50&duration=10')
log(reply)
Reply
goodmorning
thanks for the help it working!
Reply
Hi
I have some more info about new sonos API.
Sonos started some time ago new partner program and they created new API which is shared only with its partners. Sonos is even generating special key for each device which want to integrate with those players.  Sonos will be testing and validating each 3rd party integration. Apparently this was started some times ago 2016 or something like that. Only partners were notified about this. New API will sill use upnp for discovery with some extended code. For the communication websocket will be used instead SOAP like now.  This means complete rewrite of app.  
It is not clear for me till when the old open API will be supported. At this moment each player support both.  I heard from one source(not sure if valid) that open API will be blocked in 2-3 months from now.
SE is the owner of the sonos app and they started to work on implementation of the new API but it will take some time plus the verification.
BR
------------------------------
Ctrl+F5
Reply
Balatis,
When running the script and loading the mp3 file, do you experience any lagg? I am doing the same as you, but from the time I enter the http command, and until it actually plays the file it takes more then 20-25 seconds.
What is your experience?

The lagg is driving me CRAZY!! Someone PLEASE HELP! Smile
BR,
Mr.D
Reply
(04.05.2018, 09:35)Mr.D Wrote: Balatis,
When running the script and loading the mp3 file, do you experience any lagg? I am doing the same as you, but from the time I enter the http command, and until it actually plays the file it takes more then 20-25 seconds.
What is your experience?

The lagg is driving me CRAZY!! Someone PLEASE HELP! Smile
hi
i have same problem a delay 20sec
Reply
Hi,

Currently the Sonos app is being re-written due to the new Sonos API. Let's wait if the problem is gone in that version..

BR,

Erwin
Reply
Hi Erwin,

Do you know what timeframe we are talking about?
I am using this function as a doorbell, but due to the lag it is not working all that good (people tend to believe we are not home, and leave before the doorbell rings and we get to open the door... hahaha).
BR,
Mr.D
Reply
Hi,

No idea, need to ask this..

BR,

Erwin
Reply
Hi,

How is it possible to change audio source to line-in (SONOS:AMP) with one command
and then play some radio from Tune-in with another command?
Reply
Hi,

Selecting line-in is not included in the Sonos app API, it should be possible with upnpcmd function.

BR,

Erwin
Reply
Hi, browsed available api calls for SONOS app, but could not find any to control balance - i.e. change volume for  Left channel say to 0 and for Right channel say to 50.
Could you advice?

Thanks a lot!
Reply
Hi,

Not implemented at this moment

BR,

Erwin
Reply
(23.07.2018, 10:26)Erwin van der Zwart Wrote: Hi,

Not implemented at this moment

BR,

Erwin

Found out myself, seems to be easy:
upnpavcmd('192.168.1.126', 1400, 'SetVolume', '<Channel>LF</Channel><DesiredVolume>0</DesiredVolume>')
upnpavcmd('192.168.1.126', 1400, 'SetVolume', '<Channel>RF</Channel><DesiredVolume>100</DesiredVolume>')

Smile
Reply


Forum Jump: