fix double publish scheduler

This commit is contained in:
MichaelDvP
2023-11-08 15:05:40 +01:00
parent 31a5216ae8
commit 5997dd1491

View File

@@ -173,7 +173,6 @@ void Mqtt::loop() {
if (publish_time_other_ && (currentMillis - last_publish_other_ > publish_time_other_)) { if (publish_time_other_ && (currentMillis - last_publish_other_ > publish_time_other_)) {
last_publish_other_ = (currentMillis / publish_time_other_) * publish_time_other_; last_publish_other_ = (currentMillis / publish_time_other_) * publish_time_other_;
EMSESP::publish_other_values(); // switch and heatpump EMSESP::publish_other_values(); // switch and heatpump
EMSESP::webSchedulerService.publish();
} else } else
if (publish_time_sensor_ && (currentMillis - last_publish_sensor_ > publish_time_sensor_)) { if (publish_time_sensor_ && (currentMillis - last_publish_sensor_ > publish_time_sensor_)) {
@@ -330,6 +329,7 @@ void Mqtt::reset_mqtt() {
} }
} }
// load the settings from service
void Mqtt::load_settings() { void Mqtt::load_settings() {
EMSESP::esp8266React.getMqttSettingsService()->read([&](MqttSettings & mqttSettings) { EMSESP::esp8266React.getMqttSettingsService()->read([&](MqttSettings & mqttSettings) {
mqtt_base_ = mqttSettings.base.c_str(); // Convert String to std::string mqtt_base_ = mqttSettings.base.c_str(); // Convert String to std::string
@@ -361,6 +361,7 @@ void Mqtt::load_settings() {
std::replace(mqtt_basename_.begin(), mqtt_basename_.end(), '/', '_'); std::replace(mqtt_basename_.begin(), mqtt_basename_.end(), '/', '_');
} }
// start mqtt
void Mqtt::start() { void Mqtt::start() {
mqttClient_ = EMSESP::esp8266React.getMqttClient(); mqttClient_ = EMSESP::esp8266React.getMqttClient();