27.05.2020, 11:21
(01.08.2019, 05:20)thomasoppida Wrote: Hi,
I am struggling a bit with the Sonos integration using the old api.
I have a Homelynk with fw 2.3.0 and Sonos with 10.3
Everything I create returns this error, but different line number. Is there something wrong with my script?
kind regards,
Thomas Elvrum Lassen
Hi
I am struggling with this function as well. It did work earlier, but now it is no longer working properly.
When I run the script, I want a mp3-file in the LM to play on a certain sonos player. If the player was already playing something, it should return to that after teh mp3 is done. This was working.
What is happening now is that if there is no ongoing songs, the mp3 is played and the reply from the function is 'true'. But if something is playing, I get the following error:
'Error in /www/user/sonos.lua at line 0: attempt to get length of a nil value'
The code (sorry for messy code, as I am still in test-mode):
Quote:Code:require('socket.http')
socket.http.timeout = 5
socket.http.request('http://127.0.0.1/user/sonos.lp?action=getsonosdata')
--socket.http.request('http://127.0.0.1/apps/data/sonos/sonos.lp?action=refreshsonosdata')
require('custom.sonos.lib')
PlayerID = 'RINCON_347E5C3B47D801400' --Kontor
--PlayerID = 'RINCON_347E5C35715E01400' --Stue
audiofile = socket.url.escape('http://192.168.39.10/user/Ringeklokke.mp3')
reply = socket.http.request('http://admin:PASSWORD@127.0.0.1/user/sonos.lp?action=say&uuid=' .. PlayerID .. '&audiofile=' .. audiofile .. '&volume=10&duration=10')
log(reply)
There are 10 kinds of people in the world; those who can read binary and those who don't