Is anyone else using state to get around the limitation of not being able to pass parameters to a method when using runIn()? Is there a better approach, or is this OK?
void handleIncomingCommand(delay, value) {
state.newMode = value
runIn(delay, changeMode)
}
void changeMode() {
if (location.mode != state.newMode) {
if (location.modes?.find{it.name == state.newMode}) {
setLocationMode(state.newMode)
} else {
log.warn "Tried to change to undefined mode '${state.newMode}'"
}
}
}