Import/Export config over MQTT
This commit is contained in:
@@ -72,7 +72,7 @@ void EthernetDevice::initialize()
|
||||
if(ethCriticalFailure)
|
||||
{
|
||||
ethCriticalFailure = false;
|
||||
Log->println(("Failed to initialize ethernet hardware"));
|
||||
Log->println("Failed to initialize ethernet hardware");
|
||||
Log->println("Network device has a critical failure, enable fallback to Wi-Fi and reboot.");
|
||||
wifiFallback = true;
|
||||
delay(200);
|
||||
@@ -80,11 +80,11 @@ void EthernetDevice::initialize()
|
||||
return;
|
||||
}
|
||||
|
||||
Log->println(("Init Ethernet"));
|
||||
Log->println("Init Ethernet");
|
||||
|
||||
if(_useSpi)
|
||||
{
|
||||
Log->println(("Use SPI"));
|
||||
Log->println("Use SPI");
|
||||
ethCriticalFailure = true;
|
||||
SPI.begin(_spi_sck, _spi_miso, _spi_mosi);
|
||||
_hardwareInitialized = ETH.begin(_type, _phy_addr, _cs, _irq, _rst, SPI);
|
||||
@@ -93,7 +93,7 @@ void EthernetDevice::initialize()
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
else
|
||||
{
|
||||
Log->println(("Use RMII"));
|
||||
Log->println("Use RMII");
|
||||
|
||||
// Workaround for failing RMII initialization with pioarduino 3.1.0
|
||||
// Revoke all GPIO's some of them set by init PSRAM in IDF
|
||||
@@ -118,7 +118,7 @@ void EthernetDevice::initialize()
|
||||
|
||||
if(_hardwareInitialized)
|
||||
{
|
||||
Log->println(("Ethernet hardware Initialized"));
|
||||
Log->println("Ethernet hardware Initialized");
|
||||
wifiFallback = false;
|
||||
|
||||
if(_useSpi && !_ipConfiguration->dhcpEnabled())
|
||||
@@ -133,7 +133,7 @@ void EthernetDevice::initialize()
|
||||
}
|
||||
else
|
||||
{
|
||||
Log->println(("Failed to initialize ethernet hardware"));
|
||||
Log->println("Failed to initialize ethernet hardware");
|
||||
Log->println("Network device has a critical failure, enable fallback to Wi-Fi and reboot.");
|
||||
wifiFallback = true;
|
||||
delay(200);
|
||||
@@ -150,7 +150,7 @@ void EthernetDevice::update()
|
||||
{
|
||||
if(_ipConfiguration->ipAddress() != ETH.localIP())
|
||||
{
|
||||
Log->println(("ETH Set static IP"));
|
||||
Log->println("ETH Set static IP");
|
||||
ETH.config(_ipConfiguration->ipAddress(), _ipConfiguration->defaultGateway(), _ipConfiguration->subnet(), _ipConfiguration->dnsServer());
|
||||
_checkIpTs = espMillis() + 5000;
|
||||
return;
|
||||
|
||||
@@ -16,20 +16,20 @@ IPConfiguration::IPConfiguration(Preferences *preferences)
|
||||
_gateway.fromString(_preferences->getString(preference_ip_gateway, ""));
|
||||
_dnsServer.fromString(_preferences->getString(preference_ip_dns_server, ""));
|
||||
|
||||
Log->print(("IP configuration: "));
|
||||
Log->print("IP configuration: ");
|
||||
if(dhcpEnabled())
|
||||
{
|
||||
Log->println(("DHCP"));
|
||||
Log->println("DHCP");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log->print(("IP address: "));
|
||||
Log->print("IP address: ");
|
||||
Log->print(ipAddress());
|
||||
Log->print((", Subnet: "));
|
||||
Log->print(", Subnet: ");
|
||||
Log->print(subnet());
|
||||
Log->print((", Gateway: "));
|
||||
Log->print(", Gateway: ");
|
||||
Log->print(defaultGateway());
|
||||
Log->print((", DNS: "));
|
||||
Log->print(", DNS: ");
|
||||
Log->println(dnsServer());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ void NetworkDevice::init()
|
||||
if(ca_cert.length() > 1)
|
||||
{
|
||||
_useEncryption = true;
|
||||
Log->println(("MQTT over TLS."));
|
||||
Log->println("MQTT over TLS.");
|
||||
_mqttClientSecure = new espMqttClientSecure(espMqttClientTypes::UseInternalTask::NO);
|
||||
_mqttClientSecure->setCACert(caDest);
|
||||
|
||||
@@ -57,7 +57,7 @@ void NetworkDevice::init()
|
||||
|
||||
if(cert.length() > 1 && key.length() > 1)
|
||||
{
|
||||
Log->println(("MQTT with client certificate."));
|
||||
Log->println("MQTT with client certificate.");
|
||||
_mqttClientSecure->setCertificate(certDest);
|
||||
_mqttClientSecure->setPrivateKey(keyDest);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void NetworkDevice::init()
|
||||
|
||||
if (!_useEncryption)
|
||||
{
|
||||
Log->println(("MQTT without TLS."));
|
||||
Log->println("MQTT without TLS.");
|
||||
_mqttClient = new espMqttClient(espMqttClientTypes::UseInternalTask::NO);
|
||||
}
|
||||
|
||||
@@ -251,6 +251,11 @@ void NetworkDevice::mqttDisable()
|
||||
_mqttEnabled = false;
|
||||
}
|
||||
|
||||
bool NetworkDevice::isEncrypted()
|
||||
{
|
||||
return _useEncryption;
|
||||
}
|
||||
|
||||
MqttClient *NetworkDevice::getMqttClient() const
|
||||
{
|
||||
if (_useEncryption)
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
virtual String BSSIDstr() = 0;
|
||||
|
||||
#ifndef NUKI_HUB_UPDATER
|
||||
virtual bool isEncrypted();
|
||||
virtual bool mqttConnect();
|
||||
virtual bool mqttDisconnect(bool force);
|
||||
virtual void mqttDisable();
|
||||
|
||||
Reference in New Issue
Block a user