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