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
#5
Hi,

You added the name dining as a variable in the URL so that will never work..

Try this first so you have a working sample, from there you can expand the script:
Code:
-- Load modules
require('socket.http')

-- Set timout
socket.http.TIMEOUT = 5

-- Set SONOS name
Sonos_Player_Name = 'dining'  -- Is this written exactly as you see in the Sonos App without capital etc?

-- 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&name=' .. Sonos_Player_Name .. '&volume=' .. value .. '')
or by IP (i prever name as IP is DHCP and can change, name will never change automaticly)
Code:
-- Load modules
require('socket.http')

-- Set timout
socket.http.TIMEOUT = 5

-- Set SONOS IP
Sonos_Player_IP = '192.168.1.7'

-- 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=' .. Sonos_Player_IP .. '&volume=' .. value .. '')

PS: Be sure to have opened the Sonos app at least once so the players are scanned and listed in the controller with name and IP before using this script

BR,

Erwin
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: