def _sensorAlertsOffHandler(self): logging.debug("[%s]: Received sensor alerts off." % self.fileName) # acknowledge sensor alerts off logging.debug("[%s]: Sending SENSORALERTSOFF OK message." % self.fileName) try: self.client.send("SENSORALERTSOFF OK\r\n") except Exception as e: logging.exception("[%s]: Sending sensor alerts " % self.fileName + "off acknowledgement failed.") return False # stop all alerts for alert in self.alerts: # stop alert in an own thread to not block this one alertStopProcess = AsynchronousAlertExecuter(alert) # set thread to daemon # => threads terminates when main thread terminates alertStopProcess.daemon = True alertStopProcess.stopAlert = True alertStopProcess.start() return True
def _sensorAlertsOffHandler(self, incomingMessage): logging.debug("[%s]: Received sensor alerts off." % self.fileName) # sending sensor alerts off response logging.debug("[%s]: Sending sensor alerts off " % self.fileName + "response message.") try: payload = {"type": "response", "result": "ok"} message = {"clientTime": int(time.time()), "message": "sensoralertsoff", "payload": payload} self.client.send(json.dumps(message)) except Exception as e: logging.exception("[%s]: Sending sensor alerts " % self.fileName + "off response failed.") return False # stop all alerts for alert in self.alerts: # stop alert in an own thread to not block this one alertStopProcess = AsynchronousAlertExecuter(alert) # set thread to daemon # => threads terminates when main thread terminates alertStopProcess.daemon = True alertStopProcess.stopAlert = True alertStopProcess.start() return True
def _sensorAlertsOffHandler(self, incomingMessage): logging.debug("[%s]: Received sensor alerts off." % self.fileName) # sending sensor alerts off response logging.debug("[%s]: Sending sensor alerts off " % self.fileName + "response message.") try: payload = {"type": "response", "result": "ok"} utcTimestamp = int(time.time()) message = {"clientTime": utcTimestamp, "message": "sensoralertsoff", "payload": payload} self.client.send(json.dumps(message)) except Exception as e: logging.exception("[%s]: Sending sensor alerts " % self.fileName + "off response failed.") return False # stop all alerts for alert in self.alerts: # stop alert in an own thread to not block this one alertStopProcess = AsynchronousAlertExecuter(alert) # set thread to daemon # => threads terminates when main thread terminates alertStopProcess.daemon = True alertStopProcess.stopAlert = True alertStopProcess.start() return True