Erwin,
Sorry, I've understood something else. Thanks for the reminder!
Ok, so the code that works (and has been tested by me) is the one from below:
Note that I have replaced the default 102 "stop" value with 0, because this value is sent all the time when I turn off everything.
Andreas
Sorry, I've understood something else. Thanks for the reminder!
Ok, so the code that works (and has been tested by me) is the one from below:
Code:
-- Load modules
require('json')
require('socket.http')
-- Set timout
socket.http.TIMEOUT = 5
-- Set SONOS ip
Sonos_Player1_ip = '10.20.30.20'
Sonos_Player2_ip = '10.20.30.30'
Sonos_Player3_ip = '10.20.30.40'
Sonos_Player4_ip = '10.20.30.50'
-- Get event value
value = event.getvalue()
-- Set stepsize volume
Volume_Step = 5
-- Set Action
if value == 0 then
Sonos_Action = 'stop'
else
action = 'none'
end
-- Execute action on value 0 to 106
if value >= 0 and value <= 106 then
local reply = socket.http.request('http://user:password@127.0.0.1/apps/data/sonos/sonos.lp?action=' .. Sonos_Action .. '&ip=' .. Sonos_Player1_ip .. '')
end
-- Execute action on value 0 to 106
if value >= 0 and value <= 106 then
local reply = socket.http.request('http://user:password@127.0.0.1/apps/data/sonos/sonos.lp?action=' .. Sonos_Action .. '&ip=' .. Sonos_Player2_ip .. '')
end
-- Execute action on value 0 to 106
if value >= 0 and value <= 106 then
local reply = socket.http.request('http://user:password@127.0.0.1/apps/data/sonos/sonos.lp?action=' .. Sonos_Action .. '&ip=' .. Sonos_Player3_ip .. '')
end
-- Execute action on value 0 to 106
if value >= 0 and value <= 106 then
local reply = socket.http.request('http://user:password@127.0.0.1/apps/data/sonos/sonos.lp?action=' .. Sonos_Action .. '&ip=' .. Sonos_Player4_ip .. '')
end
Note that I have replaced the default 102 "stop" value with 0, because this value is sent all the time when I turn off everything.
Andreas