publish mqtt emsesp on-change messages on connect

This commit is contained in:
MichaelDvP
2025-12-19 17:14:50 +01:00
parent b4affbff6d
commit 1b8b72c443
6 changed files with 42 additions and 21 deletions

View File

@@ -473,10 +473,15 @@ void TemperatureSensor::publish_values(const bool force) {
return;
}
if (force && Mqtt::publish_single()) {
if (force) {
if (Mqtt::publish_single()) {
for (const auto & sensor : sensors_) {
publish_sensor(sensor);
}
return;
} else if (!EMSESP::mqtt_.get_publish_onchange(0)) {
return; // wait for first time periode
}
}
JsonDocument doc;