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 14 forks source link

Issue with latitude #47

Closed christian1986 closed 10 months ago

christian1986 commented 1 year ago

With 60.30 and 5.34 there is no events scheduled according to node red. Have been working flawless for a long period.

If I change to 50.30 it works.

[{"id":"837794965f13d7b8","type":"sun events","z":"87bcc20f.660cb8","testmode":true,"verbose":"N","topic":"","name":"","x":1050,"y":520,"wires":[["e371375a.41027","0bafd0bc4128e97f"],[]]},{"id":"6465b2672b54fe77","type":"inject","z":"87bcc20f.660cb8","name":"","props":[{"p":"payload.lat","v":"60","vt":"num"},{"p":"payload.lng","v":"5.37","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":790,"y":520,"wires":[["837794965f13d7b8"]]}]

freakent commented 1 year ago

"props":[{"p":"payload.lat","v":"60","vt":"num"},{"p":"payload.lng","v":"5.37","vt":"str"}]

It looks like you have one defined as a number and the other as a string. Could be the issue?

christian1986 commented 1 year ago

That's my bad. Still strange that it works with 50?

I changed to number and got this error againimage

freakent commented 1 year ago

I need to see more of the log file to understand what's causing that error. Are you sure that's coming from SunEvents?

christian1986 commented 1 year ago

What logs?

100% sure. Attached is the debug logs from when I use 50 and 60 as latitude. 50 is no problem.

Skjermbilde 2023-08-18 kl  10 36 06

freakent commented 1 year ago

Is there something else in your flow referencing a milliseconds property?

You could also try adding a decimal point to force it do a decimal, so 50.0 and 60.0.

For node red logs, see: https://nodered.org/docs/user-guide/runtime/logging

christian1986 commented 1 year ago

21 Aug 13:31:03 - [info] [sun events:837794965f13d7b8] calculating sunevents for lat 60.2 and lng 5.37 21 Aug 13:31:03 - [error] [sun events:837794965f13d7b8] TypeError: Cannot read properties of undefined (reading 'milliseconds')

And if I change to sub 60 for latitude it works like a charm!

tyeth commented 1 year ago

Looking at an incorrect timezone issue I have ended up here. Mainly to verify what sunrise is returned by different "calculators". @freakent This issue appears to be an issue from the luxon library, and is resolved by the latest update. https://github.com/moment/luxon/issues/1488

freakent commented 1 year ago

Looking at an incorrect timezone issue I have ended up here. Mainly to verify what sunrise is returned by different "calculators".

@freakent This issue appears to be an issue from the luxon library, and is resolved by the latest update. https://github.com/moment/luxon/issues/1488

Is this related to Issue with Lattitude originally reported by @christian1986 ? If not please can you raise a separate issue and explain the error you are experiencing. At the moment I can not see what I would be testing for.

tyeth commented 1 year ago

Sorry ignore my issue, I was saying the solution to this issue is to update luxon, and check the migration notes related to the milliseconds change, but hopefully you just need to update luxon.