As I anounced already, I want to explore a simple main control scene. The main goal is to have as few scenes as possible that run continously ('autostart') to improve overview and avoid contradictions and racing conditions. Because it is meant as an exploration I will keep it very simple. At some time I will probably join either the @Sankotronic stream or the @jgab event model. They are far beyond my experience on this platform for this moment. And too complex for me as a beginner also.
I already presented my time calculation model, based on integers from 0 to 2359, with two very simple functions to work with decimal hours (7+1.5 -> 830) and timesteps 759+5 -> 804.
One thing I learned from the last month or so was "zwave freeze". Causes can be multiple, but one of them certainly may be poor programming practices.
Therefore I want to fire fibaro calls at low speed and log them when needed.
local testmode=true
function deviceCall(deviceID,value1,value2)
if (value2 == nil)
then
fibaro:call(deviceID,value1);
log(fibaro:getName(deviceID)..': '..value1)
else
fibaro:call(deviceID,value1,value2);
log(fibaro:getName(deviceID)..': '..value1..'='..value2)
end
fibaro:sleep(1000)
end
function switchOff(deviceID)
deviceCall(deviceID, "turnOff");
end
function log(AMessage)
if testmode
then
fibaro:debug(AMessage)
end
end
The deviceCall function can handle most of the commands at a beginners level anyway, so fine for now. A built-in sleep certifies a low pace. It checks testmode on the log funtion. Without testmode no logging.