Skip to content

Commit

Permalink
Changed discovery data
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadhyGit committed Sep 30, 2023
1 parent a9df7cd commit de7e1a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/awox_mesh/mesh_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ std::string MeshDevice::device_state_as_string(Device *device) {

std::string MeshDevice::get_discovery_topic_(const MQTTDiscoveryInfo &discovery_info, Device *device) const {
return discovery_info.prefix + "/" + device->device_info->get_component_type() + "/awox-" +
str_sanitize(device->mac) + "/config";
std::to_string(device->mesh_id) + "/config";
}

std::string MeshDevice::get_mqtt_topic_for_(Device *device, const std::string &suffix) const {
Expand Down Expand Up @@ -540,7 +540,8 @@ void MeshDevice::send_discovery(Device *device) {
root["schema"] = "json";

// Entity
root[MQTT_NAME] = nullptr;
// Light can't be null
root[MQTT_NAME] = "Light " + std::to_string(device->mesh_id);
root[MQTT_UNIQUE_ID] = "awox-" + device->mac + "-" + device->device_info->get_component_type();

if (strlen(device->device_info->get_icon()) > 0) {
Expand Down Expand Up @@ -598,7 +599,7 @@ void MeshDevice::send_discovery(Device *device) {

JsonArray identifiers = device_info.createNestedArray(MQTT_DEVICE_IDENTIFIERS);
identifiers.add("esp-awox-mesh-" + std::to_string(device->mesh_id));
identifiers.add(device->mac);
// identifiers.add(device->mac);

device_info[MQTT_DEVICE_NAME] = device->device_info->get_name();

Expand Down

0 comments on commit de7e1a5

Please sign in to comment.