1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 15:12:21 +01:00

Add area (zone) to esphome core config to be suggested through API and MQTT. (#5602)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Cossid
2023-10-26 17:38:52 -05:00
committed by GitHub
parent cfbf3681f3
commit bcfbcd9578
10 changed files with 31 additions and 3 deletions

View File

@@ -136,6 +136,7 @@ bool MQTTComponent::send_discovery_() {
if (node_friendly_name.empty()) {
node_friendly_name = node_name;
}
const std::string &node_area = App.get_area();
JsonObject device_info = root.createNestedObject(MQTT_DEVICE);
device_info[MQTT_DEVICE_IDENTIFIERS] = get_mac_address();
@@ -143,6 +144,7 @@ bool MQTTComponent::send_discovery_() {
device_info[MQTT_DEVICE_SW_VERSION] = "esphome v" ESPHOME_VERSION " " + App.get_compilation_time();
device_info[MQTT_DEVICE_MODEL] = ESPHOME_BOARD;
device_info[MQTT_DEVICE_MANUFACTURER] = "espressif";
device_info[MQTT_DEVICE_SUGGESTED_AREA] = node_area;
},
0, discovery_info.retain);
}