diff --git a/gateway/include/ha.h b/gateway/include/ha.h index e37bbaa..c280d02 100644 --- a/gateway/include/ha.h +++ b/gateway/include/ha.h @@ -160,14 +160,19 @@ namespace Ha { return *this; } - Builder& asSecondary(Component* c) { - c->mainDevice = &DeviceConfig::create(cmp->id); + Builder& addSecondary(Component* c) { + if (cmp->mainDevice) c->mainDevice = &DeviceConfig::create(cmp->mainDevice->id); return *this; } - Builder& asDiagnostic(Component* c) { + Builder& addDiagnostic(Component* c) { c->entityCategory = "diagnostic"; - return asSecondary(c); + return addSecondary(c); + } + + Builder& addConfiguration(Component* c) { + c->entityCategory = "config"; + return addSecondary(c); } Builder& asDevice(DeviceConfig* deviceConfig) {