26.03.2018, 21:36
(This post was last modified: 26.03.2018, 21:43 by Erwin van der Zwart.)
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:
or by IP (i prever name as IP is DHCP and can change, name will never change automaticly)
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
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 .. '')
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