Add global names to Dallas sensors to avoid ugly <unknown> and other issues in HA

This commit is contained in:
fauthd
2021-03-16 16:00:23 +01:00
parent c17749bd22
commit beab0f0c77

View File

@@ -379,8 +379,11 @@ void DallasSensor::publish_values(const bool force) {
config["uniq_id"] = str;
JsonObject dev = config.createNestedObject("dev");
dev["name"] = FJSON("EMS-ESP Dallas"); // Global name for device (all Dallas sensors, avoids using the very first name for the group)
dev["mf"] = FJSON("Dallas"); // Manufacturer (avoids the ugly <unknown> in HA)
dev["mdl"] = FJSON("1Wire"); // Model (avoids the ugly <unknown> in HA)
JsonArray ids = dev.createNestedArray("ids");
ids.add("ems-esp");
ids.add("ems-esp-dallas"); // Different ids as the other portions of the EMS-ESP
char topic[100];
if (dallas_format == Mqtt::Dallas_Format::SENSORID) {