feat: add labels to NodeInfo

This commit is contained in:
2025-08-29 13:30:08 +02:00
parent f8e5a9c66f
commit d3a9802ec9
7 changed files with 67 additions and 12 deletions

View File

@@ -16,20 +16,27 @@ ClusterManager cluster(ctx, taskManager);
ApiServer apiServer(ctx, taskManager, ctx.config.api_server_port);
void setup() {
// Setup WiFi first
network.setupWiFi();
// Setup WiFi first
network.setupWiFi();
// Initialize and start all tasks
taskManager.initialize();
// Start the API server
apiServer.begin();
// Print initial task status
taskManager.printTaskStatus();
// Add example labels for this node
auto it = ctx.memberList->find(ctx.hostname);
if (it != ctx.memberList->end()) {
it->second.labels["app"] = "base";
it->second.labels["role"] = "demo";
}
// Initialize and start all tasks
taskManager.initialize();
// Start the API server
apiServer.begin();
// Print initial task status
taskManager.printTaskStatus();
}
void loop() {
taskManager.execute();
yield();
taskManager.execute();
yield();
}

View File

@@ -349,6 +349,15 @@ NeoPixelService neoService(ctx, taskManager, NEOPIXEL_COUNT, NEOPIXEL_PIN, NEOPI
void setup() {
network.setupWiFi();
// Add example labels for this node
auto it = ctx.memberList->find(ctx.hostname);
if (it != ctx.memberList->end()) {
it->second.labels["app"] = "neopixel";
it->second.labels["device"] = "light";
it->second.labels["pixels"] = String(NEOPIXEL_COUNT);
it->second.labels["pin"] = String(NEOPIXEL_PIN);
}
taskManager.initialize();
apiServer.begin();

View File

@@ -107,6 +107,14 @@ void setup() {
// Setup WiFi first
network.setupWiFi();
// Add example labels for this node
auto it = ctx.memberList->find(ctx.hostname);
if (it != ctx.memberList->end()) {
it->second.labels["app"] = "relay";
it->second.labels["device"] = "actuator";
it->second.labels["pin"] = String(RELAY_PIN);
}
// Initialize and start all tasks
taskManager.initialize();