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.

LM Lutron telnet listener
#2
some additions for that case
Lutron message parser
For example I shall show you how to receive setpoint temperature from Lutron panel/switch
Let’s write all messages from Lutron to knx group address
Change resident script
Code:
require('user.lutron')
 
tcp, err = lutron_login()
if not tcp then
 log('no connection to device', err)
end
while tcp do
 res, err = lutron_receive(tcp)
 --log(res,err)
   if (res == nil) then
     return
    else
      grp.write('15/1/1', res)
   end
end
From Lutron we receive a lot of messages when we change setpoint
For example, this 4 message we will receive twice, when we will change setpoint:
~HVAC,11,78,26,26 – i dont know what is it
~HVAC,11,18,79,0,0 – setpoint in Fahrenheit
~HVAC,11,19,26,0,0 -- setpoint in Celsius degree
~HVAC,11,10,26,26 -- i dont know what is it
 
Let’s see, what we have in  setpoint in Celsius degree
~HVAC,11,19,26,0,0
~HVAC – status from device
11 – device id, which send this message
19 – type of information (Celsius degree in this example)
26 - Celsius degree
0,0 – some other parameters
To parse this message and write temperature to knx address create event based script for message group address (15/1/1)
Code:
--lutron parser
-- get string
temp = event.getvalue()
-- convert sting to table
temp = string.split(temp, ',')
-- if comand type is ~HVAC let's move forward
if temp[1] == '~HVAC' then
    -- if device id = id of our panel let's move forward
    if temp[2] == '11' then -- be carefull, temp[2] is string, not number
        -- if in message is celsius degree
        if temp[3] == '19' then
            -- convert temperature from string to number
            temp = tonumber(temp[4])
            -- check current value of setpoint, to not to write the same value
            cur_temp = grp.getvalue('lutron_temp_setpoint')
            if temp~=cur_temp then
                -- write walue to temp address
                grp.write('lutron_temp_setpoint', temp)
            end
        end
    end
end
To write value from LM to Lutron create event script for setpoint object

Code:
require('user.lutron')
value = event.getvalue()
-- round setmoint to integer
value = math.floor(value)  
tcp, err = lutron_login()
if not tcp then
 log('no connection to device', err)
end
tcp:send('#HVAC,11,19,'..value..',0,0\r\n')
to read some data from lutron use next script (resident in my case)
Code:
require('user.lutron')

--Подключаемся и делаем запрос
tcp, err = lutron_login()
if not tcp then
 log('no connection to device', err)
else
  -- send some request
 tcp:send('?HVAC,11,15\r\n')
  -- and receive answer
 x = tcp:receive()
  -- log answer, or write it to message address
 log(x)
 tcp:close()
end
Reply


Messages In This Thread
LM Lutron telnet listener - by AEK - 06.10.2016, 13:18
RE: LM Lutron telnet listener - by AEK - 12.10.2016, 12:07
RE: LM Lutron telnet listener - by AEK - 13.10.2016, 06:51
RE: LM Lutron telnet listener - by imprashant - 14.11.2022, 16:13
RE: LM Lutron telnet listener - by admin - 14.11.2022, 16:36
RE: LM Lutron telnet listener - by imprashant - 20.11.2022, 08:13
RE: LM Lutron telnet listener - by admin - 21.11.2022, 08:12
RE: LM Lutron telnet listener - by imprashant - 22.11.2022, 12:05
RE: LM Lutron telnet listener - by admin - 22.11.2022, 12:29
RE: LM Lutron telnet listener - by imprashant - 29.11.2022, 09:50
RE: LM Lutron telnet listener - by admin - 29.11.2022, 10:14
RE: LM Lutron telnet listener - by imprashant - 29.11.2022, 10:24
RE: LM Lutron telnet listener - by admin - 29.11.2022, 10:35
RE: LM Lutron telnet listener - by imprashant - 29.11.2022, 10:49
RE: LM Lutron telnet listener - by admin - 29.11.2022, 11:01
RE: LM Lutron telnet listener - by imprashant - 29.11.2022, 11:14
RE: LM Lutron telnet listener - by admin - 29.11.2022, 11:16
RE: LM Lutron telnet listener - by imprashant - 29.11.2022, 11:31
RE: LM Lutron telnet listener - by imprashant - 20.01.2023, 08:58
RE: LM Lutron telnet listener - by admin - 23.01.2023, 08:09

Forum Jump: