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
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)
To write value from LM to Lutron create event script for setpoint object
to read some data from lutron use next script (resident in my 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
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
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')
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