From a84ef646f14f667f53205b72f1c9759429cbfd1c Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 18 Oct 2018 20:10:22 -0400 Subject: [PATCH] doorUpdater: Use ROOT for VertXMessage tag for clarity --- hid/DoorController.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hid/DoorController.py b/hid/DoorController.py index cae8962..95c5839 100644 --- a/hid/DoorController.py +++ b/hid/DoorController.py @@ -6,6 +6,8 @@ import requests E_plain = ElementMaker(nsmap={"hid": "http://www.hidglobal.com/VertX"}) E = ElementMaker(namespace="http://www.hidglobal.com/VertX", nsmap={"hid": "http://www.hidglobal.com/VertX"}) +ROOT = E_plain.VertXMessage + class DoorController(): def __init__(self, ip, username, password, name="", access=""): @@ -64,7 +66,7 @@ class DoorController(): self.doCSVImport(outString) # clear all schedules - delXML = E_plain.VertXMessage( + delXML = ROOT( *[E.Schedules({"action": "DD", "scheduleID": str(ii)}) for ii in range(1, 8)]) self.doXMLRequest(delXML) @@ -77,7 +79,7 @@ class DoorController(): # TODO: add delete formats # delete example: - el = E_plain.VertXMessage( + el = ROOT( E.CardFormats({"action": "AD"}, E.CardFormat({"formatName": formatName, "templateID": str(templateID)}, @@ -85,13 +87,13 @@ class DoorController(): return self.doXMLRequest(el) def lockOrUnlockDoor(self, lock=True): - el = E_plain.VertXMessage( + el = ROOT( E.Doors({"action": "CM", "command": "lockDoor" if lock else "unlockDoor"})) return self.doXMLRequest(el) def getStatus(self): - el = E_plain.VertXMessage( + el = ROOT( E.Doors({"action": "LR", "responseFormat": "status"})) xml = self.doXMLRequest(el) relayState = xml.find('./{*}Doors/{*}Door').attrib['relayState']