add support of unitMeasure for Numbers
This commit is contained in:
parent
4037ede011
commit
94ff72aefc
2
src/ha.h
2
src/ha.h
@ -245,6 +245,7 @@ namespace Ha {
|
|||||||
unsigned int min = 1;
|
unsigned int min = 1;
|
||||||
unsigned int max = 100;
|
unsigned int max = 100;
|
||||||
unsigned int step = 1;
|
unsigned int step = 1;
|
||||||
|
const char* unitMeasure = nullptr;
|
||||||
|
|
||||||
Number(const char* name, const char* id, onMessage f) : Component(id, name, "number"), StatefulCommand(this, f) {}
|
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["min"] = min;
|
||||||
jsonDoc["max"] = max;
|
jsonDoc["max"] = max;
|
||||||
jsonDoc["step"] = step;
|
jsonDoc["step"] = step;
|
||||||
|
if (unitMeasure) jsonDoc["unit_of_measurement"] = unitMeasure;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user