From e0135544cfaa12a0faf0db72a467c4ae4541d365 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Thu, 14 Dec 2017 16:19:29 -0500 Subject: [PATCH] Misc fixes and tweaks --- thermostat.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.50.1