Closed lightx closed 9 years ago
The underlying sunevents module should handle this use case, but it would be quite a big change to the node-red node. What would be your trigger to start the node-red flow and how often would it fire?
You can take a look at this workflow to get a sense of it
ohh and I just setup a context.global.location with my current latitude and longitude
owntracks looks cool but I use prowl instead of pushover in my own flows.
I don't think this node is what you are looking for. Each night at midnight it uses SunCalc to perform the calculations for the next 24 hours. Timers are used to emit the events at the appropriate time. If you moved the lat and long during that time you would have to recalculate the events for that day, cancel the existing events then re-create the timers for the day. If you are using a GPS to continually update your coordinates you would be continually creating timers unnecessarily.
Couldn't you just invoke SunCalc from your function node?
// Must install suncalc using npm before using it
var SunCalc = require('suncalc');
// get today's sunlight times for London
var times = SunCalc.getTimes(new Date(), 51.5, -0.1);
// format sunrise time from the Date object
var sunriseStr = times.sunrise.getHours() + ':' + times.sunrise.getMinutes();
Closing...
Hi, I have a new Beta version of this SunEvents node that I think addresses this issue. Want to test it?
To try the V3 Beta follow the link to this issue:
Thanks!
Would it be possible to add a feature where we can input a msg.latitude+longitude. I use owntracks and travel a bit. To have sunevents calculate based on where I am would be great.