Mqtt discovery for ha (#323)

* MQTT discovery factoring

* add DHT discovery

* BME topic macro change

* add sensors to ha discovery

* correct a comment typo #327

* let the possibility at buildtime to don't publish service data

* reduce string usage

* change MQTT ONOFF actuator to ON OFF commands instead of true false

* add ZactuatorONOFF discovery

* add simple publishing for GPIO input

* Add RF switch and gateway discovery
This commit is contained in:
Florian authored and GitHub committed 2018-12-16 17:05:30 +01:00
1 parent ed44418a7f
commit 133e9cd33a
21 files changed
+442 -201

No files matched your search

+6 -13
View File
@@ -38,14 +38,13 @@ void setupONOFF(){
trc(F("ZactuatorONOFF setup done "));
}
#ifdef simplePublishing
void MQTTtoONOFF(char * topicOri, char * datacallback){
bool boolSWITCHTYPE;
boolSWITCHTYPE = to_bool(datacallback);
String topic = topicOri;
if (topic == subjectMQTTtoONOFF){
int boolSWITCHTYPE;
if (strcmp(datacallback, "ON") == 0) boolSWITCHTYPE = 1;
if (strcmp(datacallback, "OFF") == 0) boolSWITCHTYPE = 0;
if (strcmp(topicOri,subjectMQTTtoONOFF) == 0){
trc(F("MQTTtoONOFF data analysis"));
trc(boolSWITCHTYPE);
digitalWrite(ACTUATOR_ONOFF_PIN, boolSWITCHTYPE);
@@ -53,14 +52,9 @@ void setupONOFF(){
pub(subjectGTWONOFFtoMQTT, datacallback);
}
}
#endif
#ifdef jsonPublishing
void MQTTtoONOFF(char * topicOri, JsonObject& ONOFFdata){
String topic = topicOri;
if (topic == subjectMQTTtoONOFF){
if (strcmp(topicOri,subjectMQTTtoONOFF) == 0){
trc(F("MQTTtoONOFF json data analysis"));
int boolSWITCHTYPE = ONOFFdata["switchType"] | 99;
if (boolSWITCHTYPE != 99) {
@@ -75,4 +69,3 @@ void setupONOFF(){
}
}
#endif
#endif