Posts: 150
Threads: 27
Joined: May 2017
Reputation:
2
05.04.2018, 17:00
(This post was last modified: 05.04.2018, 18:21 by balatis.)
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
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
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
Posts: 150
Threads: 27
Joined: May 2017
Reputation:
2
05.04.2018, 18:52
(This post was last modified: 05.04.2018, 18:58 by balatis.)
in the url i have that with http
here i have upload the mp3
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
This is good, file is reachable, have you tried this combined with the sonos say command URL?
BR,
Erwin
Posts: 150
Threads: 27
Joined: May 2017
Reputation:
2
05.04.2018, 20:07
(This post was last modified: 05.04.2018, 20:22 by balatis.)
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)
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
You are missing // after http: and the filename has .mp3 extention twice.
BR,
Erwin
Posts: 150
Threads: 27
Joined: May 2017
Reputation:
2
05.04.2018, 22:16
(This post was last modified: 05.04.2018, 22:18 by balatis.)
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
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
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)
Posts: 150
Threads: 27
Joined: May 2017
Reputation:
2
goodmorning
thanks for the help it working!
Posts: 4638
Threads: 24
Joined: Aug 2017
Reputation:
207
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
Posts: 136
Threads: 18
Joined: Apr 2017
Reputation:
1
04.05.2018, 09:35
(This post was last modified: 04.05.2018, 09:44 by Mr.D.)
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!
BR,
Mr.D
Posts: 150
Threads: 27
Joined: May 2017
Reputation:
2
(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! hi
i have same problem a delay 20sec
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
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
Posts: 136
Threads: 18
Joined: Apr 2017
Reputation:
1
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
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
04.05.2018, 12:09
(This post was last modified: 04.05.2018, 12:10 by Erwin van der Zwart.)
Hi,
No idea, need to ask this..
BR,
Erwin
Posts: 113
Threads: 36
Joined: Oct 2016
Reputation:
1
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?
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
Hi,
Selecting line-in is not included in the Sonos app API, it should be possible with upnpcmd function.
BR,
Erwin
Posts: 38
Threads: 11
Joined: Jul 2017
Reputation:
0
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!
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
23.07.2018, 10:26
(This post was last modified: 23.07.2018, 10:27 by Erwin van der Zwart.)
Hi,
Not implemented at this moment
BR,
Erwin
Posts: 38
Threads: 11
Joined: Jul 2017
Reputation:
0
(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>')
|