clang auto formatting

This commit is contained in:
Proddy
2023-05-27 09:42:33 +02:00
parent 551b2d900e
commit 91f0da84d2
31 changed files with 178 additions and 180 deletions

View File

@@ -593,7 +593,7 @@ void Mqtt::on_connect() {
// publish to the last will topic (see Mqtt::start() function) to say we're alive
queue_publish_retain("status", "online", true); // with retain on
mqtt_publish_fails_ = 0; // reset fail count to 0
mqtt_publish_fails_ = 0; // reset fail count to 0
/*
// for debugging only
@@ -774,7 +774,7 @@ void Mqtt::queue_remove_topic(const char * topic) {
if (ha_enabled_) {
queue_publish_message(Mqtt::discovery_prefix() + topic, "", true); // publish with retain to remove from broker
} else {
queue_publish_message(topic, "", true); // publish with retain to remove from broker
queue_publish_message(topic, "", true); // publish with retain to remove from broker
}
}
@@ -786,7 +786,7 @@ void Mqtt::queue_ha(const char * topic, const JsonObject & payload) {
std::string payload_text;
payload_text.reserve(measureJson(payload) + 1);
serializeJson(payload, payload_text); // convert json to string
serializeJson(payload, payload_text); // convert json to string
queue_publish_message(Mqtt::discovery_prefix() + topic, payload_text, true); // with retain true
}
@@ -1064,7 +1064,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
if (type == DeviceValueType::BOOL) {
snprintf(topic, sizeof(topic), "binary_sensor/%s", config_topic); // binary sensor (for booleans)
} else {
snprintf(topic, sizeof(topic), "sensor/%s", config_topic); // normal HA sensor
snprintf(topic, sizeof(topic), "sensor/%s", config_topic); // normal HA sensor
}
}
@@ -1079,13 +1079,13 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
// build the payload
StaticJsonDocument<EMSESP_JSON_SIZE_LARGE> doc;
doc["uniq_id"] = uniq_id;
doc["obj_id"] = uniq_id; // same as unique_id
doc["obj_id"] = uniq_id; // same as unique_id
const char * ic_ha = "ic"; // icon - only set this if there is no device class
const char * sc_ha = "stat_cla"; // state class
const char * uom_ha = "unit_of_meas"; // unit of measure
char sample_val[30] = "0"; // sample, correct(!) entity value, used only to prevent warning/error in HA if real value is not published yet
char sample_val[30] = "0"; // sample, correct(!) entity value, used only to prevent warning/error in HA if real value is not published yet
// handle commands, which are device entities that are writable
// we add the command topic parameter
@@ -1157,7 +1157,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
} else {
snprintf(ha_name, sizeof(ha_name), "%s", F_name); // no tag
}
free(F_name); // very important!
free(F_name); // very important!
doc["name"] = ha_name;
// value template
@@ -1371,7 +1371,7 @@ void Mqtt::publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp,
if (Mqtt::entity_format() == entitiyFormat::MULTI_SHORT) {
snprintf(uniq_id_s, sizeof(uniq_id_s), "%s_thermostat_hc%d", mqtt_basename_.c_str(), hc_num); // add basename
} else {
snprintf(uniq_id_s, sizeof(uniq_id_s), "thermostat_hc%d", hc_num); // backward compatible with v3.4
snprintf(uniq_id_s, sizeof(uniq_id_s), "thermostat_hc%d", hc_num); // backward compatible with v3.4
}
snprintf(temp_cmd_s, sizeof(temp_cmd_s), "~/thermostat/hc%d/seltemp", hc_num);