Past events for Location / next sunrise/sunset?

On a device, I can call currentValue() to get the last value of a given attribute. For the Location object, I can see that the hub keeps past events because they're in the logs tab, but Location has no currentValue() that I can find. Is there a way to fetch past values of sunsetTime and sunriseTime?

(I know that I could also call getSunriseAndSunset(), but that always returns the current day values, which may be in the past, which isn't terribly useful.)

Perhaps rather than trying to retrieve old values, you could setup a rule that records this based on trigger for Sunset or Sunrise...? Recording a variable of the date / time when the rule runs.....

As I type this answer I do realise that any outage / issue that occurs during these times will cause issues....

Sorry, I don't have a reliable answer....

1 Like

Yes, I'm doing that when the events fire, but that doesn't help when scheduling the first run.

That is true, and partly where my head was heading.... If we look past that, as much as my brain wants to cater for it.... :slight_smile:

If you have a rule that relies on a variable that is set when set by the transition to / from sunrise / sunset, could this not work?

Yes, but my app can't create such a rule prior to its installation, and it's an unreasonable request of a user.

Regardless, I think I just found my answer here -- you can get the list of past events, which should cover it.

1 Like

Download the Hubitat app