<commit_before>import domotica.alarm
import domotica.alarm as alarm
import logging
from poller import Poller
import s7

class AlarmPoller(Poller):
    def __init__(self):
        self._wasArmed = None
        self._wasTriggered = None

    def poll(self, s7conn):
        a = alarm.Alarm(s7conn)

        isArmed = a.isArmed()
        if self._wasArmed is None:
            self._wasArmed = isArmed
        logging.debug("Alarm armed status: %s" % isArmed)

        if self._wasArmed != isArmed:
            if isArmed:
                logging.info("Alarm activated")
            else:
                logging.info("Alarm deactivated")

        if not isArmed:
            return

        isTriggered = a.isAlarmTriggered()
        if self._wasTriggered is None:
            self._wasTriggered = isTriggered
        logging.debug("Alarm trigger status: %s" % isTriggered)

        if isTriggered and self._wasTriggered != isTriggered:
            logging.warn("Alarm triggered")
            # Notify
            pass
<commit_msg>AlarmPoller: Fix debounce code<commit_after>import domotica.alarm
import domotica.alarm as alarm
import logging
from poller import Poller
import s7

class AlarmPoller(Poller):
    def __init__(self):
        self._wasArmed = None
        self._wasTriggered = None

    def poll(self, s7conn):
        a = alarm.Alarm(s7conn)

        isArmed = a.isArmed()
        logging.debug("Alarm armed status: %s" % isArmed)

        if self._wasArmed is not None and self._wasArmed != isArmed:
            if isArmed:
                logging.info("Alarm activated")
            else:
                logging.info("Alarm deactivated")
        self._wasArmed = isArmed

        if not isArmed:
            self._wasTriggered = False
            return

        isTriggered = a.isAlarmTriggered()
        logging.debug("Alarm trigger status: %s" % isTriggered)

        if self._wasTriggered is not None and isTriggered \
                and self._wasTriggered != isTriggered:
            logging.warn("Alarm triggered")
            # Notify
        self._wasTriggered = isTriggered

{'fraction_non_alphanumeric': 0.07908527870414483, 'fraction_numerical': 0.0028585040495474035, 'mean_word_length': 2.0303030303030303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4474948', 'n_tokens_mistral': 638, 'n_tokens_neox': 634, 'n_words': 158}