@@ -141,20 +141,41 @@ void pubMqttDiscovery() {
141141 0 , // set off_delay
142142 " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
143143 );
144+
145+ # if defined(ESP8266) || defined(ESP32)
144146 createDiscovery (" sensor" , // set Type
145147 subjectSYStoMQTT, " freemem" , (char *)getUniqueId (" freemem" , " " ).c_str (), // set state_topic,name,uniqueId
146148 " " , " " , " {{ value_json.freemem }}" , // set availability_topic,device_class,value_template,
147149 " " , " " , " B" , // set,payload_on,payload_off,unit_of_meas,
148150 0 , // set off_delay
149151 " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
150152 );
153+ createDiscovery (" sensor" , // set Type
154+ subjectSYStoMQTT, " ip" , (char *)getUniqueId (" ip" , " " ).c_str (), // set state_topic,name,uniqueId
155+ " " , " " , " {{ value_json.ip }}" , // set availability_topic,device_class,value_template,
156+ " " , " " , " " , // set,payload_on,payload_off,unit_of_meas,
157+ 0 , // set off_delay
158+ " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
159+ );
160+ # ifndef ESP32_ETHERNET
161+ createDiscovery (" sensor" , // set Type
162+ subjectSYStoMQTT, " rssi" , (char *)getUniqueId (" rssi" , " " ).c_str (), // set state_topic,name,uniqueId
163+ " " , " " , " {{ value_json.rssi }}" , // set availability_topic,device_class,value_template,
164+ " " , " " , " dB" , // set,payload_on,payload_off,unit_of_meas,
165+ 0 , // set off_delay
166+ " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
167+ );
168+ # endif
169+ # endif
170+ # ifdef ESP32
151171 createDiscovery (" sensor" , // set Type
152172 subjectSYStoMQTT, " lowpowermode" , (char *)getUniqueId (" lowpowermode" , " " ).c_str (), // set state_topic,name,uniqueId
153173 " " , " " , " {{ value_json.lowpowermode }}" , // set availability_topic,device_class,value_template,
154174 " " , " " , " " , // set,payload_on,payload_off,unit_of_meas,
155175 0 , // set off_delay
156176 " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
157177 );
178+ # endif
158179 createDiscovery (" switch" , // set Type
159180 will_Topic, " restart gateway" , (char *)getUniqueId (" restart" , " " ).c_str (), // set state_topic,name,uniqueId
160181 will_Topic, " " , " " , // set availability_topic,device_class,value_template,
@@ -495,6 +516,37 @@ void pubMqttDiscovery() {
495516 gateway2G[5 ], gateway2G[6 ], gateway2G[7 ],
496517 0 , " " , " " , true , " " );
497518# endif
519+
520+ # ifdef ZgatewayBT
521+ createDiscovery (" sensor" , // set Type
522+ subjectSYStoMQTT, " interval" , (char *)getUniqueId (" interval" , " " ).c_str (), // set state_topic,name,uniqueId
523+ " " , " " , " {{ value_json.interval }}" , // set availability_topic,device_class,value_template,
524+ " " , " " , " ms" , // set,payload_on,payload_off,unit_of_meas,
525+ 0 , // set off_delay
526+ " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
527+ );
528+ createDiscovery (" sensor" , // set Type
529+ subjectSYStoMQTT, " scanbcnct" , (char *)getUniqueId (" scanbcnct" , " " ).c_str (), // set state_topic,name,uniqueId
530+ " " , " " , " {{ value_json.scanbcnct }}" , // set availability_topic,device_class,value_template,
531+ " " , " " , " " , // set,payload_on,payload_off,unit_of_meas,
532+ 0 , // set off_delay
533+ " " , " " , true , " " // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
534+ );
535+ createDiscovery (" switch" , // set Type
536+ will_Topic, " force scan" , (char *)getUniqueId (" force_scan" , " " ).c_str (), // set state_topic,name,uniqueId
537+ will_Topic, " " , " " , // set availability_topic,device_class,value_template,
538+ " {\" interval\" :0}" , " " , " " , // set,payload_on,payload_off,unit_of_meas,
539+ 0 , // set off_delay
540+ Gateway_AnnouncementMsg, will_Message, true , subjectMQTTtoBTset // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
541+ );
542+ createDiscovery (" switch" , // set Type
543+ " " , " only sensors" , (char *)getUniqueId (" only_sensors" , " " ).c_str (), // set state_topic,name,uniqueId
544+ " " , " " , " " , // set availability_topic,device_class,value_template,
545+ " {\" onlysensors\" :true}" , " {\" onlysensors\" :false}" , " " , // set,payload_on,payload_off,unit_of_meas,
546+ 0 , // set off_delay
547+ Gateway_AnnouncementMsg, will_Message, true , subjectMQTTtoBTset // set,payload_avalaible,payload_not avalaible ,is a child device, command topic
548+ );
549+ # endif
498550}
499551
500552#endif
0 commit comments