upadte esp mqtt client

This commit is contained in:
technyon
2023-02-26 14:34:08 +01:00
parent 8fd17206dd
commit b14ea6326e
27 changed files with 454 additions and 203 deletions

View File

@@ -25,7 +25,7 @@ EthLan8720Device::EthLan8720Device(const String& hostname, Preferences* _prefere
{
Log->println(F("MQTT over TLS."));
Log->println(_ca);
_mqttClientSecure = new espMqttClientSecureAsync();
_mqttClientSecure = new espMqttClientWifiSecure();
_mqttClientSecure->setCACert(_ca);
if(crtLength > 1 && keyLength > 1) // length is 1 when empty
{
@@ -38,7 +38,7 @@ EthLan8720Device::EthLan8720Device(const String& hostname, Preferences* _prefere
} else
{
Log->println(F("MQTT without TLS."));
_mqttClient = new espMqttClientAsync();
_mqttClient = new espMqttClientWifi();
}
if(_preferences->getBool(preference_mqtt_log_enabled))
@@ -112,11 +112,11 @@ void EthLan8720Device::update()
{
if(_useEncryption)
{
_mqttClientSecure->loop();
_mqttClientSecure->update();
}
else
{
_mqttClient->loop();
_mqttClient->update();
}
}