[RF] HA: RF modules as sensors. Subscribe topic, according valueAsATopic (#2134)

This commit is contained in:
peshovec authored and GitHub committed 2025-01-25 12:53:24 -06:00
1 parent cd35520bb0
commit d837dfd32a
2 files changed
+21 -3

No files matched your search

+18 -3
View File
@@ -1083,7 +1083,12 @@ void pubMqttDiscovery() {
//trc(gatewayRF[1]); //trc(gatewayRF[1]);
createDiscovery(gatewayRF[0], createDiscovery(gatewayRF[0],
subjectRFtoMQTT, gatewayRF[1], (char*)getUniqueId(gatewayRF[1], gatewayRF[2]).c_str(), # if valueAsATopic
subjectRFtoMQTTvalueAsATopic,
# else
subjectRFtoMQTT,
# endif
gatewayRF[1], (char*)getUniqueId(gatewayRF[1], gatewayRF[2]).c_str(),
will_Topic, gatewayRF[3], gatewayRF[4], will_Topic, gatewayRF[3], gatewayRF[4],
gatewayRF[5], gatewayRF[6], gatewayRF[7], gatewayRF[5], gatewayRF[6], gatewayRF[7],
0, Gateway_AnnouncementMsg, will_Message, true, "", 0, Gateway_AnnouncementMsg, will_Message, true, "",
@@ -1101,7 +1106,12 @@ void pubMqttDiscovery() {
//trc(gatewayRF2[1]); //trc(gatewayRF2[1]);
createDiscovery(gatewayRF2[0], createDiscovery(gatewayRF2[0],
subjectRF2toMQTT, gatewayRF2[1], (char*)getUniqueId(gatewayRF2[1], gatewayRF2[2]).c_str(), # if valueAsATopic
subjectRF2toMQTTvalueAsATopic,
# else
subjectRF2toMQTT,
# endif
gatewayRF2[1], (char*)getUniqueId(gatewayRF2[1], gatewayRF2[2]).c_str(),
will_Topic, gatewayRF2[3], gatewayRF2[4], will_Topic, gatewayRF2[3], gatewayRF2[4],
gatewayRF2[5], gatewayRF2[6], gatewayRF2[7], gatewayRF2[5], gatewayRF2[6], gatewayRF2[7],
0, Gateway_AnnouncementMsg, will_Message, true, "", 0, Gateway_AnnouncementMsg, will_Message, true, "",
@@ -1202,7 +1212,12 @@ void pubMqttDiscovery() {
//trc(gatewayPilight[1]); //trc(gatewayPilight[1]);
createDiscovery(gatewayPilight[0], createDiscovery(gatewayPilight[0],
subjectPilighttoMQTT, gatewayPilight[1], (char*)getUniqueId(gatewayPilight[1], gatewayPilight[2]).c_str(), # if valueAsATopic
subjectPilighttoMQTTvalueAsATopic,
# else
subjectPilighttoMQTT,
# endif
gatewayPilight[1], (char*)getUniqueId(gatewayPilight[1], gatewayPilight[2]).c_str(),
will_Topic, gatewayPilight[3], gatewayPilight[4], will_Topic, gatewayPilight[3], gatewayPilight[4],
gatewayPilight[5], gatewayPilight[6], gatewayPilight[7], gatewayPilight[5], gatewayPilight[6], gatewayPilight[7],
0, Gateway_AnnouncementMsg, will_Message, true, "", 0, Gateway_AnnouncementMsg, will_Message, true, "",
+3
View File
@@ -146,6 +146,7 @@ const char parameters[51][4][24] = {
//433Mhz MQTT Subjects and keys //433Mhz MQTT Subjects and keys
#define subjectMQTTtoRF "/commands/MQTTto433" #define subjectMQTTtoRF "/commands/MQTTto433"
#define subjectRFtoMQTT "/433toMQTT" #define subjectRFtoMQTT "/433toMQTT"
#define subjectRFtoMQTTvalueAsATopic "/433toMQTT/#"
#define subjectcommonRFtoMQTT "/RFtoMQTT" #define subjectcommonRFtoMQTT "/RFtoMQTT"
#define subjectGTWRFtoMQTT "/433toMQTT" #define subjectGTWRFtoMQTT "/433toMQTT"
#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
@@ -164,6 +165,7 @@ const char parameters[51][4][24] = {
//433Mhz newremoteswitch MQTT Subjects and keys //433Mhz newremoteswitch MQTT Subjects and keys
#define subjectMQTTtoRF2 "/commands/MQTTtoRF2" #define subjectMQTTtoRF2 "/commands/MQTTtoRF2"
#define subjectRF2toMQTT "/RF2toMQTT" #define subjectRF2toMQTT "/RF2toMQTT"
#define subjectRF2toMQTTvalueAsATopic "/RF2toMQTT/#"
#define subjectGTWRF2toMQTT "/RF2toMQTT" #define subjectGTWRF2toMQTT "/RF2toMQTT"
#define RF2codeKey "ADDRESS_" // code will be defined if a subject contains RF2codeKey followed by a value of 7 digits #define RF2codeKey "ADDRESS_" // code will be defined if a subject contains RF2codeKey followed by a value of 7 digits
#define RF2periodKey "PERIOD_" // period will be defined if a subject contains RF2periodKey followed by a value of 3 digits #define RF2periodKey "PERIOD_" // period will be defined if a subject contains RF2periodKey followed by a value of 3 digits
@@ -176,6 +178,7 @@ const char parameters[51][4][24] = {
#define subjectMQTTtoPilight "/commands/MQTTtoPilight" #define subjectMQTTtoPilight "/commands/MQTTtoPilight"
#define subjectMQTTtoPilightProtocol "/commands/MQTTtoPilight/protocols" #define subjectMQTTtoPilightProtocol "/commands/MQTTtoPilight/protocols"
#define subjectPilighttoMQTT "/PilighttoMQTT" #define subjectPilighttoMQTT "/PilighttoMQTT"
#define subjectPilighttoMQTTvalueAsATopic "/PilighttoMQTT/#"
#define subjectGTWPilighttoMQTT "/PilighttoMQTT" #define subjectGTWPilighttoMQTT "/PilighttoMQTT"
#define repeatPilightwMQTT false // do we repeat a received signal by using MQTT with Pilight gateway #define repeatPilightwMQTT false // do we repeat a received signal by using MQTT with Pilight gateway
//#define Pilight_rawEnabled true // enables Pilight RAW return - switchable via MQTT //#define Pilight_rawEnabled true // enables Pilight RAW return - switchable via MQTT