ERROR: groovy.lang.MissingMethodException: -Help Needed

I'm taking my first crack at trying to fix a code error in the Holiday Color Lights app. I am slowly making some progress using the Hubitat built in editor.

The specific error I am trying to address is:
groovy.lang.MissingMethodException: No signature of method: com.hubitat.hub.domain.Location.currentState() is applicable for argument types: (java.lang.String) values: [sunsetTime] on line 157 (changeHandler)

Here is the section of code generating the error. I've highlighted line 157 in bold and italic.
private timeWindowStart() {
def result = null
if (startTimeType == "sunrise") {
result = location.currentState("sunriseTime")?.dateValue
if (result && startTimeOffset) {
result = new Date(result.time + Math.round(startTimeOffset * 60000))
}
}
else if (startTimeType == "sunset") {
result = location.currentState("sunsetTime")?.dateValue
if (result && startTimeOffset) {
result = new Date(result.time + Math.round(startTimeOffset * 60000))
}
}
else if (starting && location.timeZone) {
result = timeToday(starting, location.timeZone)
}
log.trace "timeWindowStart = ${result}"
result
}

Based on what I've Google'd on the error, it seems that there is a parameter missing or incorrectly formatted. If I read it correctly, it is calling a Hubitat routine, Location.currentState(). I'm not sure where to take it from here.

Does anyone have any insight as to what might be wrong? Thanks.

According to the reply in your other topic on the same issue, currentState was never a Hubitat function:

You should be able to fix the code by changing the line to:
result = location.sunset
(that works in a driver, haven't personally tried it in an app)
or using getSunriseAndSunset() from the docs:
https://docs.hubitat.com/index.php?title=Common_Methods_Object#getSunriseAndSunset

1 Like

Thank you, @cometfish. I changed the code to result = location.sunset (as well as the reference to sunrise) and at least the code is no longer generating an error. I will report back in the next few days if it runs as expected.

Here's an update on my revisions to Holiday Color Lights. I was able to resolve the original error and have verified in the logs that the proper start and stop times are now being set relative to the daily sunset.

Unfortunately another problem has cropped up. While the logs show that the proper start time and holiday is selected, the lights are not turning on. I will continue my troubleshooting and report back from time to time with updates.