From: Nathaniel Wesley Filardo Date: Thu, 14 Dec 2017 21:19:29 +0000 (-0500) Subject: Misc fixes and tweaks X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;ds=sidebyside;p=acmetensortoys-esp-lua_thermostat Misc fixes and tweaks --- diff --git a/thermostat.lua b/thermostat.lua index ccc1c0e..17c1693 100644 --- a/thermostat.lua +++ b/thermostat.lua @@ -103,7 +103,7 @@ nwfnet.onmqtt["th"] = function(c,t,m) 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() @@ -166,7 +166,7 @@ local function therm_res(t) 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 @@ -204,7 +204,8 @@ local function therm_res(t) 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