valueAsASubject to valueAsATopic inconsistency fix (#1260)
This commit is contained in:
1 parent
312ef858c1
commit
b16fbcbef2
6 files changed
+13
-10
No files matched your search
+3
-2
@@ -456,8 +456,9 @@ int lowpowermode = DEFAULT_LOW_POWER_MODE;
|
||||
#define eraseCmd "erase"
|
||||
#define statusCmd "status"
|
||||
|
||||
// uncomment the line below to integrate msg value into the subject when receiving
|
||||
//#define valueAsASubject true
|
||||
#ifndef valueAsATopic
|
||||
# define valueAsATopic false // define true to integrate msg value into the subject when receiving
|
||||
#endif
|
||||
|
||||
#if defined(ESP32)
|
||||
# define JSON_MSG_BUFFER 768
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ void RFtoMQTTdiscovery(SIGNAL_SIZE_UL_ULL MQTTvalue) {
|
||||
Log.trace(F("RF Entity Discovered, create HA Discovery CFG" CR));
|
||||
char* switchRF[2] = {val, "RF"};
|
||||
Log.trace(F("CreateDiscoverySwitch: %s" CR), switchRF[1]);
|
||||
# ifdef valueAsASubject
|
||||
# if valueAsATopic
|
||||
String discovery_topic = String(subjectRFtoMQTT) + "/" + String(switchRF[0]);
|
||||
# else
|
||||
String discovery_topic = String(subjectRFtoMQTT);
|
||||
|
||||
@@ -50,7 +50,7 @@ void rtl_433_Callback(char* message) {
|
||||
}
|
||||
|
||||
String topic = String(subjectRTL_433toMQTT);
|
||||
# ifdef valueAsASubject
|
||||
# if valueAsATopic
|
||||
String model = RFrtl_433_ESPdata["model"];
|
||||
String id = RFrtl_433_ESPdata["id"];
|
||||
if (model != 0) {
|
||||
|
||||
+2
-2
@@ -313,7 +313,7 @@ void pub(const char* topicori, JsonObject& data) {
|
||||
Log.notice(F("Send on %s msg %s" CR), topicori, dataAsString.c_str());
|
||||
digitalWrite(LED_SEND_RECEIVE, LED_SEND_RECEIVE_ON);
|
||||
String topic = String(mqtt_topic) + String(gateway_name) + String(topicori);
|
||||
#ifdef valueAsASubject
|
||||
#if valueAsATopic
|
||||
# ifdef ZgatewayPilight
|
||||
String value = data["value"];
|
||||
String protocol = data["protocol"];
|
||||
@@ -2100,7 +2100,7 @@ void MQTTtoSYS(char* topicOri, JsonObject& SYSdata) { // json object decoding
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(valueAsASubject) && !defined(ZgatewayPilight)
|
||||
#if valueAsATopic && !defined(ZgatewayPilight)
|
||||
# if defined(ESP32) || defined(ESP8266) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
|
||||
String toString(uint64_t input) {
|
||||
String result = "";
|
||||
|
||||
Reference in new issue
Block a user