biddster / node-red-contrib-schedex

Scheduler for node-red which allows you to enter on/off times as 24hr clock (e.g. 01:10) or suncalc events (e.g. goldenHour). It also allows you to offset times and randomise the time within the offset.
22 stars 17 forks source link

"nadir" fires thousands of times #57

Closed Putzeimer closed 4 years ago

Putzeimer commented 4 years ago

I've got 7 nodes with different named on/off times (on: sunrise/off: sunriseEnd; on: dusk/off: dawn; on: solarNoon/off: nadir; etc.). The output is written in a logfile to see, when which event triggers. After one day I got 241839 lines in the file: 1 line for each of the 13 eventnames but 241826 lines for "nadir". Now, after 4 days, the file contains about 1 million lines. Am I doing something wrong? The used version is 1.6.2.

Don't need nadir, though. I was just checking how the node works.

schedex

biddster commented 4 years ago

Doesn't look like you're doing anything wrong. I don't know why nadir should be a problem, but I'll drop a schedex in and try it.

biddster commented 4 years ago

Yup - there's a bug here. I'll fix it.

biddster commented 4 years ago

Nadir gives yesterday's date, interesting:

{
    "solarNoon": "2019-11-17T11:49:40.113Z",
    "nadir": "2019-11-16T23:49:40.113Z",
    "sunrise": "2019-11-17T07:24:47.098Z",
    "sunset": "2019-11-17T16:14:33.128Z",
    "sunriseEnd": "2019-11-17T07:28:44.485Z",
    "sunsetStart": "2019-11-17T16:10:35.741Z",
    "dawn": "2019-11-17T06:47:48.497Z",
    "dusk": "2019-11-17T16:51:31.729Z",
    "nauticalDawn": "2019-11-17T06:07:07.184Z",
    "nauticalDusk": "2019-11-17T17:32:13.042Z",
    "nightEnd": "2019-11-17T05:27:52.163Z",
    "night": "2019-11-17T18:11:28.063Z",
    "goldenHourEnd": "2019-11-17T08:18:28.863Z",
    "goldenHour": "2019-11-17T15:20:51.363Z"
}
biddster commented 4 years ago

It's a bug in the library I'm using to calculate sun times:

https://github.com/mourner/suncalc/issues/124

biddster commented 4 years ago

Fixed in 1.6.4

Putzeimer commented 4 years ago

Confirmed that nadir now fires only once per night. But I recognized that it now doesn't fire every night. I started recording nadir at 5th of january. Here are the days when it successfully fired: 06, 07, 08, 09, 10, 11, 12, 13, 14, (missing), 16, (missing), 18, 19, (missing), 21, 22, 23, 24, 25, 26, (missing), 28, (missing), 30, 31.

biddster commented 4 years ago

Thanks for the report. I'll add similar logging to my node-red and see what happens.

I've added a schedex node with just an on time to my flow which sends a message to slack on the nadir.

biddster commented 4 years ago

Yeah, confirmed. I'll work on a fix.

biddster commented 4 years ago

Another fix released in 1.10.1

Putzeimer commented 4 years ago

29 nadir events in the past 29 nights. None missing, none twice. Fix confirmed. Thanks.