first of all to thank you for the answer
i did the follow but do not work
-- Load modules
require('socket.http')
-- Set timout
socket.http.TIMEOUT = 5
-- Set SONOS IP
Sonos_Player_IP = '192.168.1.7'
-- Get event value
value = event.getvalue()
-- Set stepsize volume
Volume_Step = 10
-- Set Action
if value == 101 then
Sonos_Action = 'play'
elseif value == 102 then
Sonos_Action = 'stop'
elseif value == 103 then
Sonos_Action = 'next'
elseif value == 104 then
Sonos_Action = 'previous'
elseif value == 105 then
Sonos_Action = 'mute'
elseif value == 106 then
Sonos_Action = 'unmute'
elseif value == 107 then
Sonos_Action = 'setvolumeup'
Volume_Step = Volume_Step or 10
elseif value == 108 then
Sonos_Action = 'setvolumedown'
Volume_Step = Volume_Step or 10
else
action = 'none'
end
-- Get value for volume
value = event.getvalue() -- 0 to 100 so set object to scale
reply = socket.http.request('http://192.168.1.50/apps/data/sonos/sonos.lp?action=setvolume&ip=
http://192.168.1.7 &volume= 10 ')-- Execute action on value 255 (Feedback)
-- Execute action on value 101 to 106
if value >= 101 and value <= 106 then
local reply = socket.http.request('http://192.168.1.50/apps/data/sonos/sonos.lp?action=play&ip=
http://192.168.1.7 ')
end
-- Execute action on value 107 to 108
if value >= 107 and value <= 108 then
local reply = socket.http.request('http://192.168.1.50/apps/data/sonos/sonos.lp?action=stop&ip=
http://192.168.1.7 ')
end
if value == 255 then
local reply = socket.http.request('http://192.168.1.50/apps/data/sonos/sonos.lp?action=getextendedstate&ip=
http://192.168.1.7 &createbaseimg=true')
reply = json.pdecode(reply)
if reply then
local current_volume = reply[1].volume
local current_mutestate = reply[2].mute
local current_crossfadestate = reply[3].crossfade
local current_playmode = reply[4].playmode
local current_transportmode = reply[5].transport
local current_duration = reply[7].duration
local current_playingtime = reply[8].playingtime
local current_title = reply[9].tracktitle
local current_artist = reply[10].creator
local current_album = reply[11].album
local current_albumart = reply[12].albumart
local current_mediatype = reply[11].mediatype
end
end