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

Please expose Moon times/illumination too #5

Closed schildbach closed 1 year ago

schildbach commented 4 years ago

The Suncalc library can do this, see https://github.com/mourner/suncalc#moon-rise-and-set-times and https://github.com/mourner/suncalc#moon-illumination.

freakent commented 4 years ago

I am currently updating this node to make sure it is working on the latest node-red. Once that is stable I will look at this. I have some uses for this too. Can you describe the use case you are think of so I can add your usage to my test cases?

schildbach commented 4 years ago

Well, since I love looking at a rising full moon while the sky is still lit by the sun, I'd like an announcement as soon as the moon rises and is (still) almost full. It would be a combination of the data 'suncalc' provides.

freakent commented 4 years ago

Suncalc has separate api for sun and moon events, are you suggesting you'd like to see one node-red node do both? I was thinking I would create another similar node for moon events.

schildbach commented 4 years ago

I guess two nodes would be nice.

freakent commented 4 years ago

I have now read the suncalc docs properly for moon times and there is clearly a difference between sun and moon times. The suncalc library will return the moon rise and moon set times that I could emit as events on days that have them, but there can be days where the moon is it either always up or always down. What would be the desired behaviour on those days?

schildbach commented 4 years ago

I'd say just ignore the sun, and therefore ignore days. Just fire an event if the moon rises, and fire an event if the moon sets.

(Note that depending on where you live, there can also be days without sunrise or sunset.)

kuema commented 4 years ago

Getting the moon's illumination (moon phase changes) would be nice too, so you can visualize it in the Dashboard, for example. 🌝

freakent commented 1 year ago

Sorry this is out of scope.