[userModule] Daylight (updated 2015-07-05)

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

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

Post 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....
Since 29-12-2016 I am no longer a moderator for this forum
mhorst
Posts: 27
Joined: 30 Dec 2014 15:10

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

Post 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.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

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

Post 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
Since 29-12-2016 I am no longer a moderator for this forum
mhorst
Posts: 27
Joined: 30 Dec 2014 15:10

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

Post 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.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

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

Post 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)
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

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

Post by pz1 »

mhorst wrote:Version 0.3.0 is available in the first post of this thread.
module.json needs update to this number ;)
RottenMutt
Posts: 100
Joined: 31 Jan 2015 21:09

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

Post by RottenMutt »

how do I install user modules?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

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

Post 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
dk00000
Posts: 4
Joined: 12 Feb 2015 12:33

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

Post by dk00000 »

can somebody explain in one sentence the difference between this modul (daylight) and the module SunriseSunset?

thanks!!
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

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

Post 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 :(
Post Reply