fix MQTT discovery of custom entity doesn't consider type of data #1587

This commit is contained in:
proddy
2024-02-10 09:51:29 +01:00
parent e6b61b7a51
commit 257b40c2e4
4 changed files with 113 additions and 104 deletions

View File

@@ -441,6 +441,8 @@ void WebCustomEntityService::publish(const bool force) {
}
}
Mqtt::add_ha_uom(config.as<JsonObject>(), entityItem.value_type, entityItem.uom); // add uom
Mqtt::add_ha_sections_to_doc("custom", stat_t, config, !ha_created, val_cond);
ha_created |= Mqtt::queue_ha(topic, config.as<JsonObject>());

View File

@@ -32,7 +32,7 @@ class CustomEntityItem {
uint16_t type_id;
uint8_t offset;
int8_t value_type;
uint8_t uom;
uint8_t uom; // DeviceValueUOM
std::string name;
double factor;
bool writeable;