This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SONOS
#6
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
Reply


Messages In This Thread
SONOS - by balatis - 23.03.2018, 14:37
RE: SONOS - by balatis - 26.03.2018, 13:45
RE: SONOS - by Erwin van der Zwart - 26.03.2018, 17:20
RE: SONOS - by balatis - 26.03.2018, 19:12
RE: SONOS - by Erwin van der Zwart - 26.03.2018, 21:36
RE: SONOS - by balatis - 27.03.2018, 10:22
RE: SONOS - by admin - 27.03.2018, 11:30
RE: SONOS - by Erwin van der Zwart - 27.03.2018, 11:35
RE: SONOS - by balatis - 27.03.2018, 12:01
RE: SONOS - by admin - 27.03.2018, 12:14
RE: SONOS - by balatis - 27.03.2018, 12:18
RE: SONOS - by admin - 27.03.2018, 12:21
RE: SONOS - by balatis - 27.03.2018, 12:27
RE: SONOS - by admin - 27.03.2018, 12:37
RE: SONOS - by balatis - 27.03.2018, 12:44
RE: SONOS - by admin - 27.03.2018, 13:03
RE: SONOS - by Daniel - 27.03.2018, 13:06
RE: SONOS - by Erwin van der Zwart - 27.03.2018, 13:24
RE: SONOS - by thomasoppida - 15.04.2018, 21:15
RE: SONOS - by Erwin van der Zwart - 16.04.2018, 04:04
RE: SONOS - by thomasoppida - 16.04.2018, 06:32
RE: SONOS - by balatis - 27.03.2018, 13:14

Forum Jump: