mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
Handle case where using enetity level name: None with MQTT (#5897)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
049a7a0113
commit
51428dcbc2
1 changed files with 5 additions and 1 deletions
|
@ -76,7 +76,11 @@ bool MQTTComponent::send_discovery_() {
|
||||||
this->send_discovery(root, config);
|
this->send_discovery(root, config);
|
||||||
|
|
||||||
// Fields from EntityBase
|
// Fields from EntityBase
|
||||||
|
if (this->get_entity()->has_own_name()) {
|
||||||
root[MQTT_NAME] = this->friendly_name();
|
root[MQTT_NAME] = this->friendly_name();
|
||||||
|
} else {
|
||||||
|
root[MQTT_NAME] = "";
|
||||||
|
}
|
||||||
if (this->is_disabled_by_default())
|
if (this->is_disabled_by_default())
|
||||||
root[MQTT_ENABLED_BY_DEFAULT] = false;
|
root[MQTT_ENABLED_BY_DEFAULT] = false;
|
||||||
if (!this->get_icon().empty())
|
if (!this->get_icon().empty())
|
||||||
|
|
Loading…
Reference in a new issue