08.04.2020, 01:16
(This post was last modified: 08.04.2020, 01:59 by liangming011.)
I'm just beginning to learn how to write.3/5/37 will only change to Turn off air conditioning when current value of 3/5/37 is 0.1/3/5 is Temperature detection module.The program written above, is to imitate the example of the official website to rewrite, so I would like to ask, if I achieve this function, where do I need to modify to use?
local temp=knxdatatype.decode(event.datahex,dt.float16)
local heat=knxobject.get('address','1/3/5')
local ac=knxobject.get('address','3/5/37')
local heat_on=toboolean(heat.data)
local ac_on=toboolean(ac.data)
--heating off
if not a_on then
--制冷
temp>24 then
grp.write('3/5/37', 1)
--过度季节制冷
elseif temp>15 and temp<24 then
grp.write('3/5/37', 2)
--过度季节制暖
elseif temp>10 and temp<15 then
grp.write('3/5/37', 3)
--制暖
elseif temp<10 and not ac_on then
grp.write('3/5/37', 4)
end
-- object mapped to this event must have its data type set
temp = event.getvalue('1/3/5')
if not a_on==0 then
--制冷
temp>24 then
grp.write('3/5/37', 1)
--过度季节制冷
elseif temp>15 and temp<24 then
grp.write('3/5/37', 2)
--过度季节制暖
elseif temp>10 and temp<15 then
grp.write('3/5/37', 3)
--制暖
elseif temp<10 and not ac_on then
grp.write('3/5/37', 4)
end
-- object mapped to this event must have its data type set
temp = event.getvalue('1/3/5')
if not a_on==0 then
--制冷
temp>24 then
grp.write('3/5/37', 1)
--过度季节制冷
elseif temp>15 and temp<24 then
grp.write('3/5/37', 2)
--过度季节制暖
elseif temp>10 and temp<15 then
grp.write('3/5/37', 3)
--制暖
elseif temp<10 and not ac_on then
grp.write('3/5/37', 4)
end
Two writes, that works?
local temp=knxdatatype.decode(event.datahex,dt.float16)
local heat=knxobject.get('address','1/3/5')
local ac=knxobject.get('address','3/5/37')
local heat_on=toboolean(heat.data)
local ac_on=toboolean(ac.data)
--heating off
if not a_on then
--制冷
temp>24 then
grp.write('3/5/37', 1)
--过度季节制冷
elseif temp>15 and temp<24 then
grp.write('3/5/37', 2)
--过度季节制暖
elseif temp>10 and temp<15 then
grp.write('3/5/37', 3)
--制暖
elseif temp<10 and not ac_on then
grp.write('3/5/37', 4)
end
-- object mapped to this event must have its data type set
temp = event.getvalue('1/3/5')
if not a_on==0 then
--制冷
temp>24 then
grp.write('3/5/37', 1)
--过度季节制冷
elseif temp>15 and temp<24 then
grp.write('3/5/37', 2)
--过度季节制暖
elseif temp>10 and temp<15 then
grp.write('3/5/37', 3)
--制暖
elseif temp<10 and not ac_on then
grp.write('3/5/37', 4)
end
-- object mapped to this event must have its data type set
temp = event.getvalue('1/3/5')
if not a_on==0 then
--制冷
temp>24 then
grp.write('3/5/37', 1)
--过度季节制冷
elseif temp>15 and temp<24 then
grp.write('3/5/37', 2)
--过度季节制暖
elseif temp>10 and temp<15 then
grp.write('3/5/37', 3)
--制暖
elseif temp<10 and not ac_on then
grp.write('3/5/37', 4)
end
Two writes, that works?