Sunrise script

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Sunrise script

Post 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
}
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Sunrise script

Post by waltervl »

On timer is sunrise will do.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Sunrise script

Post 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
}
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Sunrise script

Post 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
}
User avatar
jacobsentertainment
Posts: 223
Joined: Thursday 01 October 2020 1:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021-1
Location: Not @ home
Contact:

Re: Sunrise script

Post 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)
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Sunrise script

Post by rrozema »

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest