Skip to content

Commit

Permalink
MQTT Hass: Remove no more required checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Sep 24, 2024
1 parent d899ea7 commit 2791004
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/MqttHandleHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,6 @@ void MqttHandleHassClass::publishDtuSensor(const String& name, const String& sta
String id = name;
id.toLowerCase();
id.replace(" ", "_");
String topic = state_topic;
if (topic == "") {
topic = id;
}

JsonDocument root;

Expand All @@ -383,7 +379,7 @@ void MqttHandleHassClass::publishDtuSensor(const String& name, const String& sta
if (unit_of_measure != "") {
root["unit_of_meas"] = unit_of_measure;
}
root["stat_t"] = MqttSettings.getPrefix() + "dtu" + "/" + topic;
root["stat_t"] = MqttSettings.getPrefix() + "dtu" + "/" + state_topic;

root["avty_t"] = MqttSettings.getPrefix() + Configuration.get().Mqtt.Lwt.Topic;

Expand All @@ -409,16 +405,11 @@ void MqttHandleHassClass::publishDtuBinarySensor(const String& name, const Strin
id.toLowerCase();
id.replace(" ", "_");

String topic = state_topic;
if (state_topic == "") {
topic = String("dtu/") + "/" + id;
}

JsonDocument root;

root["name"] = name;
root["uniq_id"] = getDtuUniqueId() + "_" + id;
root["stat_t"] = MqttSettings.getPrefix() + topic;
root["stat_t"] = MqttSettings.getPrefix() + state_topic;
root["pl_on"] = payload_on;
root["pl_off"] = payload_off;

Expand Down

0 comments on commit 2791004

Please sign in to comment.