135
ac.stat = stat
grp.write(ac.addrstat, stat, dt.bool)
end
-- operation mode
mode = readbyte( 8)
if type(mode) == 'number' and ac.mode ~= mode then
ac.mode = mode
-- send proper value to knx
if 1 <= mode && mode <= 5 then
grp.write(ac.addrmode, mode - 1, dt.uint8)
end
end
-- fan speed
speed = readbyte( 16)
if type(speed) == 'number' and ac.speed ~= speed then
ac.speed = speed
-- send proper value to knx
if 2 <= mode && mode <= 7 then
grp.write(ac.addrspeed, speed - 2, dt.uint8)
end
end
-- temperature
offset = (id - 1) * 156 + 1
temp = readinputregisters(offset)
if type(temp) == 'number' and ac.temp ~= temp then
ac.temp = temp
grp.write(ac.addrtemp, decodetemp(temp), dt.float16)
end
end
-- read command from client
local data = server:receive()
if data then
cmd(data)
end
Common function program
function decodetemp(value)
local hex = lmcore.inttohex(value, 2)
return knxdatatype.decode(hex, dt.float16)
end
function encodetemp(value)
local hex = knxdatatype.encode(value, dt.float16).datahex
return tonumber(hex, 16)
end
-- send request to modbus resident
function accmd(id, cmd, value)
local request, client
require('socket')
-- check if value has been passed
value = value and tonumber(value)
-- create request string
request = string.format('%d:%s', id, cmd:upper())
if value then
request = string.format('%s:%s', request, value)
end
-- send udp packet
socket.udp():sendto(request, '127.0.0.1', 28016)
end
Example: on/off VRF system
value = knxdatatype.decode(event.datahex, dt.bool)
accmd(1, value and 'ON' or 'OFF')
Example: set mode of VRF system
value = knxdatatype.decode(event.datahex, dt.uint8)
accmd(1, 'MODE', value)
Example: set the speed
value = knxdatatype.decode(event.datahex, dt.uint8)
accmd(1, 'SPEED', value)
Example: set the temperature
value = knxdatatype.decode(event.datahex, dt.float16)
accmd(1, 'TEMP', value)
Summary of Contents for LogicMachine3 Re:actor
Page 10: ...10 Terminal connection schemes KNX TP...
Page 12: ...12 24V power supply...
Page 13: ...13 Analog inputs e g reed contact...
Page 14: ...14 Analog inputs 0 10V...
Page 15: ...15 Digital output...
Page 16: ...16 Resistive sensor input...
Page 17: ...17 Analog output...
Page 26: ...26 Make sure that bus status is Online press button in ETS...
Page 35: ...35 o Then minimize side bar by pressing on left arrow icon to make the map more visible...
Page 83: ...83 66 if err then 67 alert FTP upload failed s err 68 end...
Page 107: ...107...
Page 108: ...108 1 14 Help Documentation for scripting syntaxes is displayed in Help tab...
Page 126: ...126 Datapoints can be shown also in a way of table which can be later exported as CSV file...
Page 141: ...141...