Hi,
I´m writing a couple of VERY SIMPLE LUA Scenes that I have linked to Double Click action of a double switch 2.
The scene often works fine, but sometimes, some the turnon or turnoff actions are not executed. (by instance, instead of turning off the 3 lights, only 2 are turnned off, or maybe the vent turnon fails...)
Also tried added sleep between commands but the result is the same. Any idea? This is quite frustrating...
When I run the scen from the debuger interface, it seems that it works properly...
As stated, the code is very simple: (Turn off lights, turn on vent, wait 7 minutes and turn off vent (except if the light were turned on again while the vent is on)
fibaro:call(88, "turnOff"); --light off 1
fibaro:sleep(100);
fibaro:call(93, "turnOff"); --light off 2
fibaro:sleep(100);
fibaro:call(94, "turnOff"); --light off 3
fibaro:sleep(100);
fibaro:call(89, "turnOn"); --this is the vent
fibaro:sleep(420000); -- wait 7 minutes
local bathLightStatus = 0;
bathLightStatus = bathLightStatus + fibaro:getValue(88, 'value');
bathLightStatus = bathLightStatus + fibaro:getValue(93, 'value');
bathLightStatus = bathLightStatus + fibaro:getValue(94, 'value');
-- fibaro:debug('Number of bath lights on: ' .. bathLightStatus);
if ( bathLightStatus == 0)
then
-- fanStatus = fibaro:getValue(89, 'value');
-- fibaro:debug('Fan Status ' .. fanStatus);
fibaro:call(89, "turnOff");
-- fibaro:sleep(1000);
-- fanStatus = fibaro:getValue(89, 'value');
-- fibaro:debug('Fan Status after off ' .. fanStatus);
end