Adding ignore capability to Egardia component (#9676)

This commit is contained in:
Jeroen ter Heerdt 2017-10-04 09:59:38 +02:00 committed by Fabian Affolter
parent 4be91a103d
commit 7759ae26fd

View File

@ -25,6 +25,7 @@ _LOGGER = logging.getLogger(__name__)
CONF_REPORT_SERVER_CODES = 'report_server_codes'
CONF_REPORT_SERVER_ENABLED = 'report_server_enabled'
CONF_REPORT_SERVER_PORT = 'report_server_port'
CONF_REPORT_SERVER_CODES_IGNORE = 'ignore'
DEFAULT_NAME = 'Egardia'
DEFAULT_PORT = 80
@ -148,9 +149,15 @@ class EgardiaAlarm(alarm.AlarmControlPanel):
def parsestatus(self, status):
"""Parse the status."""
newstatus = ([v for k, v in STATES.items()
if status.upper() == k][0])
self._status = newstatus
_LOGGER.debug("Parsing status %s", status)
# Ignore the statuscode if it is IGNORE
if status.lower().strip() != CONF_REPORT_SERVER_CODES_IGNORE:
_LOGGER.debug("Not ignoring status")
newstatus = ([v for k, v in STATES.items()
if status.upper() == k][0])
self._status = newstatus
else:
_LOGGER.error("Ignoring status")
def update(self):
"""Update the alarm status."""