set energy entities to HA-category diagnostic (metioned on discord)

This commit is contained in:
MichaelDvP
2023-11-03 20:00:16 +01:00
parent 6df1f2850f
commit 6c17d61baf

View File

@@ -881,7 +881,6 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
break; break;
case DeviceValueType::STRING: case DeviceValueType::STRING:
snprintf(topic, sizeof(topic), "text/%s", config_topic); // e.g. set_datetime, set_holiday, set_wwswitchtime snprintf(topic, sizeof(topic), "text/%s", config_topic); // e.g. set_datetime, set_holiday, set_wwswitchtime
set_ha_classes = true;
break; break;
default: default:
// plain old sensor // plain old sensor
@@ -1130,7 +1129,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
// add category "diagnostic" for system entities // add category "diagnostic" for system entities
// config for writeable entities, like switches. diagnostic for read only sensors. // config for writeable entities, like switches. diagnostic for read only sensors.
doc["ent_cat"] = (has_cmd) ? "config" : "diagnostic"; doc["ent_cat"] = (has_cmd && !set_ha_classes) ? "config" : "diagnostic";
// add the dev json object to the end // add the dev json object to the end
doc["dev"] = dev_json; doc["dev"] = dev_json;