diff --git a/OpenMQTTGateway.ino b/OpenMQTTGateway.ino index 2ed3ad8..17aec8c 100644 --- a/OpenMQTTGateway.ino +++ b/OpenMQTTGateway.ino @@ -198,8 +198,10 @@ unsigned long MQTTvalue = 0; if (mySwitch.available()||irrecv.decode(&results)){ trc(F("Signal detected")); String subject; + String valueAdvanced =""; if (mySwitch.available()){ MQTTvalue = mySwitch.getReceivedValue(); + valueAdvanced = "Value " + String(MQTTvalue)+" Bit " + String(mySwitch.getReceivedBitlength()) + " Delay " + String(mySwitch.getReceivedDelay()) + " Protocol " + String(mySwitch.getReceivedProtocol()); mySwitch.resetAvailable(); subject = subject433toMQTT; }else if (irrecv.decode(&results)){ @@ -208,6 +210,10 @@ unsigned long MQTTvalue = 0; subject = subjectIRtoMQTT; } if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT + if (valueAdvanced != ""){ + trc(F("Sending advanced signal to MQTT")); + client.publish(subject433toMQTTAdvanced,(char *)valueAdvanced.c_str()); + } trc(F("Sending signal to MQTT")); String value = String(MQTTvalue); trc(value); diff --git a/User_config.h b/User_config.h index d860d34..de3af5e 100644 --- a/User_config.h +++ b/User_config.h @@ -65,6 +65,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT //433Mhz MQTT Subjects and keys #define subjectMQTTto433 "home/commands/MQTTto433" #define subject433toMQTT "home/433toMQTT" +#define subject433toMQTTAdvanced "home/433toMQTTAdvanced" #define RFprotocolKey "433_" // protocol will be defined if a subject contains RFprotocolKey followed by a value of 1 digit #define RFpulselengthKey "PLSL_" // pulselength will be defined if a subject contains RFprotocolKey followed by a value of 3 digits //IR MQTT Subjects