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.

Squeezebox + KNX
#2
Hi,

There are 2 ways to control it, or by API or by TCP

For API you can use this sample to send HTTP your commands:

require('socket.http')

socket.http.TIMEOUT = 5
ip_logicmachine = '192.168.0.10'
ip_squeezebox = '192.168.0.110'
pause_command = grp.getvalue('1/1/1')

if pause_command == true then
  pause_command = 1
else
  pause_command = 0
end

r, c, h, s = socket.http.request('http://' .. ip_squeezebox .. ':9000/status.html?p0=pause&p1=' .. pause_command .. '&player=' .. ip_logicmachine .. '')

if not r then
  log('No reply')
  return
else
  log®
  --do other actions with reply if needed
end

On this page are the HTTP / API commands for squeezebox explained:

http://tutoriels.domotique-store.fr/cont...-squeezebox-server-_-player-http.html

For TCP you can use this tcp/ip sample to send tcp/ip commands:

-- TCP/Telnet 

--------------------------------------------------------------------------------    
local host, port = "192.168.2.60", 23
local socket = require("socket")
local tcp = assert(socket.tcp())
tcp:connect(host, port)
tcpConfusedettimeout(0.5)

-- Send command as HEX
--command = string.char(0xfe, 0xff, 0xff,) -- You need to put here your correct HEX command
-- Send command as STRING
command = ''PUT_HERE_YOUR_COMMAND"

tcpConfusedend(command .. '\r')

--Get replies from controller
local s, status, partial = tcp:receive()

--Check if reply has a value
if s then
  -- Decode data from HEX if needed
  --decodeddata = lmcore.hextostr(s, string.len(s))
  --log(decodeddata)
  --Do your action(s) with replies
  if s == 'put here your expected reply' then
    -- Do actions
  end 
end
if status then
-- log(status)
end
if partial then
  -- log(partial)
end
tcp:close()

On this page are the tcp/ip commands for squeezebox explained:

https://crestron-squeeze.googlecode.com/...pi_7.6.htm

Explore those 2 and you can control your device (:

BR,

Erwin van der Zwart
Reply


Messages In This Thread
Squeezebox + KNX - by managementboy - 30.10.2015, 17:18
RE: Squeezebox + KNX - by Erwin van der Zwart - 01.11.2015, 18:32
RE: Squeezebox + KNX - by managementboy - 20.01.2016, 15:05

Forum Jump: