1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 15:55:46 +00:00

Add HA Entity Category support to MQTT (#2678)

This commit is contained in:
Paul Monigatti
2021-11-08 22:03:30 +13:00
committed by GitHub
parent be9439f10d
commit a17a6d5346
2 changed files with 14 additions and 0 deletions

View File

@@ -77,6 +77,17 @@ bool MQTTComponent::send_discovery_() {
if (!this->get_icon().empty())
root[MQTT_ICON] = this->get_icon();
switch (this->get_entity()->get_entity_category()) {
case ENTITY_CATEGORY_NONE:
break;
case ENTITY_CATEGORY_CONFIG:
root[MQTT_ENTITY_CATEGORY] = "config";
break;
case ENTITY_CATEGORY_DIAGNOSTIC:
root[MQTT_ENTITY_CATEGORY] = "diagnostic";
break;
}
if (config.state_topic)
root[MQTT_STATE_TOPIC] = this->get_state_topic_();
if (config.command_topic)