mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix for HA topic names. HA doesn't like - in the name
This commit is contained in:
@@ -383,7 +383,8 @@ void DallasSensor::publish_values(const bool force) {
|
|||||||
ids.add("ems-esp");
|
ids.add("ems-esp");
|
||||||
|
|
||||||
char topic[100];
|
char topic[100];
|
||||||
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/sensor/%s/dallas_%s/config"), Mqtt::base().c_str(), sensor.to_string().c_str());
|
// use sensor number as HA doesn't like '-' in the topic name
|
||||||
|
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/sensor/%s/dallas_sensor%d/config"), Mqtt::base().c_str(), sensor_no);
|
||||||
Mqtt::publish_ha(topic, config.as<JsonObject>());
|
Mqtt::publish_ha(topic, config.as<JsonObject>());
|
||||||
|
|
||||||
registered_ha_[sensor_no - 1] = true;
|
registered_ha_[sensor_no - 1] = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user