From 9b2e33258711a94725447b6757ecb0d676fc4d42 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Wed, 29 May 2024 16:08:05 +0200 Subject: [PATCH] rename secondary entities and add support for configuration type entity --- gateway/include/ha.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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) {