Location.currentValue("sunsetTtime") always returning Feb 12th!


(Nick) #1

Hello!

I’ve noticed one of my apps that worked forever, has stopped working, and tracked it down to sunsetTime returning the wrong date! I just ran this code:

def initialize() {
    scheduleduleToday()
}

def scheduleToday() {
    scheduleTurnOff(location.currentValue("sunriseTime"))
}

def scheduleTurnOff( sunriseString ) {
	Log("Debug Off ${sunriseString}")
}

And got the output:

Debug Off 2016-02-12T12:30:00.000Z

And it is March 24th! not Feb 2nd!

Any thoughts to how I can fix?

Thanks!
-Nick


(Jim Anderson) #2

Try updating the “Weather Station” SmartApp in the IDE (location->installed SmartApps). See the last bullet point here: https://support.smartthings.com/hc/en-us/articles/207886053-My-time-based-events-fail-what-should-I-do-


(Nick) #3

Damn, I did, but still getting:

Debug Off 2016-02-12T12:30:00.000Z

(And there were no child apps)


(Jim Anderson) #4

Interesting. Taking a step back, if you’re trying to execute an action at sunrise/sunset, you could just subscribe to those events. It would be interesting to see if that is still giving the wrong time (check the scheduled executions in the IDE)


(Nick) #5

I’ll give that a shot again. I’m ultimately looking for an offset (ie, some time after sunrise and some time before sunset), but started off subscribing to those events. But found that I think it was too crowded at those times, so wouldn’t always be called/wasn’t reliable. I found by switching to the offsets, that fixed the issue.

Thanks!
-Nick