more to psram, names for sensors, schedule, custom as char[20]

This commit is contained in:
MichaelDvP
2025-12-11 16:00:24 +01:00
parent ac982cbb15
commit 7a683d3637
20 changed files with 371 additions and 439 deletions

View File

@@ -47,7 +47,7 @@ bool Mqtt::send_response_;
bool Mqtt::publish_single_;
bool Mqtt::publish_single2cmd_;
std::vector<Mqtt::MQTTSubFunction> Mqtt::mqtt_subfunctions_;
std::vector<Mqtt::MQTTSubFunction, AllocatorPSRAM<Mqtt::MQTTSubFunction>> Mqtt::mqtt_subfunctions_;
uint32_t Mqtt::mqtt_publish_fails_ = 0;
bool Mqtt::connecting_ = false;
@@ -119,7 +119,7 @@ void Mqtt::resubscribe() {
}
for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
queue_subscribe_message(mqtt_subfunction.topic_);
queue_subscribe_message(mqtt_subfunction.topic_.c_str());
}
}
@@ -1511,4 +1511,16 @@ void Mqtt::add_ha_bool(JsonObject doc) {
}
}
// adds the bool depending on bool setting
void Mqtt::add_value_bool(JsonObject doc, const char * name, bool value) {
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
doc[name] = value;
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
doc[name] = value ? 1 : 0;
} else {
char result[12];
doc[name] = Helpers::render_boolean(result, value);
}
}
} // namespace emsesp