'Parse data sent by gateway.'

def parse_data(self, data):

    self._should_poll = False
    if (NO_CLOSE in data):
        self._open_since = data[NO_CLOSE]
        return True
    value = data.get(self._data_key)
    if (value is None):
        return False
    if (value == 'open'):
        self._should_poll = True
        if self._state:
            return False
        self._state = True
        return True
    elif (value == 'close'):
        self._open_since = 0
        if self._state:
            self._state = False
            return True
        return False
