Here's mine:
Code: Select all
IIF = function(condition, trueValue, falseValue)
if condition then
return trueValue
else
return falseValue
end
end,
To call the function (example)
Code: Select all
domoticz.helpers.IIF(mySwitch.state == 'On', otherSwitch.switchOn(),otherSwitch.switchOff() )
There is a quick sleep(seconds) function as well:
Code: Select all
sleep = function(seconds)
os.execute("sleep " .. tonumber(seconds))
end,
Code: Select all
domoticz.helpers.sleep(3)
The log displays
Code: Select all
Finished Test Script after >7 seconds. (using 0.040 seconds CPU time !)