'Parse data sent by gateway.'

def parse_data(self, data):

    value = data.get(self._data_key)
    if (value is None):
        return False
    if (value == 'long_click_press'):
        self._state = True
        click_type = 'long_click_press'
    elif (value == 'long_click_release'):
        self._state = False
        click_type = 'hold'
    elif (value == 'click'):
        click_type = 'single'
    elif (value == 'double_click'):
        click_type = 'double'
    elif (value == 'both_click'):
        click_type = 'both'
    else:
        return False
    self._hass.bus.fire('click', {'entity_id': self.entity_id, 'click_type': click_type})
    if (value in ['long_click_press', 'long_click_release']):
        return True
    return False
