seb821 / espRFLinkMQTT

ESP8266 gateway between RFLink and MQTT server
96 stars 32 forks source link

Domoticz sends SYNCID after RFLink string #35

Open urkelbundy opened 2 years ago

urkelbundy commented 2 years ago

Hi all,

This may be the wrong place to ask but I will try it anyway.

Using espRFLinkMQTT for about a day now with Domoticz 2022.1. Receiving sensors works great but switching a switch doesn't seem to work.

I used the mosquitto client to subscribe to rflink/out to see what Domoticz is sending when a switch was switched ON. What I expected to see is for example: 10;NewKaku;1234567;1;ON; What was sent by Domoticz is: 10;NewKaku;1234567;1;ON;SYNCID=65fdd29e;

The RFLink doesn't respond to the string received because of the SYNCID=65fdd29e; part, so the switch is not switched to ON.

What is that SYNCID=65fdd29e; part doing there? Why is Domoticz sending it? I use Domoticz in a docker pulled from docker hub from LinuxServer.io

Is there something wrong with my Domoticz docker or is espRFLinkMQTT missing something that filters the SYNCID part?

Best regards

urkelbundy commented 2 years ago

I found it in the Domoticz code in RFLinkMQTT.cpp sstr << msg << "SYNCID=" << std::hex << m_syncid << ";\n";

In esp32-rflinkmqttgateway I noticed some code that deals with this SYNCID

if( (p = strstr( payloadstr , "SYNCID=" )) != NULL )
{
   ........
    syncback = true;
}

// Remove the SYNC ID
memcpy( rflinkpacket , payload , len );

if( syncback == true &&
    rflinksplitpacket( payloadstr , ";", params , MAX_RFPACKET_FIELDS , &len ) == MAX_RFPACKET_FIELDS &&
    len < (sizeof(rflinkpacket)-24)
)
{
    sprintf( rflinkpacket , "20;00;%s;ID=%s;SWITCH=%s;CMD=%s;%s;", params[1] , params[2] ,params[3] ,params[4] , params[5] );
    MQTTPublish( RFLINK_RECEIVE_TOPIC , rflinkpacket );
}

So it looks like some sort of acknowledgement and that part is missing in the espRFLinkMQTT code. Request for adding the missing code to espRFLinkMQTT.