Page 1 of 1

Sunrise script

Posted: Monday 04 October 2021 22:08
by jacobsentertainment
Hi all,

I try to reset an switch at sunrise do I need to check this every minute? Looks like timer = sunrise will do the same.

Code: Select all

return {

	on = {
		timer = {
                 'every 1 minutes',
		    }
	},
    execute = function(domoticz, device)
        
        local Bedtime = domoticz.devices(66)
        
        on = { timer = { 'sunrise' } } 
            Bedtime.switchOn()
    end
}

Re: Sunrise script

Posted: Monday 04 October 2021 22:29
by waltervl
On timer is sunrise will do.

Re: Sunrise script

Posted: Monday 04 October 2021 22:46
by jacobsentertainment
waltervl wrote: Monday 04 October 2021 22:29 On timer is sunrise will do.
Thanks for the quick reply :lol:

Code: Select all

return {

    execute = function(domoticz, device)
        
        local Bedtime = domoticz.devices(191)
        
        on = { timer = { 'sunset' } } 
            Bedtime.switchOn()
        
    end
}

Re: Sunrise script

Posted: Thursday 07 October 2021 15:55
by rrozema
Your code lacks an on = specification. That is where you should specify when to run the execute() function.
For example:
return {
on = {
timer = {
'sunrise'
}
},
execute = function( domoticz, item, triggerinfo}
..... Your code here ....
end
}

Re: Sunrise script

Posted: Thursday 07 October 2021 20:26
by jacobsentertainment
rrozema wrote: Thursday 07 October 2021 15:55 Your code lacks an on = specification. That is where you should specify when to run the execute() function.
Like in the first post but instead of every minute at sunrise :lol: Still learning (slow)

Re: Sunrise script

Posted: Thursday 07 October 2021 20:57
by rrozema