27.03.2018, 13:03
Map this event script to 1-bit object. True/on = play, false/off = stop
Code:
Sonos_Player_IP = '192.168.1.7'
value = event.getvalue()
if value then
action = 'play'
else
action = 'stop'
end
http = require('socket.http')
http.TIMEOUT = 5
reply = http.request('http://sonos:sonos123@127.0.0.1/apps/data/sonos/sonos.lp?action=' .. action .. '&ip=' .. Sonos_Player_IP)