Inconsistent results with getState

smartapp
hubv2

(Anthony) #1

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


(Mike Maxwell) #2

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”


(Anthony) #3

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.


(Mike Maxwell) #4

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


(Anthony) #5

Right, so that’s what I meant.


(Anthony) #6

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.