I am not very proficient in programming but I try and sometimes it works. This time it doesn't

I have a scene consisting of three roller shutters that open on sunrise. I would like the scene to open at sunrise unless sunrise is earlier that 6 am in the morning. The scenes' timers does not have that option so I tried to create a dzVents script to make it happen. Note that I have disabled the timers in the scene so it would not interrupt the script.
The first roller shutter opens (not sure when because I generally sleep before 6 am

Here is the code I have been able to create after some reading.
Code: Select all
-- Script to activate "scene" "Luiken Water Open" so they won't open before 6 am on workdays
-- Scene ¨Luiken Water open" = idx 9
-- The scene consists of three roller shutters. One opens, the other two don't.
return
{
active = true,
on =
{
scenes = {9},
timer = {'2 minutes before sunset on mon, tue, wed, thu except between 04:00 and 06:05', '2 minutes before sunset except between 04:00 and 08:00 on fri, sat, sun'},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'LuikenWaterOpen',
},
execute = function(dz, item)
dz.scenes(9).switchOn()
end
}

Any help appreciated!