Page 3 of 8

Re: [userModule] Daylight (updated 2015-01-01)

Posted: 01 Feb 2015 21:01
by pz1
Thanks for feedback. I am somehow loosing my schedules. They are still correctly in the automation section, but don't get fired anymore after a while.
This behaviour started after I played with Daylight. For that reason I went through your code, but could not fine a clue there. It seemed a correlation. I have some suspician towards logical rules, but would know why. Anyhow I removed all of them as well. See what happens next.

I wonder where the CRON module stores it settings so I could see if those had disappeared....

Re: [userModule] Daylight (updated 2015-01-01)

Posted: 02 Feb 2015 01:13
by mhorst
Yes, I can't find anything obvious in the Daylight module either. I looked at the cron module, as far as I can tell it does not store any settings. I think the idea is that all modules register their events when they are (re-)started.

What you could try is to change the following line in the Cron module:

Code: Select all

      // console.log(JSON.stringify(self.renderSchedule(schedule))); // debug !
I changed it to:

Code: Select all

      console.log("Cron:" + eventName + ";" + JSON.stringify(self.renderSchedule(schedule)));
This will make the cron module log the registration of events from other modules.

Also, after the line:

Code: Select all

     delete self.schedules[eventName];
I added the line:

Code: Select all

      console.log("Cron:" + eventName + " removed");
So that the module also logs when an event is removed.

With such logging you might be able to see whether all events are registered in case of a re-start. Or there is some time when the events are removed.

Re: [userModule] Daylight (updated 2015-01-01)

Posted: 02 Feb 2015 11:47
by pz1
I'll try it in a couple of days when I have finished my test to see if the system is stable on scenes and schedules only

Re: [userModule] Daylight (updated 2015-01-01)

Posted: 09 Feb 2015 20:31
by mhorst
I updated to v2.0.1-rc12 and now it looks like the sensor no longer updates automatically. Unfortunately the update also removed the logging I added to the cron module. So I don't have good logging yet, but I will look into it.

EDIT:
Hmmm, it looks like the modules are loaded in a random order. If daylight is loaded before the cron module, then the events it needs are not registered.
Also, I found that z-way triggers events based on the sensor even if the code sets sensor to the same value it already has.

That last bit is easy to solve, but I don't know if I can influence the order in which modules are loaded.

EDIT2:
Actually I can just add a dependency to module.json.

Ok, I think it should work better now. Version 0.3.0 is available in the first post of this thread.

Re: [userModule] Daylight (updated 2015-02-09)

Posted: 09 Feb 2015 21:20
by pz1
Well that is nicely timed. I was about to reinstantiate Daylight. (I now have only the scenes and schedules running. It is stable for about a week)

Re: [userModule] Daylight (updated 2015-01-01)

Posted: 10 Feb 2015 21:26
by pz1
mhorst wrote:Version 0.3.0 is available in the first post of this thread.
module.json needs update to this number ;)

Re: [userModule] Daylight (updated 2015-02-09)

Posted: 11 Feb 2015 08:29
by RottenMutt
how do I install user modules?

Re: [userModule] Daylight (updated 2015-02-09)

Posted: 11 Feb 2015 10:16
by pz1
RottenMutt wrote:how do I install user modules?
  • Copy the package files to folder:

    Code: Select all

    /opt/z-way-server/automation/userModules
  • Restart z-way-server
  • Via HA interface -Preferences/Modules/Environment select Daylight modules

Re: [userModule] Daylight (updated 2015-02-09)

Posted: 12 Feb 2015 12:41
by dk00000
can somebody explain in one sentence the difference between this modul (daylight) and the module SunriseSunset?

thanks!!

Re: [userModule] Daylight (updated 2015-02-09)

Posted: 12 Feb 2015 13:13
by pz1
Daylight creates a sensor which is on during the day and off at night. To be used with LogicalRules. These rules can trigger scenes
SunriseSunset is yet an other Scheduler where you can activate a scene. IIRC with this module you can specify positive/negative time offsets with sunrise/sunset.
Daylight via a LogicalRule combined with DelayedScene, can activate only after the sunset/rise event.
(If you cheat with the Longitude setting in DayLight you fire events earlier. Daylight seems to allow multiple instances, but I havent tested that)
Sorry that it is a bit more than one sentence :(