mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Merge branch 'mdns_extra' into integration
This commit is contained in:
		| @@ -93,6 +93,9 @@ async def to_code(config): | ||||
|     var = cg.new_Pvariable(config[CONF_ID]) | ||||
|     await cg.register_component(var, config) | ||||
|  | ||||
|     if config[CONF_SERVICES]: | ||||
|         cg.add_define("USE_MDNS_EXTRA_SERVICES") | ||||
|  | ||||
|     for service in config[CONF_SERVICES]: | ||||
|         txt = [ | ||||
|             cg.StructInitializer( | ||||
|   | ||||
| @@ -104,7 +104,9 @@ void MDNSComponent::compile_records_() { | ||||
|   } | ||||
| #endif | ||||
|  | ||||
| #ifdef USE_MDNS_EXTRA_SERVICES | ||||
|   this->services_.insert(this->services_.end(), this->services_extra_.begin(), this->services_extra_.end()); | ||||
| #endif | ||||
|  | ||||
|   if (this->services_.empty()) { | ||||
|     // Publish "http" service if not using native API | ||||
|   | ||||
| @@ -35,14 +35,18 @@ class MDNSComponent : public Component { | ||||
| #endif | ||||
|   float get_setup_priority() const override { return setup_priority::AFTER_CONNECTION; } | ||||
|  | ||||
| #ifdef USE_MDNS_EXTRA_SERVICES | ||||
|   void add_extra_service(MDNSService service) { services_extra_.push_back(std::move(service)); } | ||||
| #endif | ||||
|  | ||||
|   std::vector<MDNSService> get_services(); | ||||
|  | ||||
|   void on_shutdown() override; | ||||
|  | ||||
|  protected: | ||||
| #ifdef USE_MDNS_EXTRA_SERVICES | ||||
|   std::vector<MDNSService> services_extra_{}; | ||||
| #endif | ||||
|   std::vector<MDNSService> services_{}; | ||||
|   std::string hostname_; | ||||
|   void compile_records_(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user