1 parent
1658784612
commit
ee3a76d348
2 files changed
+7
No files matched your search
@@ -198,8 +198,10 @@ unsigned long MQTTvalue = 0;
|
|||||||
if (mySwitch.available()||irrecv.decode(&results)){
|
if (mySwitch.available()||irrecv.decode(&results)){
|
||||||
trc(F("Signal detected"));
|
trc(F("Signal detected"));
|
||||||
String subject;
|
String subject;
|
||||||
|
String valueAdvanced ="";
|
||||||
if (mySwitch.available()){
|
if (mySwitch.available()){
|
||||||
MQTTvalue = mySwitch.getReceivedValue();
|
MQTTvalue = mySwitch.getReceivedValue();
|
||||||
|
valueAdvanced = "Value " + String(MQTTvalue)+" Bit " + String(mySwitch.getReceivedBitlength()) + " Delay " + String(mySwitch.getReceivedDelay()) + " Protocol " + String(mySwitch.getReceivedProtocol());
|
||||||
mySwitch.resetAvailable();
|
mySwitch.resetAvailable();
|
||||||
subject = subject433toMQTT;
|
subject = subject433toMQTT;
|
||||||
}else if (irrecv.decode(&results)){
|
}else if (irrecv.decode(&results)){
|
||||||
@@ -208,6 +210,10 @@ unsigned long MQTTvalue = 0;
|
|||||||
subject = subjectIRtoMQTT;
|
subject = subjectIRtoMQTT;
|
||||||
}
|
}
|
||||||
if (!isAduplicate(MQTTvalue) && MQTTvalue!=0) {// conditions to avoid duplications of RF -->MQTT
|
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"));
|
trc(F("Sending signal to MQTT"));
|
||||||
String value = String(MQTTvalue);
|
String value = String(MQTTvalue);
|
||||||
trc(value);
|
trc(value);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT
|
|||||||
//433Mhz MQTT Subjects and keys
|
//433Mhz MQTT Subjects and keys
|
||||||
#define subjectMQTTto433 "home/commands/MQTTto433"
|
#define subjectMQTTto433 "home/commands/MQTTto433"
|
||||||
#define subject433toMQTT "home/433toMQTT"
|
#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 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
|
#define RFpulselengthKey "PLSL_" // pulselength will be defined if a subject contains RFprotocolKey followed by a value of 3 digits
|
||||||
//IR MQTT Subjects
|
//IR MQTT Subjects
|
||||||
|
|||||||
Reference in new issue
Block a user