global_data and matchrule
Posted: Tuesday 01 January 2019 20:33
Hi All,
I want add some match rules into my global_data:
I tried follow to add them:
and in my script tried to use:
Changed some thing as well, but what i do i cant let it work.
Reason i want use helpers in a IF statement is when i need change the dates (and it will if my partner complain about the light color etc) then i only need them to change in global_data and all the script that use the helpers will automatic use the new value...
I want add some match rules into my global_data:
Code: Select all
domoticz.time.matchesRule 'on 01/12-05/01'
domoticz.time.matchesRule 'on 23/10-4/11'
domoticz.time.matchesRule 'on 11/05,19/08'Code: Select all
xmas = function(domoticz)
domoticz.time.matchesRule 'on 01/12-05/01'
end,
halloween = function(domoticz)
domoticz.time.matchesRule 'on 23/10-4/11'
end,
bday = function(domoticz)
domoticz.time.matchesRule 'on 11/05,19/08'
end,Code: Select all
-- HALLOWEEN
if (domoticz.devices(TEST).active) then
if (domoticz.helpers.halloween(domoticz)) then
domoticz.helpers.RGB(domoticz,BulbDressoirAll,100,'Blue',nil)
-- X-MAS
elseif (domoticz.helpers.xmas(domoticz)) then
domoticz.helpers.RGB(domoticz,BulbDressoirAll,100,'White',nil)
-- REST VAN JAAR
else
domoticz.helpers.Kelvin(domoticz,BulbDressoirAll,nil,4000,nil)
end
else
domoticz.helpers.TurnOff(domoticz,BulbDressoirAll,nil,nil)
endReason i want use helpers in a IF statement is when i need change the dates (and it will if my partner complain about the light color etc) then i only need them to change in global_data and all the script that use the helpers will automatic use the new value...