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 papier
if(week==2 and dag=='Wed' or week==4 and dag=='Wed' or week==6 and dag=='Wed' or week==8 and dag=='Wed' or week==10 and dag=='Wed' or week==12 and dag=='Wed' or week==14 and dag=='Wed' or week==16 and dag=='Wed' or week==18 and dag=='Wed' or week==20 and dag=='Wed' or week==22 and dag=='Wed' or week==24 and dag=='Wed' or week==26 and dag=='Wed' or week==28 and dag=='Wed'
or week==30 and dag=='Wed' or week==32 and dag=='Wed' or week==34 and dag=='Wed' or week==36 and dag=='Wed' or week==38 and dag=='Wed' or week==40 and dag=='Wed' or week==42 and dag=='Wed' or week==44 and dag=='Wed' or week==46 and dag=='Wed' or week==48 and dag=='Wed' or week==50 and dag=='Wed' or week==52 and dag=='Wed') then
morgenpapier = true; papier = false; plastic = false; niets = false
print ('morgen papier')
end
--Bepalen papier
if(week==2 and dag=='Thu' or week==4 and dag=='Thu' or week==6 and dag=='Thu' or week==8 and dag=='Thu' or week==10 and dag=='Thu' or week==12 and dag=='Thu' or week==14 and dag=='Thu' or week==16 and dag=='Thu' or week==18 and dag=='Thu' or week==20 and dag=='Thu' or week==22 and dag=='Thu' or week==24 and dag=='Thu' or week==26 and dag=='Thu' or week==28 and dag=='Thu'
or week==30 and dag=='Thu' or week==32 and dag=='Thu' or week==34 and dag=='Thu' or week==36 and dag=='Thu' or week==38 and dag=='Thu' or week==40 and dag=='Thu' or week==42 and dag=='Thu' or week==44 and dag=='Thu' or week==46 and dag=='Thu' or week==48 and dag=='Thu' or week==50 and dag=='Thu' or week==52 and dag=='Thu') then
morgenpapier = false; papier = true; plastic = false; niets = false
print ('vandaag papier morgen plastic')
end
--Bepalen plastic
if(week==2 and dag=='Fri' or week==4 and dag=='Fri' or week==6 and dag=='Fri' or week==8 and dag=='Fri' or week==10 and dag=='Fri' or week==12 and dag=='Fri' or week==14 and dag=='Fri' or week==16 and dag=='Fri' or week==18 and dag=='Fri' or week==20 and dag=='Fri' or week==22 and dag=='Fri' or week==24 and dag=='Fri' or week==26 and dag=='Fri' or week==28 and dag=='Fri'
or week==30 and dag=='Fri' or week==32 and dag=='Fri' or week==34 and dag=='Fri' or week==36 and dag=='Fri' or week==38 and dag=='Fri' or week==40 and dag=='Fri' or week==42 and dag=='Fri' or week==44 and dag=='Fri' or week==46 and dag=='Fri' or week==48 and dag=='Fri' or week==50 and dag=='Fri' or week==52 and dag=='Fri') then
morgenpapier = false; papier = false; plastic = true; niets = false
print ('vandaag plastic')
end
--Bepalen geen plastic en geen papier
if(dag=='Mon' or dag=='Tue' or dag=='Sat' or dag=='Sun') then
morgenpapier = false; papier = false; plastic = false; niets = true
print ('vandaag geen afval buiten zetten')
end
if (niets and dag) then
commandArray ['UpdateDevice']= '15|1|Geen ophaaldag'
end
if (morgenpapier and weekdag and dag) then
commandArray ['UpdateDevice']= '15|1|Morgen papier'
end
if (papier and weekdag and dag) then
commandArray ['UpdateDevice']= '15|1|Vandaag papier, morgen plastic'
end
if (plastic and weekdag and dag) then
commandArray ['UpdateDevice']= '15|1|Vandaag plastic'
end
return commandArray

IDX needs to be replaced by the idx of you text device
you can find it in the sensor/devices (apparaten) table
Just lookup in that table you text sensor write down the idx number and construct the above using your values.

I still have a question about this.
I see my script running every 10 seconds, I had set the main device at 24 hours.
How it comes that the script still runs every 10 seconds?
Or is this a general setting within domoticz?

How can I get it that it's only once in 24 runs instead of every 10 seconds?

You can place it in a time script to run once a minute but that's als not nice for the purpose.

time = os.date("*t")
if (time.hour==7 or time.hour==19) and time.min==0 then

the script

end

This would run the script twice a day in the moring and in the evening.
(i use this to send me a telegram reminder evening before and in the morning of the waiste day )

The image is (not yet) changeable for the text devices but you can include html with picture. In my experience that does not work nice, but has been some beta's agoo so maybe it works now in a better way.

note :
If you start experimenting and loose you text device due to this (had that before) just update it in a script with a one word text and it will reapear.
but maybe also that is improved in current versions.