mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Add MDNS discovery
This commit is contained in:
parent
510565ca51
commit
11f695aff7
@ -1299,12 +1299,13 @@ void dispatch_get_discovery_data(JsonDocument& doc)
|
||||
{
|
||||
char buffer[64];
|
||||
|
||||
doc[F("node")] = haspDevice.get_hostname();
|
||||
doc[F("mdl")] = haspDevice.get_model();
|
||||
doc[F("mf")] = F(D_MANUFACTURER);
|
||||
doc[F("hwid")] = haspDevice.get_hardware_id();
|
||||
doc[F("pages")] = haspPages.count();
|
||||
doc[F("sw")] = haspDevice.get_version();
|
||||
doc[F("node")] = haspDevice.get_hostname();
|
||||
doc[F("mdl")] = haspDevice.get_model();
|
||||
doc[F("mf")] = F(D_MANUFACTURER);
|
||||
doc[F("hwid")] = haspDevice.get_hardware_id();
|
||||
doc[F("pages")] = haspPages.count();
|
||||
doc[F("sw")] = haspDevice.get_version();
|
||||
doc[F("node_t")] = String("hasp/") + haspDevice.get_hostname() + "/";
|
||||
|
||||
#if HASP_USE_HTTP > 0
|
||||
network_get_ipaddress(buffer, sizeof(buffer));
|
||||
|
@ -70,18 +70,13 @@ void mdnsStart()
|
||||
strcpy_P(service, PSTR("openhasp"));
|
||||
MDNS.addService(service, proto, 80);
|
||||
|
||||
strcpy_P(key, PSTR("version"));
|
||||
MDNS.addServiceTxt(service, proto, key, haspDevice.get_version());
|
||||
|
||||
// strcpy_P(key, PSTR("name"));
|
||||
// strcpy_P(value, PSTR(D_MANUFACTURER));
|
||||
// MDNS.addServiceTxt(service, proto, key, value);
|
||||
|
||||
strcpy_P(key, PSTR("discovery"));
|
||||
StaticJsonDocument<1024> doc;
|
||||
dispatch_get_discovery_data(doc);
|
||||
size_t len = serializeJson(doc, value);
|
||||
MDNS.addServiceTxt(service, proto, key, value);
|
||||
|
||||
JsonObject data = doc.as<JsonObject>();
|
||||
for(JsonPair i : data) {
|
||||
MDNS.addServiceTxt(service, proto, i.key().c_str(), i.value().as<String>());
|
||||
}
|
||||
|
||||
// if(debugTelnetEnabled) {
|
||||
strcpy_P(service, PSTR("telnet"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user