Skip to content

Commit

Permalink
fix for com/lock result = ""
Browse files Browse the repository at this point in the history
  • Loading branch information
pergolafabio committed Sep 12, 2023
1 parent a0395f9 commit b041442
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hikvision-doorbell/src/doorbell.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def isapi_door_capabilities() -> int:
logger.debug("Error parsing: {}", io_doors_xml)
return 0
# Error out if we don't find attribute `max` inside the `doorNo` element
if door_number_element.text is None:
if door_number_element is None or door_number_element.text is None:
# Print a string representation of the response XML
logger.debug("No door relays found for the indoor device")
return 0
Expand Down Expand Up @@ -300,7 +300,7 @@ def isapi_device_info() -> int:
root = ET.fromstring(electro_lock_xml)
electro_lock_xml_element = root.find('{*}electroLockNum')
# Error out if we don't find attribute `max` inside the `doorNo` element
if electro_lock_xml_element.text is None :
if electro_lock_xml_element is None or electro_lock_xml_element.text is None:
# Print a string representation of the response XML
logger.info("No electro locks found for the outdoor device")
raise RuntimeError('Cannot find `electroLockNum` node in XML response')
Expand Down Expand Up @@ -332,7 +332,7 @@ def isapi_device_info() -> int:
root = ET.fromstring(io_coms_xml)
com_number_element = root.find('{*}alarmOutNum')
# Error out if we don't find attribute `max` inside the `doorNo` element
if com_number_element.text is None :
if com_number_element is None or com_number_element.text is None:
# Print a string representation of the response XML
logger.debug("No com ports found for the indoor device")
return 0
Expand Down

0 comments on commit b041442

Please sign in to comment.