freakent / node-red-contrib-sunevents

A node for node-red that generates events based on the position of the Sun at the appropriate time of day.
Apache License 2.0
15 stars 13 forks source link

Nadir #15

Closed ajones22g closed 3 years ago

ajones22g commented 3 years ago

It seems that since our clocks changed on Sunday 25th October 2020, this node is no longer generating nadir events?

freakent commented 3 years ago

It is possible, It can depend on your timezone. I have been experimenting with the underlying Suncalc library to try to figure out the right time of day to run it each day but there doesn't seem to be a good answer. Do you have an idea roughly what time nadir has been for you the last few days?

ajones22g commented 3 years ago

Martin, hi. Sorry for the terse comment, I wasn't sure if or when you would see it.

Not exactly sure of the expected time but about 23:47ish I think. Some more information for you. I'm in Northampton in the UK and I have only used this node since June, so this is the first clock change I have seen. I record all the events and the last nadirs recorded were: ... "2020-10-19T23:49:06.983Z" "2020-10-20T23:48:57.489Z" "2020-10-21T23:48:48.718Z" "2020-10-22T23:48:40.682Z" "2020-10-23T23:48:33.394Z" "2020-10-24T23:48:26.868Z"

Then, at those times it was about 10 to 1 in the morning, perhaps now being before midnight has caused a problem? The other 13 events all still record as expected.

I keep snapshots from my outside cameras on some of the events and only noticed today that I no longer had the night time pictures. Otherwise it has worked perfectly.

Many thanks, Adrian Jones.

freakent commented 3 years ago

I think you are right, It looks like it’s because nadir is currently occurring just before midnight. The underlying Suncalc library gives a days worth of sun events. I basically run that calculation everyday at midnight. So I suspect it is saying that nadir has already happened so I’ll ignore it. I think nadir is probably the one event that is hardest to catch because of the way I am doing this.

freakent commented 3 years ago

I’ve been giving this some more thought and reading about a similar issue reported on Suncalc itself. I think I can make sunevents more resilient if I run the suncalc calculations for at least 2 days ahead (instead of 1 day) and merge the results each day. I’ll run some tests and see how it works out. The dates and times you have provided will be useful for that - thanks. I can’t promise when I’ll have an updated version yet.

freakent commented 3 years ago

Hi, I have a new Beta version of this SunEvents node that I think addresses this issue. Want to test it?

ajones22g commented 3 years ago

I'll happy try it.

I use the Nadir option to keep camera snapshots and as such this was a nice novelty rather than mission critical. While this was not generating those events I just added a midnight event with the required fake properties, close enough. On the 16th December I started getting the true Nadir events again.

So I wouldn't expect to see the original problem again until the period 26th October to 15th December. Which may not be much help as a beta tester?

On Sat, 13 Feb 2021, 19:20 Martin Jarvis, notifications@github.com wrote:

Hi, I have a new Beta version of this SunEvents node that I think addresses this issue. Want to test it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/freakent/node-red-contrib-sunevents/issues/15#issuecomment-778665321, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALG4Z64M7K7S26246Z4XYQLS63GHVANCNFSM4TTF7I5Q .

freakent commented 3 years ago

To try the V3 Beta follow the link to this issue: https://github.com/freakent/node-red-contrib-sunevents/issues/21#issue-807990667 Thanks!

ajones22g commented 3 years ago

Martin, I have had this working for a couple of weeks now and everything is as expected.  My original problem of no nadir event as it moved to before midnight won't happen at this time of year and so can't be proved to work.  But I hope that with the new method of generating a daily set of times that this will not happen. The only problem I found anywhere was that the link in README.md to an example flow does not work. Many thanks,Adrian Jones.

On Sunday, 14 February 2021, 16:13:35 GMT, Martin Jarvis <notifications@github.com> wrote:  

To try the V3 Beta follow the link to this issue:

21 (comment)

Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

freakent commented 3 years ago

Hi Adrian, thanks for the update. Are you saying the link in the README doesn't work (i.e. goes no where) or are you saying the example flow doesn't work?

ajones22g commented 3 years ago

Sorry, wasn't clear.  The link itself doesn't take me to an example I just get a page with "Error Fetching Resource".

On Friday, 5 March 2021, 09:48:07 GMT, Martin Jarvis <notifications@github.com> wrote:  

Hi Adrian, thanks for the update. Are you saying the link in the README doesn't work (i.e. goes no where) or are you saying the example flow doesn't work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

freakent commented 3 years ago

Found it, thanks. Updated the broken link and actually pointed the link at the raw file as I suspect that will be more useful to people.

freakent commented 3 years ago

V3.0 uses a much more robust approach for calculating a minimum of 24 hours of events so should not be affected by different time zones.