feat: set labels in NodeContext/Info

This commit is contained in:
2025-08-29 20:21:11 +02:00
parent d3a9802ec9
commit fe045804cb
7 changed files with 61 additions and 42 deletions

View File

@@ -96,7 +96,11 @@ private:
bool relayOn;
};
NodeContext ctx;
NodeContext ctx({
{"app", "relay"},
{"device", "actuator"},
{"pin", String(RELAY_PIN)}
});
NetworkManager network(ctx);
TaskManager taskManager(ctx);
ClusterManager cluster(ctx, taskManager);
@@ -104,17 +108,11 @@ ApiServer apiServer(ctx, taskManager, ctx.config.api_server_port);
RelayService relayService(ctx, taskManager, RELAY_PIN);
void setup() {
Serial.begin(115200);
// 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();