Hi all,
I'm new to HC2 having migrated from Domoticz. I've a limited knowledge of LUA and so rely heavily on copy and paste
I am trying to create a scene whereby if any of my heat controllers are calling for heat a fibaro relay will switch on my boiler... and if all off... turn it off again i.e. " if A or B or C = On then set H = On elsif A and B and C = Off then set H = Off"
My attempt at code is as follows
--[[
%% properties
52 operatingMode
62 operatingMode
43 operatingMode
67 operatingMode
7 operatingMode
26 operatingMode
%% weather
%% events
%% globals
--]]
local startSource = fibaro:getSourceTrigger();
if (
( tostring(fibaro:getValue(52, "operatingMode")) == "1" )
or
( tostring(fibaro:getValue(62, "operatingMode")) == "1" )
or
( tostring(fibaro:getValue(43, "operatingMode")) == "1" )
or
( tostring(fibaro:getValue(67, "operatingMode")) == "1" )
or
( tostring(fibaro:getValue(7, "operatingMode")) == "1" )
or
( tostring(fibaro:getValue(26, "operatingMode")) == "1" )
or
startSource["type"] == "other"
)
then
fibaro:call(48, "turnOn");
elseif (
( tostring(fibaro:getValue(52, "operatingMode")) == "0" )
and
( tostring(fibaro:getValue(62, "operatingMode")) == "0" )
and
( tostring(fibaro:getValue(43, "operatingMode")) == "0" )
and
( tostring(fibaro:getValue(67, "operatingMode")) == "0" )
and
( tostring(fibaro:getValue(7, "operatingMode")) == "0" )
and
( tostring(fibaro:getValue(26, "operatingMode")) == "0" )
and
startSource["type"] == "other"
)
then
fibaro:call(48, "turnOff");
end
This appears to run without bugs but just turns the boiler (device 48) on and stays on.
Does anyone have any idea where I am going wrong?
Any help/tips would be greatly appreciated.
Many thanks
Sean