mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 12:27:13 +01:00
Add network type to mdns service message (#3880)
This commit is contained in:
parent
7171286c3c
commit
01b7c4200e
@ -45,6 +45,12 @@ void MDNSComponent::compile_records_() {
|
||||
|
||||
service.txt_records.push_back({"board", ESPHOME_BOARD});
|
||||
|
||||
#if defined(USE_WIFI)
|
||||
service.txt_records.push_back({"network", "wifi"});
|
||||
#elif defined(USE_ETHERNET)
|
||||
service.txt_records.push_back({"network", "ethernet"});
|
||||
#endif
|
||||
|
||||
#ifdef ESPHOME_PROJECT_NAME
|
||||
service.txt_records.push_back({"project_name", ESPHOME_PROJECT_NAME});
|
||||
service.txt_records.push_back({"project_version", ESPHOME_PROJECT_VERSION});
|
||||
|
@ -613,6 +613,7 @@ class ListDevicesHandler(BaseHandler):
|
||||
"package_import_url": res.package_import_url,
|
||||
"project_name": res.project_name,
|
||||
"project_version": res.project_version,
|
||||
"network": res.network,
|
||||
}
|
||||
for res in IMPORT_RESULT.values()
|
||||
if res.device_name not in configured
|
||||
|
@ -118,6 +118,7 @@ ESPHOME_SERVICE_TYPE = "_esphomelib._tcp.local."
|
||||
TXT_RECORD_PACKAGE_IMPORT_URL = b"package_import_url"
|
||||
TXT_RECORD_PROJECT_NAME = b"project_name"
|
||||
TXT_RECORD_PROJECT_VERSION = b"project_version"
|
||||
TXT_RECORD_NETWORK = b"network"
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -126,6 +127,7 @@ class DiscoveredImport:
|
||||
package_import_url: str
|
||||
project_name: str
|
||||
project_version: str
|
||||
network: str
|
||||
|
||||
|
||||
class DashboardImportDiscovery:
|
||||
@ -134,7 +136,7 @@ class DashboardImportDiscovery:
|
||||
self.service_browser = ServiceBrowser(
|
||||
self.zc, ESPHOME_SERVICE_TYPE, [self._on_update]
|
||||
)
|
||||
self.import_state = {}
|
||||
self.import_state: dict[str, DiscoveredImport] = {}
|
||||
|
||||
def _on_update(
|
||||
self,
|
||||
@ -171,12 +173,14 @@ class DashboardImportDiscovery:
|
||||
import_url = info.properties[TXT_RECORD_PACKAGE_IMPORT_URL].decode()
|
||||
project_name = info.properties[TXT_RECORD_PROJECT_NAME].decode()
|
||||
project_version = info.properties[TXT_RECORD_PROJECT_VERSION].decode()
|
||||
network = info.properties.get(TXT_RECORD_NETWORK, b"wifi").decode()
|
||||
|
||||
self.import_state[name] = DiscoveredImport(
|
||||
device_name=node_name,
|
||||
package_import_url=import_url,
|
||||
project_name=project_name,
|
||||
project_version=project_version,
|
||||
network=network,
|
||||
)
|
||||
|
||||
def cancel(self) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user