mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
HA don't set entity_category to Diagnostic/Configuration for EMS entities
This commit is contained in:
@@ -9,3 +9,5 @@
|
|||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
- HA don't set entity_category to Diagnostic/Configuration for EMS entities [#1459](https://github.com/emsesp/EMS-ESP32/discussions/1459)
|
||||||
|
|||||||
@@ -922,7 +922,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
|
|||||||
// we add the command topic parameter for commands
|
// we add the command topic parameter for commands
|
||||||
if (has_cmd) {
|
if (has_cmd) {
|
||||||
// add category
|
// add category
|
||||||
doc["ent_cat"] = "config"; // for writeable entities, like switch, number, text, select
|
// doc["ent_cat"] = "config"; // for writeable entities, like switch, number, text, select
|
||||||
|
|
||||||
char command_topic[MQTT_TOPIC_MAX_SIZE];
|
char command_topic[MQTT_TOPIC_MAX_SIZE];
|
||||||
// add command topic
|
// add command topic
|
||||||
@@ -1050,8 +1050,11 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
|
|||||||
|
|
||||||
// Add the state class, device class and sometimes the icon. Used only for read-only sensors Sensor and Binary Sensor
|
// Add the state class, device class and sometimes the icon. Used only for read-only sensors Sensor and Binary Sensor
|
||||||
if (readonly_sensors) {
|
if (readonly_sensors) {
|
||||||
// first set the catagory
|
// first set the catagory for System entities
|
||||||
doc["ent_cat"] = "diagnostic";
|
// https://github.com/emsesp/EMS-ESP32/discussions/1459#discussioncomment-7694873
|
||||||
|
if (device_type == EMSdevice::DeviceType::SYSTEM) {
|
||||||
|
doc["ent_cat"] = "diagnostic";
|
||||||
|
}
|
||||||
|
|
||||||
const char * dc_ha = "dev_cla"; // device class
|
const char * dc_ha = "dev_cla"; // device class
|
||||||
const char * sc_ha = "stat_cla"; // state class
|
const char * sc_ha = "stat_cla"; // state class
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ void Shower::set_shower_state(bool state, bool force) {
|
|||||||
doc["unit_of_meas"] = "s";
|
doc["unit_of_meas"] = "s";
|
||||||
doc["stat_cla"] = "measurement";
|
doc["stat_cla"] = "measurement";
|
||||||
doc["dev_cla"] = "duration";
|
doc["dev_cla"] = "duration";
|
||||||
doc["ent_cat"] = "diagnostic";
|
// doc["ent_cat"] = "diagnostic";
|
||||||
|
|
||||||
JsonObject dev2 = doc.createNestedObject("dev");
|
JsonObject dev2 = doc.createNestedObject("dev");
|
||||||
dev2["name"] = "EMS-ESP";
|
dev2["name"] = "EMS-ESP";
|
||||||
@@ -265,7 +265,7 @@ void Shower::set_shower_state(bool state, bool force) {
|
|||||||
|
|
||||||
doc["name"] = "Shower Timestamp";
|
doc["name"] = "Shower Timestamp";
|
||||||
doc["val_tpl"] = "{{value_json.timestamp if value_json.timestamp is defined else 0}}";
|
doc["val_tpl"] = "{{value_json.timestamp if value_json.timestamp is defined else 0}}";
|
||||||
doc["ent_cat"] = "diagnostic";
|
// doc["ent_cat"] = "diagnostic";
|
||||||
|
|
||||||
JsonObject dev3 = doc.createNestedObject("dev");
|
JsonObject dev3 = doc.createNestedObject("dev");
|
||||||
dev3["name"] = "EMS-ESP";
|
dev3["name"] = "EMS-ESP";
|
||||||
|
|||||||
Reference in New Issue
Block a user