fairecasoimeme / ZiGate

Zigate is an Universal Zigbee Gateway
http://zigate.fr
170 stars 59 forks source link

Reporting doesn't work properly. Zigate filters messages. #398

Closed VOVAiS closed 2 years ago

VOVAiS commented 2 years ago

Reporting doesn't work properly. Zigate filters messages.

C4E4422A-1304-470B-83DA-FE1642737E98 2C1D012F-64B1-424D-9C34-F8590B5667E3

the problem is in the code:

if (sZllState.u8RawMode == RAW_MODE_ON){

    ZPS_tsAfEvent* psStackEvent = psEvent->pZPSevent;
    if (tmpSqn!=(psEvent->u8TransactionSequenceNumber+psEvent->pZPSevent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr))
    {
        tmpSqn=(psEvent->u8TransactionSequenceNumber+psEvent->pZPSevent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr);
        if (psEvent->eEventType != E_ZCL_CBET_CLUSTER_UPDATE &&
                psEvent->eEventType != E_ZCL_CBET_UNHANDLED_EVENT &&
                psEvent->eEventType != E_ZCL_CBET_REPORT_ATTRIBUTES &&
                psEvent->eEventType != E_ZCL_CBET_READ_ATTRIBUTES_RESPONSE
            )
        {
            Znc_vSendDataIndicationToHost(psStackEvent, au8LinkTxBuffer);
            return;
        }
    }else{
        return;
    }
} 

if you replace the code with

if (sZllState.u8RawMode == RAW_MODE_ON){ ZPS_tsAfEvent* psStackEvent = psEvent->pZPSevent; if (tmpSqn!=(psEvent->u8TransactionSequenceNumber+psEvent->pZPSevent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr) && psEvent->eEventType != E_ZCL_CBET_CLUSTER_UPDATE && psEvent->eEventType != E_ZCL_CBET_UNHANDLED_EVENT) { tmpSqn=(psEvent->u8TransactionSequenceNumber+psEvent->pZPSevent->uEvent.sApsDataIndEvent.uSrcAddress.u16Addr); Znc_vSendDataIndicationToHost(psStackEvent, au8LinkTxBuffer); return; } }

Reporting works fine but some of the messages from aqara s2 are lost https://github.com/Koenkk/zigbee2mqtt/issues/12138#issuecomment-1124567070

VOVAiS commented 2 years ago

Problem fix