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)
Содержание LogicMachine3 Re:actor
Страница 10: ...10 Terminal connection schemes KNX TP...
Страница 12: ...12 24V power supply...
Страница 13: ...13 Analog inputs e g reed contact...
Страница 14: ...14 Analog inputs 0 10V...
Страница 15: ...15 Digital output...
Страница 16: ...16 Resistive sensor input...
Страница 17: ...17 Analog output...
Страница 26: ...26 Make sure that bus status is Online press button in ETS...
Страница 35: ...35 o Then minimize side bar by pressing on left arrow icon to make the map more visible...
Страница 83: ...83 66 if err then 67 alert FTP upload failed s err 68 end...
Страница 107: ...107...
Страница 108: ...108 1 14 Help Documentation for scripting syntaxes is displayed in Help tab...
Страница 122: ...122 4 16 Running processes System running processes can be seen in Status Running processes window...
Страница 126: ...126 Datapoints can be shown also in a way of table which can be later exported as CSV file...
Страница 141: ...141...