diff --git a/src/ha.h b/src/ha.h index d559d19..8ebbc6b 100644 --- a/src/ha.h +++ b/src/ha.h @@ -75,6 +75,7 @@ namespace Ha { const char* id = nullptr; const char* type = nullptr; + const char* entityId = nullptr; const char* name = nullptr; const char* entityCategory = nullptr; @@ -111,6 +112,7 @@ namespace Ha { protected: void buildConfig(JsonDocument& jsonDoc) override { if (mainDevice) mainDevice->buildConfig(jsonDoc); + if (entityId) jsonDoc["object_id"] = entityId; if (entityCategory) jsonDoc["entity_category"] = entityCategory; if (deviceClass) jsonDoc["device_class"] = deviceClass; if (icon) jsonDoc["icon"] = icon; @@ -404,6 +406,11 @@ namespace Ha { return *this; } + Builder& withEntityId(const char* value) { + cmp->entityId = value; + return *this; + } + Builder& withUnitMeasure(const char* value) { cmp->unitMeasure = value; return *this;