Inconsistent results with getState

I’m working on an application and am having some issues getting consistent results getting the state of my garage door.

def currentState = garageDoor.getState

Will occasionally, but not always, return “null”. When I’m checking the state of my garage door in my Garage Door app, I am getting inconsistent results with this.

Current code: https://github.com/anthonyrhook/SmartThingsApps/blob/1b0254040dfa780f23982cae09fb57e80bcfe8f3/smartapps/anthonyrhook/auto-garage-door.src/auto-garage-door.groovy

I don’t know where getState came from, that is not an official method for garageDoorControl, i would use the following

garageDoorControl.currentValue(“door”)

The official door attribute values are:
door String “unknown” “closed” “open” “closing” “opening”

1 Like

garageDoor.garageDoorControl.currentValue(“door”) --> I’ll give that a shot as soon as the dev space comes back. Derp, not sure why I didn’t use this in the first place.

1 Like

the syntax would be garageDoor.currentValue(“door”), don’t put the garageDoorControl in the middle…

1 Like

Right, so that’s what I meant.

Cool. That seems a bit more consistent. For some reason, it still doesn’t always close on the first attempt, but I’m going to let it run real-world for a while and see what results I get.