1 parent
bdb968e097
commit
27a1a906e0
1 file changed
+10
-3
+10
-3
@@ -82,9 +82,10 @@ boolean reconnect() {
|
|||||||
// Once connected, publish an announcement...
|
// Once connected, publish an announcement...
|
||||||
client.publish(will_Topic,Gateway_AnnouncementMsg);
|
client.publish(will_Topic,Gateway_AnnouncementMsg);
|
||||||
//Subscribing to topic
|
//Subscribing to topic
|
||||||
if (client.subscribe(subjectMQTTtoX)) {
|
if (client.subscribe(subjectMQTTtoX) && client.subscribe(subject433toMQTT)) {
|
||||||
trc(F("subscription OK to"));
|
trc(F("subscription OK to"));
|
||||||
trc(subjectMQTTtoX);
|
trc(subjectMQTTtoX);
|
||||||
|
trc(subject433toMQTT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trc(F("failed, rc="));
|
trc(F("failed, rc="));
|
||||||
@@ -236,7 +237,6 @@ unsigned long MQTTvalue = 0;
|
|||||||
String value = String(MQTTvalue);
|
String value = String(MQTTvalue);
|
||||||
trc(value);
|
trc(value);
|
||||||
boolean result = client.publish((char *)subject.c_str(),(char *)value.c_str());
|
boolean result = client.publish((char *)subject.c_str(),(char *)value.c_str());
|
||||||
if (result)storeValue(MQTTvalue);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -252,7 +252,7 @@ void storeValue(long MQTTvalue){
|
|||||||
// replace it by the new one
|
// replace it by the new one
|
||||||
ReceivedSignal[o][0] = MQTTvalue;
|
ReceivedSignal[o][0] = MQTTvalue;
|
||||||
ReceivedSignal[o][1] = now;
|
ReceivedSignal[o][1] = now;
|
||||||
trc(F("send this code :"));
|
trc(F("store this code :"));
|
||||||
trc(String(ReceivedSignal[o][0])+"/"+String(ReceivedSignal[o][1]));
|
trc(String(ReceivedSignal[o][0])+"/"+String(ReceivedSignal[o][1]));
|
||||||
trc(F("Col: value/timestamp"));
|
trc(F("Col: value/timestamp"));
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
@@ -300,6 +300,13 @@ void receivingMQTT(char * topicOri, char * datacallback) {
|
|||||||
trc(F("Converted value to unsigned long"));
|
trc(F("Converted value to unsigned long"));
|
||||||
trc(String(data));
|
trc(String(data));
|
||||||
|
|
||||||
|
// Storing data received
|
||||||
|
if ((topic == subject433toMQTT)){
|
||||||
|
trc(F("Storing signal"));
|
||||||
|
storeValue(data);
|
||||||
|
trc(F("Data stored"));
|
||||||
|
}
|
||||||
|
|
||||||
// RF DATA ANALYSIS
|
// RF DATA ANALYSIS
|
||||||
//We look into the subject to see if a special RF protocol is defined
|
//We look into the subject to see if a special RF protocol is defined
|
||||||
int valuePRT = 0;
|
int valuePRT = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user