'Handle received code by the pilight-daemon.
If the code matches the defined playload
of this sensor the sensor state is changed accordingly.'

def _handle_code(self, call):

    payload_ok = True
    for key in self._payload:
        if (key not in call.data):
            payload_ok = False
            continue
        if (self._payload[key] != call.data[key]):
            payload_ok = False
    if payload_ok:
        if (self._variable not in call.data):
            return
        value = call.data[self._variable]
        self._state = (value == self._on_value)
        self.schedule_update_ha_state()
