diff --git a/doorUtil.py b/doorUtil.py index 22e6b0c..1feb77f 100644 --- a/doorUtil.py +++ b/doorUtil.py @@ -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)