feat: set labels in NodeContext/Info
This commit is contained in:
@@ -339,7 +339,12 @@ private:
|
||||
uint8_t brightness;
|
||||
};
|
||||
|
||||
NodeContext ctx;
|
||||
NodeContext ctx({
|
||||
{"app", "neopixel"},
|
||||
{"device", "light"},
|
||||
{"pixels", String(NEOPIXEL_COUNT)},
|
||||
{"pin", String(NEOPIXEL_PIN)}
|
||||
});
|
||||
NetworkManager network(ctx);
|
||||
TaskManager taskManager(ctx);
|
||||
ClusterManager cluster(ctx, taskManager);
|
||||
@@ -347,16 +352,9 @@ ApiServer apiServer(ctx, taskManager, ctx.config.api_server_port);
|
||||
NeoPixelService neoService(ctx, taskManager, NEOPIXEL_COUNT, NEOPIXEL_PIN, NEOPIXEL_TYPE);
|
||||
|
||||
void setup() {
|
||||
network.setupWiFi();
|
||||
Serial.begin(115200);
|
||||
|
||||
// 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);
|
||||
}
|
||||
network.setupWiFi();
|
||||
|
||||
taskManager.initialize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user