From 94ff72aefc7ee1a019ab0778e141caebfdacfd81 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Wed, 26 Mar 2025 13:37:38 +0100 Subject: [PATCH] add support of unitMeasure for Numbers --- src/ha.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ha.h b/src/ha.h index c7e5bfb..ce7af34 100644 --- a/src/ha.h +++ b/src/ha.h @@ -245,6 +245,7 @@ namespace Ha { unsigned int min = 1; unsigned int max = 100; unsigned int step = 1; + const char* unitMeasure = nullptr; Number(const char* name, const char* id, onMessage f) : Component(id, name, "number"), StatefulCommand(this, f) {} @@ -258,6 +259,7 @@ namespace Ha { jsonDoc["min"] = min; jsonDoc["max"] = max; jsonDoc["step"] = step; + if (unitMeasure) jsonDoc["unit_of_measurement"] = unitMeasure; } };