Merge branch 'v1.2.0'
This commit is contained in:
commit
3ec92c43a6
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
|
||||
"name": "ha-mqtt",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"description": "Home Assistant classes for integration with MQTT auto discovery",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
9
src/ha.h
9
src/ha.h
@ -212,7 +212,7 @@ namespace Ha {
|
||||
}
|
||||
|
||||
Builder& addSecondary(Component* c) {
|
||||
if (cmp->mainDevice) c->mainDevice = &DeviceConfig::create(cmp->mainDevice->id);
|
||||
if (cmp->mainDevice) c->mainDevice = &DeviceConfig::create(cmp->mainDevice->id).withName(cmp->mainDevice->name);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -373,7 +373,12 @@ namespace Ha {
|
||||
StateConfig::buildConfig(jsonDoc);
|
||||
if (unitMeasure) jsonDoc["unit_of_measurement"] = unitMeasure;
|
||||
if (valueTemplate) jsonDoc["value_template"] = valueTemplate;
|
||||
jsonDoc["suggested_display_precision"] = precision;
|
||||
if (isNumericSensor()) jsonDoc["suggested_display_precision"] = precision;
|
||||
}
|
||||
|
||||
private:
|
||||
bool isNumericSensor() {
|
||||
return deviceClass || unitMeasure;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user