Squeezebox + KNX - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2) +--- Thread: Squeezebox + KNX (/showthread.php?tid=120) |
Squeezebox + KNX - managementboy - 30.10.2015 Hi, does someone control their squeezbox (logitech media server) using the Logic Machine? I have found that openHAB does do this... maybe there is a direct way of doing this? RE: Squeezebox + KNX - Erwin van der Zwart - 01.11.2015 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/content/54/95/fr/api-logitech-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) tcpettimeout(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" tcpend(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/files/cli-api_7.6.htm Explore those 2 and you can control your device (: BR, Erwin van der Zwart RE: Squeezebox + KNX - managementboy - 20.01.2016 Thanks Erwin! here a short function to send commands to your squeezebox players. I have added them to a user library. Code: --Functions for Logitech Media Server integration and this is an example for an object turning on or off the player Code: require('user.squeezebox') |