differentiate receiving and publishing mqtt for the new json option in user_config.h
#318 so as to avoid user with non modified controllers to have regression on receiving (per default receiving is activated for both json and simple and prioritary analysed for json)
This commit is contained in:
1 parent
c7fe43eb97
commit
68352f10e6
9 files changed
+18
-16
No files matched your search
+2
-2
@@ -878,7 +878,7 @@ void receivingMQTT(char * topicOri, char * datacallback) {
|
|||||||
#ifdef ZgatewayPilight // ZgatewayPilight is only defined with json publishing
|
#ifdef ZgatewayPilight // ZgatewayPilight is only defined with json publishing
|
||||||
MQTTtoPilight(topicOri, jsondata);
|
MQTTtoPilight(topicOri, jsondata);
|
||||||
#endif
|
#endif
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
#ifdef ZgatewayRF
|
#ifdef ZgatewayRF
|
||||||
MQTTtoRF(topicOri, jsondata);
|
MQTTtoRF(topicOri, jsondata);
|
||||||
#endif
|
#endif
|
||||||
@@ -905,7 +905,7 @@ void receivingMQTT(char * topicOri, char * datacallback) {
|
|||||||
MQTTtoONOFF(topicOri, jsondata);
|
MQTTtoONOFF(topicOri, jsondata);
|
||||||
#endif
|
#endif
|
||||||
} else { // not a json object --> simple decoding
|
} else { // not a json object --> simple decoding
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
#ifdef ZgatewayRF
|
#ifdef ZgatewayRF
|
||||||
MQTTtoRF(topicOri, datacallback);
|
MQTTtoRF(topicOri, datacallback);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -122,11 +122,13 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
|
|||||||
|
|
||||||
#define jsonPublishing true //comment if you don't want to use Json publishing (one topic for all the parameters)
|
#define jsonPublishing true //comment if you don't want to use Json publishing (one topic for all the parameters)
|
||||||
//example home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4 {"rssi":-63,"servicedata":"fe0000000000000000000000000000000000000000"}
|
//example home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4 {"rssi":-63,"servicedata":"fe0000000000000000000000000000000000000000"}
|
||||||
|
#define jsonReceiving true //comment if you don't want to use Json reception analysis
|
||||||
|
|
||||||
//#define simplePublishing true //comment if you don't want to use simple publishing (one topic for one parameter)
|
//#define simplePublishing true //comment if you don't want to use simple publishing (one topic for one parameter)
|
||||||
//example
|
//example
|
||||||
// home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4/rssi -63.0
|
// home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4/rssi -63.0
|
||||||
// home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4/servicedata fe0000000000000000000000000000000000000000
|
// home/OpenMQTTGateway_ESP32_DEVKIT/BTtoMQTT/4XXXXXXXXXX4/servicedata fe0000000000000000000000000000000000000000
|
||||||
|
#define simpleReceiving true //comment if you don't want to use old way reception analysis
|
||||||
|
|
||||||
/*-------------DEFINE YOUR OTA PARAMETERS BELOW----------------*/
|
/*-------------DEFINE YOUR OTA PARAMETERS BELOW----------------*/
|
||||||
#define ota_hostname Gateway_Name
|
#define ota_hostname Gateway_Name
|
||||||
|
|||||||
+2
-2
@@ -98,7 +98,7 @@ boolean _2GtoMQTT(){
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTto2G(char * topicOri, char * datacallback) {
|
void MQTTto2G(char * topicOri, char * datacallback) {
|
||||||
|
|
||||||
String data = datacallback;
|
String data = datacallback;
|
||||||
@@ -132,7 +132,7 @@ boolean _2GtoMQTT(){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTto2G(char * topicOri, JsonObject& SMSdata) {
|
void MQTTto2G(char * topicOri, JsonObject& SMSdata) {
|
||||||
|
|
||||||
if (strcmp(topicOri,subjectMQTTto2G) == 0){
|
if (strcmp(topicOri,subjectMQTTto2G) == 0){
|
||||||
|
|||||||
+2
-2
@@ -154,7 +154,7 @@ void IRtoMQTT(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTtoIR(char * topicOri, char * datacallback) {
|
void MQTTtoIR(char * topicOri, char * datacallback) {
|
||||||
|
|
||||||
// IR DATA ANALYSIS
|
// IR DATA ANALYSIS
|
||||||
@@ -477,7 +477,7 @@ void IRtoMQTT(){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTtoIR(char * topicOri, JsonObject& IRdata) {
|
void MQTTtoIR(char * topicOri, JsonObject& IRdata) {
|
||||||
|
|
||||||
if (strcmp(topicOri,subjectMQTTtoIR) == 0){
|
if (strcmp(topicOri,subjectMQTTtoIR) == 0){
|
||||||
|
|||||||
+2
-2
@@ -97,7 +97,7 @@ void RFtoMQTTdiscovery(unsigned long MQTTvalue){//on the fly switch creation fro
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTtoRF(char * topicOri, char * datacallback) {
|
void MQTTtoRF(char * topicOri, char * datacallback) {
|
||||||
|
|
||||||
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
||||||
@@ -153,7 +153,7 @@ void MQTTtoRF(char * topicOri, char * datacallback) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTtoRF(char * topicOri, JsonObject& RFdata) { // json object decoding
|
void MQTTtoRF(char * topicOri, JsonObject& RFdata) { // json object decoding
|
||||||
|
|
||||||
if (strcmp(topicOri,subjectMQTTtoRF) == 0){
|
if (strcmp(topicOri,subjectMQTTtoRF) == 0){
|
||||||
|
|||||||
+2
-2
@@ -100,7 +100,7 @@ void rf2Callback(unsigned int period, unsigned long address, unsigned long group
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTtoRF2(char * topicOri, char * datacallback) {
|
void MQTTtoRF2(char * topicOri, char * datacallback) {
|
||||||
|
|
||||||
// RF DATA ANALYSIS
|
// RF DATA ANALYSIS
|
||||||
@@ -214,7 +214,7 @@ void rf2Callback(unsigned int period, unsigned long address, unsigned long group
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTtoRF2(char * topicOri, JsonObject& RF2data) { // json object decoding
|
void MQTTtoRF2(char * topicOri, JsonObject& RF2data) { // json object decoding
|
||||||
|
|
||||||
if (strcmp(topicOri,subjectMQTTtoRF2) == 0){
|
if (strcmp(topicOri,subjectMQTTtoRF2) == 0){
|
||||||
|
|||||||
+2
-2
@@ -77,7 +77,7 @@ boolean RF315toMQTT(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTtoRF315(char * topicOri, char * datacallback) {
|
void MQTTtoRF315(char * topicOri, char * datacallback) {
|
||||||
|
|
||||||
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
unsigned long data = strtoul(datacallback, NULL, 10); // we will not be able to pass values > 4294967295
|
||||||
@@ -133,7 +133,7 @@ boolean RF315toMQTT(){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTtoRF315(char * topicOri, JsonObject& RF315data) { // json object decoding
|
void MQTTtoRF315(char * topicOri, JsonObject& RF315data) { // json object decoding
|
||||||
|
|
||||||
if (strcmp(topicOri,subjectMQTTtoRF315) == 0){
|
if (strcmp(topicOri,subjectMQTTtoRF315) == 0){
|
||||||
|
|||||||
+2
-2
@@ -179,7 +179,7 @@ boolean RFM69toMQTT(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTtoRFM69(char * topicOri, char * datacallback) {
|
void MQTTtoRFM69(char * topicOri, char * datacallback) {
|
||||||
int loops;
|
int loops;
|
||||||
uint32_t startMillis;
|
uint32_t startMillis;
|
||||||
@@ -228,7 +228,7 @@ boolean RFM69toMQTT(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTtoRFM69(char * topicOri, JsonObject& RFM69data) {
|
void MQTTtoRFM69(char * topicOri, JsonObject& RFM69data) {
|
||||||
|
|
||||||
if (strcmp(topicOri,subjectMQTTtoRFM69) == 0){
|
if (strcmp(topicOri,subjectMQTTtoRFM69) == 0){
|
||||||
|
|||||||
+2
-2
@@ -169,7 +169,7 @@ bool _rfbToChar(byte * in, char * out) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef simplePublishing
|
#ifdef simpleReceiving
|
||||||
void MQTTtoSRFB(char * topicOri, char * datacallback) {
|
void MQTTtoSRFB(char * topicOri, char * datacallback) {
|
||||||
|
|
||||||
// RF DATA ANALYSIS
|
// RF DATA ANALYSIS
|
||||||
@@ -268,7 +268,7 @@ bool _rfbToChar(byte * in, char * out) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef jsonPublishing
|
#ifdef jsonReceiving
|
||||||
void MQTTtoSRFB(char * topicOri, JsonObject& SRFBdata) {
|
void MQTTtoSRFB(char * topicOri, JsonObject& SRFBdata) {
|
||||||
|
|
||||||
// RF DATA ANALYSIS
|
// RF DATA ANALYSIS
|
||||||
|
|||||||
Reference in new issue
Block a user