Just tested it on my Sonos and it works as it should..
This is the command i used:
Code:
-- Load modules
require('socket.http')
-- Set timout
socket.http.TIMEOUT = 5
-- Start say command - xxx.xxx.xxx.26 = my Sonos and xxx.xxx.xxx.203 = my homeLYnk
socket.http.request('http://127.0.0.1/apps/data/sonos/sonos.lp?action=say&ip=192.168.10.26&audiofile=http://192.168.10.203/user/deurbel.mp3&volume=50&duration=10')
24.09.2017, 08:45 (This post was last modified: 24.09.2017, 09:13 by Mr.D.)
(24.09.2017, 08:18)Erwin van der Zwart Wrote: Hi,
Just tested it on my Sonos and it works as it should..
This is the command i used:
Code:
-- Load modules
require('socket.http')
-- Set timout
socket.http.TIMEOUT = 5
-- Start say command - xxx.xxx.xxx.26 = my Sonos and xxx.xxx.xxx.203 = my homeLYnk
socket.http.request('http://127.0.0.1/apps/data/sonos/sonos.lp?action=say&ip=192.168.10.26&audiofile=http://192.168.10.203/user/deurbel.mp3&volume=50&duration=10')
BR,
Erwin
Thanks Erwin,
I have been using the same code as you but it does not work. Tried again, but this time increasing the duration time.... and that seem to have some effect.
socket.http.request('http://10.0.1.51/apps/data/sonos/sonos.lp?action=sayall&audiofile=http://10.0.1.51/user/doorbell.mp3&volume=30&duration=5') Changed duration to 30 made a difference...
Since the change in code i am (as mentioned before) experiencing a lag when loading a file from local source in the spacelynk. I have tried to use the sayall function together with loading a playlist instead, but I just can't get the command correct (keep getting false as a return value). This is the code I am using....
24.09.2017, 09:27 (This post was last modified: 24.09.2017, 09:28 by Mr.D.)
Hi,
Nice to know
Just a quick question.
When you run your command. Does the Sonos speakers play straight away, or does it take some time before the Sonos players are grouped and the sound actually starts to play?
For my part it takes about 17 seconds from sending the command, and until there is any sound.... thus keeping a duration time of 10 seconds is not possible since it terminates before any sound has been created....
The only thing that is happening is that the current track and play + volume state is stored, the audiofile is loaded and played, and after playingtime is passed the current track is loaded again and play state + volume gets restored as before say command. There is no grouping as those are already known in the system
In my original version it was pretty fast but latest versions are done by our development and not myself.
Your right, there is no grouping
I would say that it was WAY faster when your version was running.
Hopefully they will fix the lag. I use this for my doorbell and from somebody pushes the doorbell and until we hear something it has already gone 20 seconds.... and if we are a bit slow to respond, the guys outside are "gone" by the time we get to the front door hahaha
I've got a problem getting feedback from my Sonos speakers to my homelynk (FW 2.0.1).
I took the script from the end of page 4 of this thread, pasted it into costom java script and adjusted plan ID's and IP's, inserted the visualisation example from page 3 to test it.
The feedback does not work at all. In the app (Version 20170825) it is working perfectly, commands from KNX adresses via lua scripts are working too.
If I try to get feedback from the lua script on page 1 by sending value 255, it is also not working (i get the error message "User script:82: attempt to index a nil value stack traceback: User script:82: in main chunk").
Is this an authentification problem?
Do I have to put credentials into this script?
Has anything changed in commands or paths so it has to be changed in the script too?
Has anyone similar problems?
Development changed the feedback from polling to Sonos event services, it could be they removed the command to fetch (poll) the feedback as it was no longer needed..
function FormattedTimeToSeconds(formattedtime) {
var a = formattedtime.split(':'); // split it at the colons
// minutes are worth 60 seconds. Hours are worth 60 minutes.
var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);
return seconds;
}
var passed = 0;
var durationseconds = FormattedTimeToSeconds(res_parsed.TrackDuration);
var playingtimeseconds = FormattedTimeToSeconds(res_parsed.PlayingTime)
if (durationseconds > playingtimeseconds){
passed = durationseconds - (durationseconds - playingtimeseconds);
passed = Math.floor(((passed / durationseconds) * 100) * 4); // set to * x for each 100px
} else {
passed = 0;
}
$("#plan-" + currentPlanId).find(".playprogress").css("min-width", "0px", 'important');
$("#plan-" + currentPlanId).find(".playprogress").css("height", "15px", 'important');
$("#plan-" + currentPlanId).find(".playprogress").css("border-radius", "0px", 'important');
$("#plan-" + currentPlanId).find(".playprogress").css("max-width", passed + "px", 'important');
$("#plan-" + currentPlanId).find(".playprogress").css("width", passed + "px");
}
}
); }; }, 1000);
});
25.10.2017, 13:28 (This post was last modified: 25.10.2017, 13:31 by Erwin van der Zwart.)
Hi,
You can't call clear the queue separate, the command is internal available when switching between lists, but there is no way to trigger it from the API at this moment.
If you really need it, you could use this as script command to upnpcmd instead:
Code:
function upnpavcmd(host, port, cmd, param)
local client, soap, reqs, service, res, err
-- try connecting to upnp endpoint
res, err = client:connect(host, port)
if not res then
return nil, err
end
-- guess service name based on command
if cmd =='SetGroupVolume' or cmd == 'SetGroupMute' or cmd == 'SnapshotGroupVolume' then
service = 'GroupRenderingControl'
elseif cmd == 'SetVolume' or cmd == 'GetVolume' or cmd == 'SetMute' or cmd == 'GetMute' then
service = 'RenderingControl'
else
service = 'AVTransport'
end
25.10.2017, 13:55 (This post was last modified: 25.10.2017, 14:20 by John94.)
(25.10.2017, 13:28)Erwin van der Zwart Wrote: Γεια σας,
Δεν μπορείτε να καλέσετε σαφή την ουρά ξεχωριστά, η εντολή είναι εσωτερική διαθέσιμη κατά την εναλλαγή μεταξύ των λιστών, αλλά δεν υπάρχει τρόπος να ενεργοποιηθεί από το API αυτή τη στιγμή.
Εάν το χρειάζεστε πραγματικά, θα μπορούσατε να το χρησιμοποιήσετε ως εντολή σεναρίου για upnpcmd αντί: BR, Erwin
Code:
function upnpavcmd(host, port, cmd, param)
local client, soap, reqs, service, res, err
-- try connecting to upnp endpoint
res, err = client:connect(host, port)
if not res then
return nil, err
end
-- guess service name based on command
if cmd =='SetGroupVolume' or cmd == 'SetGroupMute' or cmd == 'SnapshotGroupVolume' then
service = 'GroupRenderingControl'
elseif cmd == 'SetVolume' or cmd == 'GetVolume' or cmd == 'SetMute' or cmd == 'GetMute' then
service = 'RenderingControl'
else
service = 'AVTransport'
end