'Parse data sent by gateway.'

def parse_data(self, data):

    self._should_poll = False
    if (NO_MOTION in data):
        self._no_motion_since = data[NO_MOTION]
        self._state = False
        return True
    value = data.get(self._data_key)
    if (value is None):
        return False
    if (value == MOTION):
        self._should_poll = True
        if (self.entity_id is not None):
            self._hass.bus.fire('motion', {'entity_id': self.entity_id})
        self._no_motion_since = 0
        if self._state:
            return False
        self._state = True
        return True
    elif (value == NO_MOTION):
        if (not self._state):
            return False
        self._state = False
        return True
