Add advanced RF data to subject433toMQTTAdvanced

#21
This commit is contained in:
1technophile committed 2017-03-16 20:08:17 +01:00
1 parent 1658784612
commit ee3a76d348
2 files changed
+7

No files matched your search

+6
View File
@@ -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);
+1
View File
@@ -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