Om de ketel intelligent aan en uit te schakelen heb je de volgende code nodig:
--[[
%% properties
%% autostart
%% events
%% globals
--]]
local heatsetids={30,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48}
-- de id's van alle set-scenes van de Danfoss Radiatorkoppen
local nestDevice=196
local ketelHeating=0
while true do
fibaro:debug("Running scene at: "..os.date())
local setp=tonumber(fibaro:getValue(nestDevice,"ui.settemp.value"))
local curlivtmp=tonumber(fibaro:getValue(nestDevice,"ui.curtemp.value"))
fibaro:debug("SetPoint: "..setp.." - Current: "..curlivtmp)
if (setp>curlivtmp) then
ketelHeating=1
else
ketelHeating=0
end
fibaro:setGlobal("G_KetelWarmte",0)
for i=1,#heatsetids do
fibaro:startScene(heatsetids[i])
end
fibaro:sleep(10*1000)
if (tonumber(fibaro:getGlobalValue("G_KetelWarmte"))==1) then
fibaro:debug("Outcome: G_Ketelwarmte=1")
if (ketelHeating==1) then
if (setp>curlivtmp) then
fibaro:debug("Boiler Heat requested - boiler still active")
else
fibaro:debug("Boiler Heat requested - boiler still active - updating temp")
fibaro:call(nestDevice,"setProperty", "ui.setpoint.value", curlivtmp+1)
end
else
fibaro:call(nestDevice,"setProperty", "ui.setpoint.value", curlivtmp+1)
fibaro:debug("Boiler Heat requested - Activating boiler setting temp to: "..curlivtmp+1)
fibaro:sleep(100)
end
else
fibaro:debug("Outcome: G_Ketelwarmte=0")
if (ketelHeating==0) then
if (setp