Attempting to control some electric floor heating using a room thermostat a “Secure SRT321” controlling a “Fibaro single switch 2”.
It’s simple and it works….. But only if I press “start” on the debug screen it does one run and then doesn’t react until I press “start” again.
I’ve been experimenting with:
- while true do
And
- do
- until
Didn’t make any difference, so hope I’m just making a stupid mistake and someone can help me.
Here’s the script:
--[[
%% autostart
%% properties
%% weather
%% events
%% globals
--]]
if (fibaro:countScenes()>1) then
fibaro:debug('Kill the second scene!');
fibaro:abort();
end
local wk_room = 6 -- Actuele temperatuur
local wk_set = 5 -- Gewenste temperatuur
local heating = 51 -- Vloer verwarming
local wk_room = tonumber(fibaro:getValue(wk_room, "value")); -- Actuele temperatuur woonkamer
local wk_set = tonumber(fibaro:getValue(wk_set, "value")); -- Gewenste temperatuur woonkamer
fibaro:debug('Woonkamer actuele temperatuur: ' ..wk_room); -- print actuele temperatuur woonkamer
fibaro:debug('Woonkamer gewenste temperatuur: ' ..wk_set); -- print gewenste temperatuur woonkamer
local wk_diff = wk_set - wk_room
fibaro:debug('Verschil in temperatuur woonkamer: ' ..wk_diff);
if (wk_diff >= 2)
then
fibaro:call(heating, "turnOn")
fibaro:debug('er is warmtevraag ');
else
fibaro:call(heating, "turnOff")
fibaro:debug('er is geen warmtevraag ');
end
Help,
Gary