resetTempAcc()
tctarget = tonumber(m) or tctarget
-- don't stop driving now, let the poller logic handle that
- elseif t == mqttModeTopic then
+ elseif t == mqttModeTopic and tcmode ~= m then
if driving then stopFan() end
driving = false -- stop driving now, since the mode differs!
resetTempAcc()
end
-- Vote to engage or stay on
- if t == nil then verr = verr + 1
+ if t == nil then verr = verr + 1
elseif tcmode == "cool" and t > thresh then vnum = vnum + 1
elseif tcmode == "heat" and t < thresh then vnum = vnum + 1
elseif tcmode == "emht" and t < thresh then vnum = vnum + 1
mqc:publish(mqttPubRoot.."zz",
sjson.encode({ ['m']=m, ['r']=r, ['h']=node.heap(),
['f']=tempAccFan, ['ft']=(fanOffDelayTMR ~= nil),
- ['c']=vdenom, ['v']=vnum, ['e']=verr }),
+ ['c']=vdenom, ['v']=vnum, ['e']=verr,
+ ['mo']=tcmode, ['ta'] = tctarget }),
1,1)
end