at Sunrise and at Sunset not working?

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

Moderator: leecollings

Post Reply
RoRoo
Posts: 8
Joined: Wednesday 30 May 2018 20:42
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: the Netherlands
Contact:

at Sunrise and at Sunset not working?

Post by RoRoo »

Hi all!

I've been trying to get my script working correctly, but strangely enough, my script isn't getting started.
I currently have this code:

Code: Select all

return {
	active = true,
	on = {
		timer = {
		    
			'at Sunset',                 
            'at Sunrise'
		}
	},
	execute = function(domoticz, device, triggerInfo)
	    local AchterTuin_Licht = domoticz.devices('Sonoff_Tuinlicht')
	    local Voortuin_Licht = domoticz.devices('Buitenlamp_Voor')
                        
	    if (triggerInfo.trigger == 'at Sunset')
	    then
		    AchterTuin_Licht.switchOn().withinMin(15)
		    Voortuin_Licht.switchOn().withinMin(15)
		    domoticz.log('Sunset, tuinverlichting gaat random aan binnen 15 minuten.');
		    domoticz.notify('Domoticz Notification', 'Sunset, tuinverlichting gaat random aan binnen 15 minuten.', 'domoticz.PRIORITY_NORMAL')
		
		elseif (triggerInfo.trigger == 'at Sunrise')
		then
		    AchterTuin_Licht.switchOff().withinMin(15)
		    Voortuin_Licht.switchOff().withinMin(15)
		    domoticz.log('Sunrise, tuinverlichting gaat random uit binnen 15 minuten.');
		    domoticz.notify('Domoticz Notification', 'Sunrise, tuinverlichting gaat random uit binnen 15 minuten.', 'domoticz.PRIORITY_NORMAL')
        
	end
end
}
When I change "at Sunset" to "at NightTime" and "at Sunrise" to "at Daytime" the script works and the lights switch on, but I get my Notification and Log entry every minute..

Am I missing something for the sunset and sunrise to work?
My location has been set in Domoticz and I can see the sunset and rise times.

Version information:
Version: 3.9530
Build Hash: 30295913
Compile Date: 2018-05-29 14:27:24
dzVents Version: 2.4.6
Python Version: 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170124]
b00p
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: at Sunrise and at Sunset not working?

Post by waaren »

RoRoo wrote: Saturday 09 June 2018 22:47 I've been trying to get my script working correctly, but strangely enough, my script isn't getting started.
I currently have this code:

Code: Select all

.....
		timer = {  'at Sunset',  'at Sunrise' } },
		.....
		
When I change "at Sunset" to "at NightTime" and "at Sunrise" to "at Daytime" the script works and the lights switch on, but I get my Notification and Log entry every minute..

Am I missing something for the sunset and sunrise to work?
I have not tested it but at first glance it looks like it has something to do with the use of uppercase in your timer settings.
You should use 'at sunset', 'at sunrise'
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RoRoo
Posts: 8
Joined: Wednesday 30 May 2018 20:42
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: the Netherlands
Contact:

Re: at Sunrise and at Sunset not working?

Post by RoRoo »

Could it be thát stupid? The DZVents editor autofills with a capital, but I can't remember if I've tested it without...

I'll change it. Thanks for the tip!
b00p
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: at Sunrise and at Sunset not working?

Post by dannybloe »

Yes, it is that stupid. Case sensitive it is.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
RoRoo
Posts: 8
Joined: Wednesday 30 May 2018 20:42
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: the Netherlands
Contact:

Re: at Sunrise and at Sunset not working?

Post by RoRoo »

dannybloe wrote: Sunday 10 June 2018 15:43 Yes, it is that stupid. Case sensitive it is.
Such a simple error that had me tinkering for days :)
I trust my lights will go on this evening.

The autofill in the editor was filling Sunrise due to my notification text. I've mistaken it for feature filling.
b00p
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest