mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-12 03:04:27 +05:00
fix exception due to mqtt client
This commit is contained in:
@@ -43,6 +43,14 @@ protected:
|
||||
client.setCallback(std::bind(&MqttTask::__callback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
client.setBufferSize(1024);
|
||||
|
||||
haHelper.setYieldCallback([](void* self) {
|
||||
MqttTask* task = static_cast<MqttTask*>(self);
|
||||
task->delay(10);
|
||||
|
||||
if (client.connected()) {
|
||||
client.loop();
|
||||
}
|
||||
}, this);
|
||||
haHelper.setBufferedClient(this->bClient);
|
||||
haHelper.setDevicePrefix(settings.mqtt.prefix);
|
||||
haHelper.setDeviceVersion(PROJECT_VERSION);
|
||||
@@ -64,7 +72,6 @@ protected:
|
||||
client.subscribe(getTopicPath("settings/set").c_str());
|
||||
client.subscribe(getTopicPath("state/set").c_str());
|
||||
publishHaEntities();
|
||||
publishNonStaticHaEntities(true);
|
||||
|
||||
firstFailConnect = 0;
|
||||
lastReconnectAttempt = 0;
|
||||
@@ -85,6 +92,7 @@ protected:
|
||||
|
||||
lastReconnectAttempt = millis();
|
||||
}
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
||||
@@ -399,13 +407,11 @@ protected:
|
||||
haHelper.publishNumberOutdoorSensorOffset(false);
|
||||
haHelper.publishNumberIndoorSensorOffset(false);
|
||||
haHelper.publishSwitchDebug(false);
|
||||
yield();
|
||||
|
||||
// emergency
|
||||
haHelper.publishSwitchEmergency();
|
||||
haHelper.publishNumberEmergencyTarget();
|
||||
haHelper.publishSwitchEmergencyUseEquitherm();
|
||||
yield();
|
||||
|
||||
// heating
|
||||
haHelper.publishSwitchHeating(false);
|
||||
@@ -413,12 +419,10 @@ protected:
|
||||
haHelper.publishNumberHeatingHysteresis();
|
||||
haHelper.publishSensorHeatingSetpoint(false);
|
||||
haHelper.publishSensorCurrentHeatingMinTemp(false);
|
||||
yield();
|
||||
haHelper.publishSensorCurrentHeatingMaxTemp(false);
|
||||
haHelper.publishNumberHeatingMinTemp(false);
|
||||
haHelper.publishNumberHeatingMaxTemp(false);
|
||||
haHelper.publishNumberHeatingMaxModulation(false);
|
||||
yield();
|
||||
|
||||
// pid
|
||||
haHelper.publishSwitchPID();
|
||||
@@ -427,19 +431,16 @@ protected:
|
||||
haHelper.publishNumberPIDFactorD();
|
||||
haHelper.publishNumberPIDMinTemp(false);
|
||||
haHelper.publishNumberPIDMaxTemp(false);
|
||||
yield();
|
||||
|
||||
// equitherm
|
||||
haHelper.publishSwitchEquitherm();
|
||||
haHelper.publishNumberEquithermFactorN();
|
||||
haHelper.publishNumberEquithermFactorK();
|
||||
haHelper.publishNumberEquithermFactorT();
|
||||
yield();
|
||||
|
||||
// tuning
|
||||
haHelper.publishSwitchTuning();
|
||||
haHelper.publishSelectTuningRegulator();
|
||||
yield();
|
||||
|
||||
// states
|
||||
haHelper.publishBinSensorStatus();
|
||||
@@ -448,7 +449,6 @@ protected:
|
||||
haHelper.publishBinSensorFlame();
|
||||
haHelper.publishBinSensorFault();
|
||||
haHelper.publishBinSensorDiagnostic();
|
||||
yield();
|
||||
|
||||
// sensors
|
||||
haHelper.publishSensorModulation(false);
|
||||
@@ -456,12 +456,10 @@ protected:
|
||||
haHelper.publishSensorFaultCode();
|
||||
haHelper.publishSensorRssi(false);
|
||||
haHelper.publishSensorUptime(false);
|
||||
yield();
|
||||
|
||||
// temperatures
|
||||
haHelper.publishNumberIndoorTemp();
|
||||
haHelper.publishSensorHeatingTemp();
|
||||
yield();
|
||||
|
||||
// buttons
|
||||
haHelper.publishButtonRestart(false);
|
||||
@@ -507,7 +505,6 @@ protected:
|
||||
}
|
||||
|
||||
published = true;
|
||||
yield();
|
||||
}
|
||||
|
||||
if (force || _heatingMinTemp != heatingMinTemp || _heatingMaxTemp != heatingMaxTemp) {
|
||||
@@ -523,14 +520,12 @@ protected:
|
||||
haHelper.publishClimateHeating(heatingMinTemp, heatingMaxTemp, isStupidMode ? HaHelper::TEMP_SOURCE_HEATING : HaHelper::TEMP_SOURCE_INDOOR);
|
||||
|
||||
published = true;
|
||||
yield();
|
||||
|
||||
} else if (_isStupidMode != isStupidMode) {
|
||||
_isStupidMode = isStupidMode;
|
||||
haHelper.publishClimateHeating(heatingMinTemp, heatingMaxTemp, isStupidMode ? HaHelper::TEMP_SOURCE_HEATING : HaHelper::TEMP_SOURCE_INDOOR);
|
||||
|
||||
published = true;
|
||||
yield();
|
||||
}
|
||||
|
||||
if (_dhwPresent && (force || _dhwMinTemp != settings.dhw.minTemp || _dhwMaxTemp != settings.dhw.maxTemp)) {
|
||||
@@ -541,7 +536,6 @@ protected:
|
||||
haHelper.publishClimateDhw(settings.dhw.minTemp, settings.dhw.maxTemp);
|
||||
|
||||
published = true;
|
||||
yield();
|
||||
}
|
||||
|
||||
if (force || _editableOutdoorTemp != editableOutdoorTemp) {
|
||||
@@ -556,7 +550,6 @@ protected:
|
||||
}
|
||||
|
||||
published = true;
|
||||
yield();
|
||||
}
|
||||
|
||||
if (force || _editableIndoorTemp != editableIndoorTemp) {
|
||||
|
||||
Reference in New Issue
Block a user