However, I've set up my main service to update every 24 hours, but it's now running every 5 seconds.
Could I have made a mistake somewhere?
The code i used:
Code: Select all
week = tonumber (os.date( "%V"))
dag = tostring(os.date("%a"));
status = tonumber(otherdevices_svalues['Afval'])
print('script bin_selector executed')
commandArray = {}
print ('Dag= '..dag)
if (dag=='Sat' or dag=='Sun' ) then
weekend = true; weekdag = false
end
if (dag=='Mon' or dag=='Tue' or dag=='Wed' or dag=='Thu' or dag=='Fri') then
weekend = false ; weekdag = true
end
--Bepalen morgen rest
if(week==39 and dag=='Sun' or week==41 and dag=='Sun' or week==43 and dag=='Sun' or week==45 and dag=='Sun' or week==47 and dag=='Sun' or week==49 and dag=='Sun' or week==51 and dag=='Sun') then
morgenrest = true; rest = false; morgengft = false; gft = false; morgenpapier = false; papier = false; plastic = false; niets = false
print ('morgen grijze container')
end
--Bepalen rest
if(week==39 and dag=='Mon' or week==41 and dag=='Mon' or week==43 and dag=='Mon' or week==45 and dag=='Mon' or week==47 and dag=='Mon' or week==49 and dag=='Mon' or week==51 and dag=='Mon') then
morgenrest = false; rest = true; morgengft = false; gft = false; morgenpapier = false; papier = false; plastic = false; niets = false
print ('vandaag grijze container')
end
--Bepalen morgen gft
if(week==40 and dag=='Sun' or week==42 and dag=='Sun' or week==44 and dag=='Sun' or week==46 and dag=='Sun' or week==48 and dag=='Sun' or week==50 and dag=='Sun' or week==51 and dag=='Fri') then
morgenrest = false; rest = false; morgengft = true; gft = false; morgenpapier = false; papier = false; plastic = false; niets = false
print ('morgen groene container')
end
--Bepalen gft
if(week==40 and dag=='Mon' or week==42 and dag=='Mon' or week==44 and dag=='Mon' or week==46 and dag=='Mon' or week==48 and dag=='Mon' or week==50 and dag=='Mon' or week==51 and dag=='Sat') then
morgenrest = false; rest = false; morgengft = false; gft = true; morgenpapier = false; papier = false; plastic = false; niets = false
print ('vandaag groene container')
end
if (morgenrest and weekend and dag) then
commandArray ['UpdateDevice']= '19|1|Morgen Grijze container'
end
if (rest and weekdag and dag) or (rest and weekend and dag) then
commandArray ['UpdateDevice']= '19|1|Vandaag Grijze container'
end
if (morgengft and weekend and dag) then
commandArray ['UpdateDevice']= '19|1|Morgen Groene container'
end
if (gft and weekdag and dag) then
commandArray ['UpdateDevice']= '19|1|Vandaag Groene container'
end
return commandArray