def state(self):
"""
Check the current status of the alarm system.
"""
# Click the refresh button to verify the state if it was made somewhere else
try:
# Recheck the current status
self._driver.get(self._driver.current_url)
current_status = WebDriverWait(self._driver, self.timeout).until(EC.presence_of_element_located((self.STATUS_IMG[0],
self.STATUS_IMG[1]))).text
_LOGGER.debug('Fetched current status from system: {}'.format(current_status))
return current_status
except (exceptions.NoSuchElementException, exceptions.NoSuchWindowException, exceptions.TimeoutException, urllib.error.URLError) as e:
_LOGGER.warning('Error while checking alarm status. Attempting login again.')
self._login()
current_status = WebDriverWait(self._driver, self.timeout).until(EC.presence_of_element_located((self.STATUS_IMG[0],
self.STATUS_IMG[1]))).text
return current_status
评论列表
文章目录