feat: set labels in NodeContext/Info
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user