mirror of
https://github.com/Fishwaldo/WLED.git
synced 2025-07-13 00:18:37 +00:00
Auto node discovery.
This commit is contained in:
parent
0266370218
commit
dd433d8af0
9 changed files with 601 additions and 393 deletions
|
@ -533,6 +533,24 @@ void serializeInfo(JsonObject root)
|
|||
root[F("brand")] = "WLED";
|
||||
root[F("product")] = F("FOSS");
|
||||
root["mac"] = escapedMac;
|
||||
|
||||
JsonArray nodes = root.createNestedArray("nodes");
|
||||
IPAddress ip = WiFi.localIP();
|
||||
for (NodesMap::iterator it = Nodes.begin(); it != Nodes.end(); ++it)
|
||||
{
|
||||
if (it->second.ip[0] != 0)
|
||||
{
|
||||
bool isThisUnit = it->first == ip[3];
|
||||
|
||||
if (isThisUnit) continue;
|
||||
|
||||
JsonObject node = nodes.createNestedObject();
|
||||
node[F("name")] = it->second.nodeName;
|
||||
node[F("type")] = getNodeTypeDisplayString(it->second.nodeType);
|
||||
node[F("ip")] = it->second.ip.toString();
|
||||
node[F("age")] = it->second.age;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void serveJson(AsyncWebServerRequest* request)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue