'Fire an event with the data that have changed.
This method is called when there is an incoming packet associated
with this platform.'

def value_changed(self, value, value2):

    self.schedule_update_ha_state()
    if (value2 == 112):
        self.which = 0
        self.onoff = 0
    elif (value2 == 80):
        self.which = 0
        self.onoff = 1
    elif (value2 == 48):
        self.which = 1
        self.onoff = 0
    elif (value2 == 16):
        self.which = 1
        self.onoff = 1
    elif (value2 == 55):
        self.which = 10
        self.onoff = 0
    elif (value2 == 21):
        self.which = 10
        self.onoff = 1
    self.hass.bus.fire('button_pressed', {'id': self.dev_id, 'pushed': value, 'which': self.which, 'onoff': self.onoff})
