Add function to get lock/unlock status of a door

This commit is contained in:
Adam Goldsmith 2018-08-16 12:57:55 -04:00
parent 7ae175baf0
commit 3787021ffe

View File

@ -52,6 +52,13 @@ def lockOrUnlockDoor(targetIP, lock=True):
"command": "lockDoor" if lock else "unlockDoor"}))
return doXMLRequest(targetIP, el)
def getStatus(targetIP):
el = E_plain.VertXMessage(
E.Doors({"action": "LR", "responseFormat": "status"}))
xml = doXMLRequest(targetIP, el)
relayState = xml.find('./{*}Doors/{*}Door').attrib['relayState']
return "unlocked" if relayState == "set" else "locked"
def forEachDoor(fxn):
for doorName, doorData in config["doors"].items():
print(doorName)