24.02.2017, 09:04
(23.02.2017, 23:05)Erwin van der Zwart Wrote: Hi Josep,
You can get feedback info from Sonos App API by using this:
Code:-- Load modules require('socket.http') require('json') -- Set timout socket.http.TIMEOUT = 5 -- Set SONOS IP Sonos_Player_IP = '192.168.10.26' reply = socket.http.request('http://127.0.0.1/apps/data/sonos/sonos.lp?action=getextendedstate&ip=' .. Sonos_Player_IP) -- Set SONOS Name --Sonos_Player_Name = 'Woonkamer' --reply = socket.http.request('http://127.0.0.1/apps/data/sonos/sonos.lp?action=getextendedstate&name=' .. Sonos_Player_Name) -- Get values from result table replytable = json.pdecode(reply) volume = replytable[1].volume or 0 mute = replytable[2].mute or 0 crossfade = replytable[3].crossfade or 0 playmode = replytable[4].playmode or '' transport = replytable[5].transport or '' trackuri = replytable[6].trackuri or '' duration = replytable[7].duration or '' playingtime = replytable[8].playingtime or '' tracktitle = replytable[9].tracktitle or '' creator = replytable[10].creator or '' album = replytable[11].album or '' albumart = replytable[12].albumart or '' mediatype = replytable[13].mediatype or '' trackuri = replytable[14].trackuri or '' trackurimetadata = replytable[15].trackurimetadata or '' albumartbase64 = replytable[16].albumartbase64 or '' sonosplayerip = replytable[17].sonosplayerip or '' -- Update objects grp.update('1/1/5', volume)
There are 2 methodes in this sample, 1 by Player IP and 1 by Player name, you can pick 1 of them..
BR,
Erwin
Hi Erwin,
I have two questions about this,
1.- How Can I read feedback cyclically without overload the LM CPU, for example I try to use a ciclally scrip to 1s to view play time in real time and this freeze the LM CPU
2.- How can I use the album Art URL into group address to use into visualization.
THX very much.