[userModule] SunriseSunset - No Longer Maintained

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] SunriseSunset - **20140908 v2.0.5**

Post by islipfd19 »

I added a zip to the first post for the z-way 2.0.0 version.
Zjohan
Posts: 9
Joined: 16 Dec 2014 21:29

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by Zjohan »

Thanks a lot islipfd19 for the quick update.

Now I get one step further, I can see the module in the HA GUI.
But when I save configuration to it I get the following error in the z-way-server.log

[2014-12-17 18:03:43.503] [core] Notification: error (core): Can not instantiate module SunriseSunset_z-way_2.0.0: TypeError: undefined is not a function
[2014-12-17 18:03:43.528] [core] TypeError: undefined is not a function
at AutomationController.instantiateModule (automation/classes/AutomationController.js:208:24)
at AutomationController.reconfigureInstance (automation/classes/AutomationController.js:417:22)
at ZAutomationAPIWebRequest.<anonymous> (automation/webserver.js:606:44)
at ZAutomationAPIWebRequest.ZAutomationWebRequest.handleRequest (automation/request.js:251:30)
at automation/request.js:31:35
at WebServerRequestHandler (automation/main.js:85:10)

These are the parameters I used in the module in the HA GUI when I save it
City: Stockholm
Country: Sweden
List of switches: Aeon Labs Switch 3-0
List of dimmers:
Turn off switch(es) after sunrise: 20
Turn on switch(es) before sunrise: 20
How often we update sunrise and sunset times: 11:59
How often we check for time of day 0:05

I have tried to play around a bit with the four last values but I always get the same error in the log when I save.

Any advice on how to get over this is very appreciated.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by islipfd19 »

Interesting, only change I made was to the module.json file adding the category line.

Is the list of dimmers empty or blank? Try adding and then removing the dimmer switch. Are you also leaving it enabled to see if it does indeed turn the lights on and off?

What other modules are you using and are enabled?
Zjohan
Posts: 9
Joined: 16 Dec 2014 21:29

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by Zjohan »

The list of dimmers is empty since I don't have any dimmers in my setup.
I tried to add & and remove it again but that didn't help.
I have left the config over night & the lights wasn't on when I got home after sunrise.
So far I only have the default modules enabled which are
Cron Scheduler
OpenRemote Helper
Z-wave Binding

I now also tried to remove the parts related to dimmers in the SunriseSunset module (both index.js & module.son) & restarting Z-way server but that didn't help either.
I still get the same error.

[2014-12-18 17:09:17.610] [core] Notification: error (core): Can not instantiate module SunriseSunset_z-way_2.0.0: TypeError: undefined is not a function
[2014-12-18 17:09:17.638] [core] TypeError: undefined is not a function
at AutomationController.instantiateModule (automation/classes/AutomationController.js:208:24)
at AutomationController.createInstance (automation/classes/AutomationController.js:361:14)
at ZAutomationAPIWebRequest.<anonymous> (automation/webserver.js:555:44)
at ZAutomationAPIWebRequest.ZAutomationWebRequest.handleRequest (automation/request.js:251:30)
at automation/request.js:31:35
at WebServerRequestHandler (automation/main.js:85:10)

I have also tried with different values for the time related parameters but I always end up with the same error.
Could it be the name of the switch "Aeon Labs Switch 3-0" that is causing this?
I haven't figured out how to change that yet

Any advice on how to get over this is very appreciated.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by islipfd19 »

Rename the folder from SunriseSunset_z-way_2.0.0 to this SunriseSunset
Zjohan
Posts: 9
Joined: 16 Dec 2014 21:29

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by Zjohan »

Thanks,

Sorry, should have thought about changing that as well :-(

After changing the name it seems to be working fine, final proof will be at sunrise tomorrow :-)
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by islipfd19 »

Great, I hope it works.
Zjohan
Posts: 9
Joined: 16 Dec 2014 21:29

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by Zjohan »

Now I got this module working.
Thanks for it & all help!

From my attempts I have gathered the following two advices that is good to think of when you use this module.
In short the timerelated parameters are using complete timestamp so both date & time is used.

1)
You need to fill in the parameter "How often we update sunrise and sunset times:"
With a time that hasn't occurred yet during the current day.
When I missed that I ended up with that the z-way server crashing & it wouldn't start properly again after that.
The only error information I found was the following line in dmesg
[Sat Dec 20 08:38:51 2014] Unhandled prefetch abort: breakpoint debug exception (0x002) at 0xb6e0e060
This error happens as soon as you press Finish for this module in the module part of the HA GUI
To overcome this I had to reinstall the z-way-server software & configure it all again.

2)
When you set the parameter "How often we update sunrise and sunset times:" you need to set it to a time before both sunrise & sunset.

After discovering this two items I have now my setup like this
I configured it like this just after midnight the other day to avoid issue 1)
Turn off switch(es) after sunrise: 20
Turn on switch(es) before sunrise: 20
How often we update sunrise and sunset times: 02:05
How often we check for time of day 0:10

That is working fine now
Sometimes I get the warnings like this in the z-way-server.log
[2014-12-22 14:50:03.783] [core] Notification: error (module): Cannot parse sunset and sunrise times!
[2014-12-22 14:50:03.783] [core] INFO SunriseSunset: Cannot Parse sunrise/sunset times
But since it only occurs a couple of time per day I'm guessing that it is the data fetching from openweathermap.org that is slow/fails.
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by islipfd19 »

I get that in the log as well. For some reason it doesn't always get the sunrise and sunset times and it appears finicky. I'm glad you were able to get it to work.
lacost
Posts: 3
Joined: 14 Jan 2015 22:43

Re: [userMODULE] SunriseSunset - (Updated Dec 17, 2014)

Post by lacost »

islipfd19, thank you for you work!

You call openweathermap.org only for sunrize and sunset. this service use UTC time, and for me - its not good.
I try calculate sunrise and sunset using suncalc module (https://github.com/mourner/suncalc). It use time and coordinates.

Code: Select all


this.fetchlcSunSet = function() {	
        
        vDev = this.config.switches;

        sEpoch = Math.round((+new Date()) / 1000);
        
        var now = new Date();
        var _year = now.getFullYear();
        var _month = now.getMonth();
        var _day = now.getDate();

        
        //lon 36.73
        //lat 55.39
        var sunTimes = SunCalc.getTimes(now, this.config.lat, this.config.lon);
        
        sunriseTime = new Date(_year, _month, _day, sunTimes.sunrise.getHours(), sunTimes.sunrise.getMinutes(), 0);
        sunsetTime  = new Date(_year, _month, _day, sunTimes.sunset.getHours(), sunTimes.sunset.getMinutes(), 0);
        
        riseTime = +sunriseTime / 1000;
        setTime = +sunsetTime / 1000;
		riseTimeP = Math.round(riseTime + MyTimea);
		setTimeP = Math.round(setTime - MyTimeb);


PS. When I testing with openweathermap.org, sometimes i see in syslog:
raspberrypi kernel: [1283197.193121] Unhandled prefetch abort: breakpoint debug exception (0x002) at 0xb6e17060
Post Reply