Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTA with MQTT TLS not working #648

Closed
nemidiy opened this issue Jan 2, 2020 · 14 comments
Closed

OTA with MQTT TLS not working #648

nemidiy opened this issue Jan 2, 2020 · 14 comments

Comments

@nemidiy
Copy link
Contributor

nemidiy commented Jan 2, 2020

Hi everyone, happy new year!

I finally got to the point where I could test OTA updates under TLS. As we know it does not work.
Doc gives a hint :

ASYNC_TCP_SSL_ENABLED
This compiler flag allows to use SSL encryption for MQTT connections. All other network
connections still can not be encrypted like HTTP or OTA.

What was rather painful to find is that for esp32 AsyncTcp has no support for TLS. There is a PR though that includes client side TLS using an mbed lib. Since all this adds an extra level of complexity I-ll start by debugging on ESP8266 and then if I can make that work Ill see what I can do in esp32 (my board of choice).

If anyone has any ideas on what the problem is for OTA not working on TLS please let me know :)

Here is what I am doing :

python ota_updater.py -l mqtt.dc-iot.com -p 8883 -t devices/ -i testbox8266 --broker-tls-cacert ca.crt /home/nemi/workspace/dc/homie_test/firmware.bin
Connecting to mqtt broker mqtt.dc-iot.com on port 8883
Connected with result code 0
Waiting for device to come online...
Waiting for device info...
Publishing new firmware with checksum 367e1be9f437c66f747a54de50016720
Waiting for device info...
Expecting checksum 367e1be9f437c66f747a54de50016720, got fc9d1211fbc105e51d3e4359d76cd108, update failed!

mqtt.dc-iot.com resolves in my private DNS to my mqtt server, that-s not even a real domain.
I can see if I subscribe to the base topic (using mosquitto_sub) that the FW is pushed just fine but then when the board receives the message it just disconnects from the server

💡 Firmware test (1.0.0)
🔌 Booting into normal mode 🔌
SSL is: 1
Using fingerprint: 2362f4fbc7890e450d43bb377220e2ac85409936
{} Stored configuration
  • Hardware device ID: cc50e33ca8c5
  • Device ID: testbox8266
  • Name: Test Box 8266
  • Device Stats Interval: 10 sec
  • Wi-Fi: 
    ◦ SSID: dc-iot
    ◦ Password not shown
    ◦ IP: 192.168.0.201
    ◦ Mask: 255.255.255.0
    ◦ Gateway: 192.168.0.1
  • MQTT: 
    ◦ Host: mqtt.dc-iot.com
    ◦ Port: 8883
    ◦ SSL enabled: true
    ◦ Fingerprint: 2362f4fbc7890e450d43bb377220e2ac85409936
    ◦ Base topic: devices/
    ◦ Auth? no
  • OTA: 
    ◦ Enabled? yes
...
〽 Sending statistics...
  • Interval: 15s (10s including 5s grace time)
  • Wi-Fi signal quality: 100%
  • Uptime: 597s
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
〽 Sending statistics...
  • Interval: 15s (10s including 5s grace time)
  • Wi-Fi signal quality: 100%
  • Uptime: 599s

here is my platformio ini file

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
build_flags =
    ;-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
    -D ASYNC_TCP_SSL_ENABLED=1
    -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
upload_speed = 115200
lib_ldf_mode = deep
lib_deps =
    [email protected]
    https://github.com/homieiot/homie-esp8266.git#develop-v3

and the deps :

|-- <ArduinoJson> 6.13.0
|-- <Homie> 3.0.0 #104a09c
|   |-- <ArduinoJson> 6.13.0
|   |-- <AsyncMqttClient> 0.8.2
|   |   |-- <ESPAsyncTCP> 1.2.0
|   |   |   |-- <ESP8266WiFi> 1.0
|   |-- <Bounce2> 2.52
|   |-- <ESP Async WebServer> 1.2.3
|   |   |-- <ESPAsyncTCP> 1.2.0
|   |   |   |-- <ESP8266WiFi> 1.0
|   |   |-- <Hash> 1.0
|   |   |-- <ESP8266WiFi> 1.0
|   |   |-- <ArduinoJson> 6.13.0
|   |-- <DNSServer> 1.1.1
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266HTTPClient> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESPAsyncTCP> 1.2.0
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <ESP8266mDNS> 1.2
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Ticker> 1.0
@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 4, 2020

The problem seems to be in ESPAsyncTCP. I created an issue on that project to see if I get some pointers. Here it is : me-no-dev/ESPAsyncTCP#133

nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Jan 10, 2020
@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 10, 2020

Ok, got no answers at the ESPAsyncTCP. Good news is that I have Homie working for ESP32 with TLS and starts doing OTA over TLS (I say "starts" because it crashes eventually). It's a work in progress but here is what I have accomplished so far ...

Using a PR branch on AsyncTCP to merge in mbed-tls and propagating some changes on AsyncMqttClient and Homie I have my ESP32 connecting to mosquitto using TLS with pre shared keys. In fact you can try it out yourselves :

[env:nodemcu32]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags =
    -D ASYNC_TCP_SSL_ENABLED=1
    -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH  
upload_speed = 115200
lib_ldf_mode = deep
lib_deps =
   [email protected]
   https://github.com/nemidiy/AsyncTCP.git#mbed-tls-try2
   https://github.com/nemidiy/async-mqtt-client.git#mbed-tls
   https://github.com/nemidiy/homie-esp8266.git#feature/mbed-tls-esp32

The PSK and PSK-IDENT need to be added to your config :

{
  "name": "Test Box 32",
  "device_id": "testbox32",
  "device_stats_interval": 10,
  "wifi": {
    "ssid": "YYYYYYYYYYYYY",
    "password": "XXXXXXXXXX",
    "ip":"192.168.0.202",
    "gw":"192.168.0.1",
    "mask":"255.255.255.0",
    "dns1":"192.168.0.232"
  },
  "mqtt": {
    "host": "mqtt.dc-iot.com",
    "port": 9883,
    "base_topic": "devices/",
    "ssl":true,
    "psk_identity":"test", -> new setting
    "psk":"XXX" -> new setting
  },
  "ota": {
    "enabled": true
  }
}

This is how the mosquitto listener has been set up:

listener 9883
allow_anonymous true
psk_hint somecrazyhint
psk_file /etc/mosquitto/conf.d/psk.txt

Here is the output for the serial :

💡 Firmware test (1.0.0)
🔌 Booting into normal mode 🔌
SSL is: 1
{} Stored configuration
  • Hardware device ID: 30aea41c0018
  • Device ID: testbox32
  • Name: Test Box 32
  • Device Stats Interval: 10 sec
  • Wi-Fi: 
    ◦ SSID: dc-iot
    ◦ Password not shown
    ◦ IP: 192.168.0.202
    ◦ Mask: 255.255.255.0
    ◦ Gateway: 192.168.0.1
  • MQTT: 
    ◦ Host: mqtt.dc-iot.com
    ◦ Port: 9883
    ◦ SSL enabled: true
    ◦ PSK identity not shown
    ◦ PSK not shown
    ◦ Base topic: devices/
    ◦ Auth? no
  • OTA: 
    ◦ Enabled? yes
↕ Attempting to connect to Wi-Fi...
✔ Wi-Fi connected, IP: 192.168.0.202
Triggering WIFI_CONNECTED event...
↕ Attempting to connect to MQTT...
✔ Wi-Fi connected, IP: 192.168.0.202
Triggering WIFI_CONNECTED event...
↕ Attempting to connect to MQTT...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Calling setup function...
〽 Sending statistics...
  • Interval: 15s (10s including 5s grace time)
  • Wi-Fi signal quality: 100%
  • Uptime: 3s
Fake value: 3444
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
〽 Sending statistics...
  • Interval: 15s (10s including 5s grace time)
  • Wi-Fi signal quality: 100%
  • Uptime: 13s
Fake value: 13450
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c
[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c

Here I need to figure out why I get the

[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c

And then when I OTA update ...

Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (939/1281392)...
Receiving OTA firmware (1963/1281392)...
Receiving OTA firmware (2987/1281392)...
Receiving OTA firmware (4011/1281392)...
Receiving OTA firmware (5035/1281392)...
Receiving OTA firmware (6059/1281392)...
Receiving OTA firmware (7083/1281392)...
Receiving OTA firmware (8107/1281392)...
Receiving OTA firmware (9131/1281392)...
Receiving OTA firmware (10155/1281392)...
Receiving OTA firmware (11179/1281392)...
Receiving OTA firmware (12203/1281392)...
Receiving OTA firmware (13227/1281392)...
Receiving OTA firmware (14251/1281392)...
Receiving OTA firmware (15275/1281392)...
Receiving OTA firmware (16299/1281392)...
.
.
.
Receiving OTA firmware (816043/1281392)...
Receiving OTA firmware (817067/1281392)...
Receiving OTA firmware (818091/1281392)...
Receiving OTA firmware (819115/1281392)...
Receiving OTA firmware (820139/1281392)...
〽 Sending statistics...
  • Interval: 15s (10s including 5s grace time)
Receiving OTA firmware (821163/1281392)...
Receiving OTA firmware (822187/1281392)...
Receiving OTA firmware (823211/1281392)...
Receiving OTA firmware (824235/1281392)...
Receiving OTA firmware (825259/1281392)...
Receiving OTA firmware (826283/1281392)...
Receiving OTA firmware (827307/1281392)...
Receiving OTA firmware (828331/1281392)...
Receiving OTA firmware (829355/1281392)...
Receiving OTA firmware (830379/1281392)...
Receiving OTA firmware (831403/1281392)...
Receiving OTA firmware (832427/1281392)...
Receiving OTA firmware (833451/1281392)...
Receiving OTA firmware (834475/1281392)...
Receiving OTA firmware (835499/1281392)...
se r� tn  • Wi-Fi signi.o nn  n "�n de dw_ n rncv n _n a� nnn n_ n wn n�d  <d=    d0 dxf n fn ff�" n    fn an in ln en dn :n  n f�il de  n" n /n Un sn e�r sn /f�i dc en tn on /nD ne n sn kn tn o� pn/ dES Pd 3n2 /dE dS Pn 3n2 /ne dsp �- in dS fn- pdu dib ln in cn/ dco n mn pn on nne nn t�s /�l nw ni dp /n ln wi�p /e sn r�c /d c nor� en /n tn c  pn. nc n" d, l ni dn � en  d77 9d ,n  dfu dn cn tn in oen d:  nt nc np �_ un p�d ant de d _n r�c vn _a�n nd_ dw d nn dn
 Sbort( ) was calsled at PC 0x400e3063non co1e 0

Backtrace: 0x4008c800:0x3ffb5370 0x4008ca31:0x3ffb5390 0x400e3063:0x3ffb53b0 0x400feebe:0x3ffb53e0 0x400fef4d:0x3ffb5400 0x4018bb75:0x3ffb5420 0x400fcbe0:0x3ffb5440 0x4008b015:0x3ffb5470

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6412
entry 0x400806a8

Have to figure out why it crashes ... but given that we had no TLS support on ESP32 and that OTA was not even beginning to work with TLS I am quite happy so far. I'll keep working on it an get back.

nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Jan 12, 2020
-> If using ESP32 and ssl is enabled then the json config parameters
   need to be setup :
     * mqtt.psk : the pre shared key, up to 32 chars
     * mqtt.psk_identity : the pre shared key  identity, up to 32 chars
-> Don't publish stats nor invoke the user defined loop function if OTA
   is ongoing. This helps aliviate the TCP window going out of space given
   all TLS extra computing.
@kleini
Copy link
Collaborator

kleini commented Jan 13, 2020

Will test as soon as possible on ESP8266 with SSL encrypted MQTT connection.

@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 13, 2020

hey @kleini thanks for jumping in. Nothing I have done so far applies to ESP8266, just ESP32

nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Jan 13, 2020
-> If using ESP32 and ssl is enabled then the json config parameters
   need to be setup :
     * mqtt.psk : the pre shared key, up to 32 chars
     * mqtt.psk_identity : the pre shared key  identity, up to 32 chars
-> Don't publish stats nor invoke the user defined loop function if OTA
   is ongoing. This helps aliviate the TCP window going out of space.
-> Send out only 30% of the 206 messages while doing OTA updates
nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Jan 13, 2020
-> If using ESP32 and ssl is enabled then the json config parameters
   need to be setup :
     * mqtt.psk : the pre shared key, up to 32 chars
     * mqtt.psk_identity : the pre shared key  identity, up to 32 chars
-> Don't publish stats nor invoke the user defined loop function if OTA
   is ongoing. This helps aliviate the TCP window going out of space.
-> Send out 1 every 100 of the 206 messages while doing OTA updates
@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 13, 2020

[UPDATE] Found why OTA crashes, not quite get the underlying reason to be honest, regardless I
was able to fix the code to have OTA under TLS stable enough.

Contex when doing OTA :

  • we get all the firmware in an encrypted channel
  • for each processed chunk of the received firmware a status message is sent
  • we keep sending stats and also whatever the user wants to publish

That puts to much pressure on the AsyncTCP lib and it gets to a state where the TCP window
on the device goes down to zero. I was able to confirm this because during all this tasks the publish
method for the async-mqtt-client libe exits here :

https://github.com/marvinroger/async-mqtt-client/blob/master/src/AsyncMqttClient.cpp#L862

and after doing so, it just crashes. I took the following approach and got it working...

while the OTA update is ongoing:

  • stop sending stat messages
  • do not invoke the user defined loop function to avoid doing any user level messaging.
  • publish 1 out 100 of the OTA 206 messages.

Still if I do a trace I can see the ESP32 window going down to zero but at least works.
https://imgur.com/a/FyPxGD3

I pushed this fixes to the branches in the platformio.ini so if anyone has an ESP32 laying around I
would appreciate someone tries the OTA over TLS and lets me know :) I would like to rule out any
environmental issues in my home network.

Here is the main I am using :

#include "Arduino.h"
#include <Homie.h>


HomieNode sensorNode("sensor", "Sensor", "sensor");

unsigned long lastSent = 0;

void loopHandler() {
  unsigned long m = millis();
  if ( m - lastSent >= 10 * 1000UL || lastSent == 0) {
    Homie.getLogger() << "Fake value: " << m << endl;
    sensorNode.setProperty("value").send(String(m));
    lastSent = millis();
  }
}

void setup() {
  Serial.begin(115200);
  Homie_setFirmware("test", "1.0.0");
  Homie.setLoopFunction(loopHandler);
  sensorNode.advertise("value").setName("Value").setDatatype("double");
  Homie.setup();
}

void loop(){
  Homie.loop();
}

@kleini
Copy link
Collaborator

kleini commented Jan 14, 2020

Great work @nemidiy !!! This is the first time, OTA worked for me over a SSL connection. It still seems to get into some problems but at some point, the OTA works.
Your code with ESP8266 fixes: https://github.com/kleini/homie-esp8266/commits/ota
Serial log from device:

〽 Sending statistics...
  • Interval: 65s (60s including 5s grace time)
  • Wi-Fi signal quality: 86%
  • Uptime: 246s
Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (16295/437808)...
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (16295/437808)...
Receiving OTA firmware (32679/437808)...
Receiving OTA firmware (49063/437808)...
Receiving OTA firmware (65447/437808)...
Receiving OTA firmware (81831/437808)...
Receiving OTA firmware (98215/437808)...
Receiving OTA firmware (114599/437808)...
Receiving OTA firmware (130983/437808)...
Receiving OTA firmware (147367/437808)...
Receiving OTA firmware (163751/437808)...
Receiving OTA firmware (180135/437808)...
Receiving OTA firmware (196519/437808)...
Receiving OTA firmware (212903/437808)...
Receiving OTA firmware (229287/437808)...
Receiving OTA firmware (245671/437808)...
Receiving OTA firmware (262055/437808)...
Receiving OTA firmware (278439/437808)...
Receiving OTA firmware (294823/437808)...
Receiving OTA firmware (311207/437808)...
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (16295/437808)...
Receiving OTA firmware (32679/437808)...
Receiving OTA firmware (49063/437808)...
Receiving OTA firmware (65447/437808)...
Receiving OTA firmware (81831/437808)...
Receiving OTA firmware (98215/437808)...
Receiving OTA firmware (114599/437808)...
Receiving OTA firmware (130983/437808)...
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (16295/437808)...
Receiving OTA firmware (32679/437808)...
Receiving OTA firmware (49063/437808)...
Receiving OTA firmware (65447/437808)...
Receiving OTA firmware (81831/437808)...
Receiving OTA firmware (98215/437808)...
Receiving OTA firmware (114599/437808)...
Receiving OTA firmware (130983/437808)...
Receiving OTA firmware (147367/437808)...
Receiving OTA firmware (163751/437808)...
Receiving OTA firmware (180135/437808)...
Receiving OTA firmware (196519/437808)...
Receiving OTA firmware (212903/437808)...
Receiving OTA firmware (229287/437808)...
Receiving OTA firmware (245671/437808)...
Receiving OTA firmware (262055/437808)...
Receiving OTA firmware (278439/437808)...
Receiving OTA firmware (294823/437808)...
Receiving OTA firmware (311207/437808)...
Receiving OTA firmware (327591/437808)...
Receiving OTA firmware (343975/437808)...
Receiving OTA firmware (360359/437808)...
Receiving OTA firmware (376743/437808)...
Receiving OTA firmware (393127/437808)...
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (16295/437808)...
Receiving OTA firmware (32679/437808)...
Receiving OTA firmware (49063/437808)...
Receiving OTA firmware (65447/437808)...
Receiving OTA firmware (81831/437808)...
Receiving OTA firmware (98215/437808)...
Receiving OTA firmware (114599/437808)...
Receiving OTA firmware (130983/437808)...
Receiving OTA firmware (147367/437808)...
Receiving OTA firmware (163751/437808)...
Receiving OTA firmware (180135/437808)...
Receiving OTA firmware (196519/437808)...
Receiving OTA firmware (212903/437808)...
Receiving OTA firmware (229287/437808)...
Receiving OTA firmware (245671/437808)...
Receiving OTA firmware (262055/437808)...
Receiving OTA firmware (278439/437808)...
Receiving OTA firmware (294823/437808)...
✖ MQTT disconnected, reason: 0
Triggering MQTT_DISCONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Receiving OTA payload
↕ OTA started
Triggering OTA_STARTED event...
Firmware is binary
Receiving OTA firmware (16295/437808)...
Receiving OTA firmware (32679/437808)...
Receiving OTA firmware (49063/437808)...
Receiving OTA firmware (65447/437808)...
Receiving OTA firmware (81831/437808)...
Receiving OTA firmware (98215/437808)...
Receiving OTA firmware (114599/437808)...
Receiving OTA firmware (130983/437808)...
Receiving OTA firmware (147367/437808)...
Receiving OTA firmware (163751/437808)...
Receiving OTA firmware (180135/437808)...
Receiving OTA firmware (196519/437808)...
Receiving OTA firmware (212903/437808)...
Receiving OTA firmware (229287/437808)...
Receiving OTA firmware (245671/437808)...
Receiving OTA firmware (262055/437808)...
Receiving OTA firmware (278439/437808)...
Receiving OTA firmware (294823/437808)...
Receiving OTA firmware (311207/437808)...
Receiving OTA firmware (327591/437808)...
Receiving OTA firmware (343975/437808)...
Receiving OTA firmware (360359/437808)...
Receiving OTA firmware (376743/437808)...
Receiving OTA firmware (393127/437808)...
Receiving OTA firmware (409511/437808)...
Receiving OTA firmware (425895/437808)...
Receiving OTA firmware (437808/437808)...
✔ OTA succeeded
Triggering OTA_SUCCESSFUL event...
Device is idle
↻ Rebooting...
✖ Wi-Fi disconnected, reason: 8
Triggering WIFI_DISCONNECTED event...
↕ Attempting to connect to Wi-Fi...

Exception (28):
epc1=0x4000df2f epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000033 depc=0x00000000

>>>stack>>>

ctx: sys
sp: 3fffea60 end: 3fffffb0 offset: 01a0
3fffec00:  4023e921 4000422e 60000200 4024ced8  
3fffec10:  00000033 00000010 4023f211 3ffed494  
3fffec20:  3fff1334 00000000 3ffe89ef 3fff1334  
3fffec30:  3ffe89ef 4025ff40 00000020 40100b03  
3fffec40:  3fff1394 3ffefa84 00000006 3ffedbd8  
3fffec50:  3ffe89ef 3ffe89ef 00000033 402410cb  
3fffec60:  3ffedb8c 40240c9c 402432fc 3ffedb8c  
3fffec70:  40240818 4025321b 3fffafcc 000003ff  
3fffec80:  00000001 00000001 3fffec90 402531b2 <
3fffec90:  40240cd7 3ffedc80 3ffedc80 00000020  
3fffeca0:  40242c44 0000009d 000000eb aa55aa55  
3fffecb0:  3ffed518 40242c08 3ffed494 00000012  
3fffecc0:  40240c8c 40240c60 3ffed518 00000012  
3fffecd0:  40240c2b 3ffed494 00000012 402538b0  
3fffece0:  402411dc 3ffed494 00000000 402432fc  
3fffecf0:  40240c09 3ffed610 00000002 00000000  
3fffed00:  402430b5 0000010f 3ffeeb4c 00000000  
3fffed10:  00000010 0000010f 3ffed6b0 40242f09  
3fffed20:  40242f14 3ffe85c8 3ffeeb4c 00000001  
3fffed30:  40253edc 3ffe85c8 3ffeeb4c 3ffeeb4c  
3fffed40:  3ffefa84 402165b1 3ffeeb6d 402164df  
3fffed50:  69656c4b 0000326e 00000022 40225064  
3fffed60:  40252dca 00000001 3ffffea0 40224e08  
3fffed70:  39393534 35393231 37303833 38313338  
3fffed80:  40216100 00000001 3ffffea0 40216064  
3fffed90:  c4a8a8c0 00ffffff 01a8a8c0 00000000  
3fffeda0:  00000000 00000000 4021b9f8 01a8a8c0  
3fffedb0:  299a6200 657b118a 6974706d 7420676e  
3fffedc0:  69656c4b 0000326e 00000022 40100878  
3fffedd0:  40252dca 00000001 3fffee80 00000001  
3fffede0:  39393534 35393231 37303833 38313338  
3fffedf0:  40216100 00000001 3fffee80 40216064  
3fffee00:  c4a8a8c0 00ffffff 01a8a8c0 c4a8a8c0  
3fffee10:  00ffffff 01a8a8c0 4021b9f8 01a8a8c0  
3fffee20:  4021b900 00ffffff 4021b981 00000002  
3fffee30:  00000004 00000000 3ffef7fc 00000001  
3fffee40:  4021592c 3ffee9d8 3ffeeaac 0000010f  
3fffee50:  3ffeeb4c 00000000 3ffef7fc 4020248a  
3fffee60:  4021b9f8 00000000 4021b9f8 01a8a8c0  
3fffee70:  4021b9f8 00ffffff 4021b9f8 01a8a8c0  
3fffee80:  4021b9f8 c4a8a8c0 3ffe8958 4020ac54  
3fffee90:  4021b9f8 01a8a8c0 4021b9f8 01a8a8c0  
3fffeea0:  4021b9f8 00ffffff 4021b9f8 c4a8a8c0  
3fffeeb0:  3fffeef0 3ffee9d8 3ffeeaac 3ffee558  
3fffeec0:  3fffeef0 3ffee9d8 3ffef050 40203d39  
3fffeed0:  3ffef804 3fff121c 3fffa8e4 4021a9ef  
3fffeee0:  000005e0 3fff121c 3fffa8e4 402158d0  
3fffeef0:  69656c4b 0000326e 86fe8eb4 8a299a62  
3fffef00:  00007b11 00000008 69656c00 3f00326e  
3fffef10:  80fec930 4010129f 00000000 3ffece24  
3fffef20:  3ffec930 3fffa8e4 3fff1244 40215cce  
3fffef30:  401010a5 00000000 00000002 3ffee558  
3fffef40:  3fffdc10 00000000 3fffa8e4 402554f0  
3fffef50:  40000f49 3fffdab0 3fffdab0 40000f49  
3fffef60:  40000e19 40001878 00000002 00000000  
3fffef70:  3fffff10 aa55aa55 0000002c 40104ab1  
3fffef80:  40104ab7 00000002 00000000 2af93721  
3fffef90:  4010000d 9d44785c 61a73666 1397f3bc  
3fffefa0:  40249f54 3fffef3c 40249f05 3ffffef8  
3fffefb0:  3fffffc0 00000000 00000000 feefeffe  
3fffefc0:  feefeffe feefeffe feefeffe feefeffe  
3fffefd0:  feefeffe feefeffe feefeffe feefeffe  
3fffefe0:  feefeffe feefeffe feefeffe feefeffe  
3fffeff0:  feefeffe feefeffe feefeffe feefeffe  
3ffff000:  feefeffe feefeffe feefeffe feefeffe  
3ffff010:  feefeffe feefeffe feefeffe feefeffe  
3ffff020:  feefeffe feefeffe feefeffe feefeffe  
3ffff030:  feefeffe feefeffe feefeffe feefeffe  
3ffff040:  feefeffe feefeffe feefeffe feefeffe  
3ffff050:  feefeffe feefeffe feefeffe feefeffe  
3ffff060:  feefeffe feefeffe feefeffe feefeffe  
3ffff070:  feefeffe feefeffe feefeffe feefeffe  
3ffff080:  feefeffe feefeffe feefeffe feefeffe  
3ffff090:  feefeffe feefeffe feefeffe feefeffe  
3ffff0a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff0f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff100:  feefeffe feefeffe feefeffe feefeffe  
3ffff110:  feefeffe feefeffe feefeffe feefeffe  
3ffff120:  feefeffe feefeffe feefeffe feefeffe  
3ffff130:  feefeffe feefeffe feefeffe feefeffe  
3ffff140:  feefeffe feefeffe feefeffe feefeffe  
3ffff150:  feefeffe feefeffe feefeffe feefeffe  
3ffff160:  feefeffe feefeffe feefeffe feefeffe  
3ffff170:  feefeffe feefeffe feefeffe feefeffe  
3ffff180:  feefeffe feefeffe feefeffe feefeffe  
3ffff190:  feefeffe feefeffe feefeffe feefeffe  
3ffff1a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff1f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff200:  feefeffe feefeffe feefeffe feefeffe  
3ffff210:  feefeffe feefeffe feefeffe feefeffe  
3ffff220:  feefeffe feefeffe feefeffe feefeffe  
3ffff230:  feefeffe feefeffe feefeffe feefeffe  
3ffff240:  feefeffe feefeffe feefeffe feefeffe  
3ffff250:  feefeffe feefeffe feefeffe feefeffe  
3ffff260:  feefeffe feefeffe feefeffe feefeffe  
3ffff270:  feefeffe feefeffe feefeffe feefeffe  
3ffff280:  feefeffe feefeffe feefeffe feefeffe  
3ffff290:  feefeffe feefeffe feefeffe feefeffe  
3ffff2a0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2b0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2c0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2d0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2e0:  feefeffe feefeffe feefeffe feefeffe  
3ffff2f0:  feefeffe feefeffe feefeffe feefeffe  
3ffff300:  feefeffe feefeffe feefeffe feefeffe  
3ffff310:  feefeffe 00000000 feefeffe 000000ff  
3ffff320:  000000c1 00000001 401048f9 3ffed248  
3ffff330:  00000005 00000000 00000020 40100250  
3ffff340:  feefeffe feefeffe 00000005 401016f8  
3ffff350:  3ffe9085 401049ab 3ffeca48 feefeffe  
3ffff360:  4010228f 3ffeca48 3ffed248 feefeffe  
3ffff370:  00007fff 00000000 3ffed518 00000100  
3ffff380:  000001c5 00000001 401048f9 3ffed248  
3ffff390:  00000002 00000000 00000020 40100250  
3ffff3a0:  40101b29 401038a0 00000002 401016f8  
3ffff3b0:  3ffe9082 40104993 3ffec7c8 feefeffe  
3ffff3c0:  00000001 40103b6e 3ffed248 14aa948c  
3ffff3d0:  40103fdf 155d7380 3ffed518 40102470  
3ffff3e0:  401043e1 3ffed248 3ffec7c8 00040000  
3ffff3f0:  40103aa7 00000032 00000002 00040000  
3ffff400:  00002200 401038a0 00040000 00000001  
3ffff410:  4010296c 00080000 678f0017 48496de6  
3ffff420:  3ffe993c 00000000 00000020 155d7380  
3ffff430:  3ffe9924 2c9f0300 4000050c 3fffc278  
3ffff440:  40102654 3fffc200 00000022 00000100  
3ffff450:  40236f92 00000030 00000016 ffffffff  
3ffff460:  4023906c cbd9b2b5 fdfa9f99 339ce4e6  
3ffff470:  a0e0df05 e67f7ea7 73eeb04b e7765e34  
3ffff480:  5983069a 0ae1c504 c0485929 0a06e92f  
3ffff490:  da1b3c7b 459e4eef efbe4786 00000030  
3ffff4a0:  00000001 00004a08 00000019 ffffffff  
3ffff4b0:  3ffe9930 00000000 4026162c 155d2657  
3ffff4c0:  401038a3 00040000 00000000 00040000  
3ffff4d0:  53002200 401038a0 00040000 3ffff5c0  
3ffff4e0:  3ffed248 40102803 0000000b ffffffff  
3ffff4f0:  3b03f28c cdd14315 08b01721 34090168  
3ffff500:  55a15a66 8569d97e b549018d 187415c6  
3ffff510:  00000005 00000000 00000020 40100250  
3ffff520:  c91ce4b2 42d6a231 00000005 401016f8  
3ffff530:  3ffe9085 401049ab 3ffeca48 e6ee2e55  
3ffff540:  4010228f 3ffeca48 30edcba4 beb4f58a  
3ffff550:  00007fff 155e5a8f 3ffed518 40102470  
3ffff560:  3ffe9924 00000000 00000000 ede23dab  
3ffff570:  00007fff 155e5a8f 40102932 00000100  
3ffff580:  3ffe9924 7fffffff 00002200 00000001  
3ffff590:  00000001 00004208 bf4774b2 e7f3e6e5  
3ffff5a0:  3ffe9924 3ffff620 4b27fe94 155e5a8f  
3ffff5b0:  3ffe9918 2c9f0300 4000050c 3fffc278  
3ffff5c0:  40102654 3fffc200 00000022 00000000  
3ffff5d0:  4023385c 00000030 00000010 ffffffff  
3ffff5e0:  4023377e 40261344 00000000 0000004b  
3ffff5f0:  40261415 0000000d 00000001 ffffff80  
3ffff600:  000021da 8da00056 00000003 00000004  
3ffff610:  40261340 8d000000 00000000 00000030  
3ffff620:  00000080 00000000 71072f01 a0447080  
3ffff630:  55200813 ee6d1136 779aa0f4 47b5d179  
3ffff640:  8aa1f0af 8254f326 acc662a8 25a624ee  
3ffff650:  0000c510 eaf2bc29 eff8d28e 51f005d6  
3ffff660:  6fb820bf 409ec94f 00000080 000005b4  
3ffff670:  3fff178c 00000000 00000020 40100b3a  
3ffff680:  00000000 00030000 36736b5a 000005b4  
3ffff690:  00000610 0000005a 00000000 4022ee88  
3ffff6a0:  d6ff4489 5e0e41c7 5c5c5c5c 40225421  
3ffff6b0:  5c5c5c5c 5c5c5c5c 000005b4 40225460  
3ffff6c0:  5c5c5c5c 5c5c5c5c 5c190130 402297d9  
3ffff6d0:  00000000 00003a79 00000000 00000000  
3ffff6e0:  82aff0a1 0826f354 08080808 000005b4  
3ffff6f0:  00000000 00000000 3fff178c 40229be0  
3ffff700:  00000002 00000065 3fff3494 3fffbe5c  
3ffff710:  000016d0 3fff1790 3fff1810 0000054f  
3ffff720:  00000000 00000065 3fffaa20 0000000e  
3ffff730:  3fff34f9 3fff34f9 3fffa92c 00000010  
3ffff740:  00000000 00000065 3fff15c4 40201465  
3ffff750:  3fff3494 f9659fa6 000001c5 00000010  
3ffff760:  3fffbe5c 3fff2934 00000065 40230848  
3ffff770:  00030317 3fff0027 3ffff890 00000038  
3ffff780:  00000027 00000017 00000060 302e3300  
3ffff790:  00000620 3ffeff2b 000001d1 00000000  
3ffff7a0:  3fff2934 3fff289c 00000027 402308d4  
3ffff7b0:  00000027 000005ea 000005ea 40100878  
3ffff7c0:  3fff0b44 000000ca 00000000 3fff178c  
3ffff7d0:  00000000 00000027 3fff15c4 40201258  
3ffff7e0:  00002f50 000005ea 000005ea 40100878  
3ffff7f0:  00000027 00000027 3ffeedac 00000065  
3ffff800:  3fff289c 3fff008c 00000020 40100b03  
3ffff810:  00000000 3ffffd94 00000027 3ffff8b7  
3ffff820:  3fff289c 00000065 3ffeee8c 40224bb5  
3ffff830:  3fff289c 00000027 3ffeee8c 4021a24b  
3ffff840:  00000000 4bc6a7f0 00057869 00000005  
3ffff850:  00000000 00000000 4bc6a7f0 00000000  
3ffff860:  6c6f7274 76656400 4010033e b89374bc  
3ffff870:  00000000 632d676e 72746e6f 00000005  
3ffff880:  3ffeedac 00000015 00000001 4021870e  
3ffff890:  1c002533 696d6f68 65682f65 6e697461  
3ffff8a0:  6f632d67 6f72746e 73242f6c 65746174  
3ffff8b0:  65721500 6f796461 746f2f6e 6e652f61  
3ffff8c0:  656c6261 740f0064 22657572 74616548  
3ffff8d0:  20676e69 746e6f63 226c6f72 6564222c  
3ffff8e0:  65636976 2264695f 6568223a 6e697461  
3ffff8f0:  6f632d67 6f72746e 222c226c 69666977  
3ffff900:  227b3a22 64697373 4b223a22 6e69656c  
3ffff910:  222c2232 3a227069 32393122 3836312e  
3ffff920:  3836312e 3639312e 6d222c22 226b7361  
3ffff930:  3532223a 35322e35 35322e35 22302e35  
3ffff940:  7767222c 31223a22 312e3239 312e3836  
3ffff950:  312e3836 64222c22 2231736e 3931223a  
3ffff960:  36312e32 36312e38 22312e38 6d222c7d  
3ffff970:  22747471 68227b3a 2274736f 3931223a  
3ffff980:  36312e32 36312e38 22362e38 6f70222c  
3ffff990:  00000005 00000000 00000020 40100250  
3ffff9a0:  65757274 7373222c 00000005 401016f8  
3ffff9b0:  3ffe9085 401049ab 3ffeca48 64656c62  
3ffff9c0:  4010228f 3ffeca48 3a226472 786f2220  
3ffff9d0:  00007fff 155e087b 3ffed518 40102470  
3ffff9e0:  3ffe9930 00000000 00000000 3ffed248  
3ffff9f0:  00000005 00000000 00000020 40100250  
3ffffa00:  3ffe9930 7fffffff 00000005 401016f8  
3ffffa10:  3ffe9085 401049ab 3ffeca48 200a6575  
3ffffa20:  4010228f 3ffeca48 3ffed248 155e087b  
3ffffa30:  00007fff 155e29f5 3ffed518 40102470  
3ffffa40:  3ffe990c 00000000 00000000 00040000  
3ffffa50:  00007fff 155e29f5 40102932 00000100  
3ffffa60:  3ffe990c 7fffffff 00002200 00000001  
3ffffa70:  00000001 00004208 1379423d 8e11cf3f  
3ffffa80:  00000000 00000000 0000001f 40100250  
3ffffa90:  3ffe993c 2c9f0300 3fffc228 40105251  
3ffffaa0:  4000050c 3fffc200 00000022 00000100  
3ffffab0:  40236d81 00000030 00000019 ffffffff  
3ffffac0:  4023906c 3ffffd28 a964b872 29e65621  
3ffffad0:  5e13f328 397b6872 2d16f720 4317b20c  
3ffffae0:  00000036 437f8609 70843c3e a4c1f291  
3ffffaf0:  00360000 36000000 0c12f320 00000030  
3ffffb00:  40220004 00000030 00000018 ffffffff  
3ffffb10:  402390bb 00000030 4026162c 00000040  
3ffffb20:  401038a3 00040000 00000000 00040000  
3ffffb30:  53002200 401038a0 00040000 3ffffc20  
3ffffb40:  3ffed248 40102803 3ffffdac 00000030  
3ffffb50:  7d6c0b3a f2758ba2 8b860a69 73ec14a6  
3ffffb60:  852458e0 91e3cb14 fe574ac2 9aa04af3  
3ffffb70:  2c369bca 72e5fcfb d2b0bf95 72a5cb4c  
3ffffb80:  0ee0b28a 77cab087 202c0b6a 63e0d3d7  
3ffffb90:  3b10803e 4f368077 c316c3d1 bb46aa9d  
3ffffba0:  c2257e9d 3ffffc80 5b925f28 eeaf7f32  
3ffffbb0:  86cc38bb 920610d8 9c16773a 038808aa  
3ffffbc0:  8ecbb6c0 e26dae3e 28216fa1 ede23dab  
3ffffbd0:  2c9adbd7 8c7603ff f1d84f84 81c056cf  
3ffffbe0:  00000008 3ffffc60 00000008 3ffffc80  
3ffffbf0:  00000000 b841cb25 bf4774b2 e7f3e6e5  
3ffffc00:  43e30382 3ffffc80 4b27fe94 3ffffdac  
3ffffc10:  00000003 3fff349a 3ffffc80 40239119  
3ffffc20:  00000080 00000000 00000000 00000000  
3ffffc30:  00000000 00000000 00000000 00000000  
3ffffc40:  00000000 00000000 00000000 00000100  
3ffffc50:  0000005c 00000001 401048f9 3ffed248  
3ffffc60:  3ffed1d0 00030000 0000006f 3ffffdac  
3ffffc70:  00000003 3ffffdb8 00000003 40235554  
3ffffc80:  401044de 3ffed248 9f25a598 2102d3fb  
3ffffc90:  18da600f 40103e2d 3ffed248 887b438c  
3ffffca0:  c0a9bbe6 00000000 b026efba 00000100  
3ffffcb0:  401043e1 3ffed248 3ffec7a0 00040000  
3ffffcc0:  53002200 5f367b89 00000002 401016f8  
3ffffcd0:  401046b9 00080000 00000002 00000000  
3ffffce0:  40102982 40103b6e 3ffed248 f7cfd19e  
3ffffcf0:  40103fdf 00000000 3ffed248 f0044221  
3ffffd00:  d6ff4489 00000000 4000050c 000000ff  
3ffffd10:  0000005c 00000001 401048f9 3ffed248  
3ffffd20:  3ffed1d0 00000030 00000018 ffffffff  
3ffffd30:  4020e639 00000000 0000006f 3ffffe88  
3ffffd40:  401044de 3ffed248 4021ad98 fffffffe  
3ffffd50:  00000002 00000000 00000020 40100250  
3ffffd60:  40101b29 401038a0 00000002 401016f8  
3ffffd70:  3ffe9082 40104993 3ffec7a0 00040000  
3ffffd80:  00000001 40103b6e 3ffed248 ffffffff  
3ffffd90:  40103fdf 00080000 00000002 3fffc278  
3ffffda0:  40102982 3fffc200 00000022 fffffffe  
3ffffdb0:  40103aa7 00000032 00000002 00040000  
3ffffdc0:  00002200 2c9f0300 4000050c 3fffc278  
3ffffdd0:  4010296c 00080000 00000022 fffffffe  
3ffffde0:  40106b3c 00000000 00000008 ffffffff  
3ffffdf0:  4020c768 2c9f0300 4024b65f 00000000  
3ffffe00:  ffffffff 00000000 3ffe91d1 00000000  
3ffffe10:  00006998 00000d33 00000d33 40100878  
3ffffe20:  00000000 00000000 4024b65f 4025ee70  
3ffffe30:  3ffed614 00000001 00000020 40100b03  
3ffffe40:  00001bd0 0000037a 0000037a 40100878  
3ffffe50:  3ffef828 3ffef6d8 00000001 00000000  
3ffffe60:  0000af98 3ffed494 00000020 40100b03  
3ffffe70:  40243b2f 4024f0ba 00000000 3ffeeaac  
3ffffe80:  3fffdad0 4024d3de 00000000 3ffeeaac  
3ffffe90:  4025eb58 3ffe9870 00000000 3ff1fe00  
3ffffea0:  4024f0bf 00000000 00000000 00000000  
3ffffeb0:  4024d3f9 00000000 3ffefa84 402557b0  
3ffffec0:  4024d4c5 ffffffff 3ffefa84 40100470  
3ffffed0:  40105395 06e36204 3ffee050 00000000  
3ffffee0:  3ffee3c0 3ffee050 3ffed494 00000000  
3ffffef0:  00000000 06e2e7f2 3ffee9d8 3ffeeaac  
3fffff00:  3fffdad0 3ffef340 4020c784 3fffefa0  
3fffff10:  4020a5c1 00000001 3ffef210 4020a5c4  
3fffff20:  3fffdad0 3ffeeaac 3ffee9d8 40204c67  
3fffff30:  00000000 00000000 00000000 3ffff87f  
3fffff40:  00363432 3ffff865 3ffff899 00000000  
3fffff50:  3ffef3bc 00363800 00353600 3ffef340  
3fffff60:  007a1200 e43769c3 3ffee900 40201a91  
3fffff70:  00000000 3ffef210 3ffe8958 3ffef340  
3fffff80:  3fffdad0 00000000 3ffee9c8 402018a6  
3fffff90:  3fffdad0 00000000 3ffef300 40201590  
3fffffa0:  feefeffe feefeffe 3ffef300 4020c8a0  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 1392, room 16 
tail 0
chksum 0xd0
csum 0xd0
v3d128e5c
@cp:0
ld


💡 Firmware relay-device (0.0.5)
🔌 Booting into normal mode 🔌
SSL is: 1
{} Stored configuration
  • Hardware device ID: cc50e309ea0b
  • Device ID: heating-control
  • Name: Heating control
  • Device Stats Interval: 60 sec
  • Wi-Fi: 
    ◦ SSID: MySSID
    ◦ Password not shown
    ◦ IP: 192.168.0.196
    ◦ Mask: 255.255.255.0
    ◦ Gateway: 192.168.0.1
  • MQTT: 
    ◦ Host: 192.168.0.6
    ◦ Port: 1883
    ◦ SSL enabled: true
    ◦ Base topic: homie/
    ◦ Auth? yes
    ◦ Username: username
    ◦ Password not shown
  • OTA: 
    ◦ Enabled? yes
↕ Attempting to connect to Wi-Fi...
✔ Wi-Fi connected, IP: 192.168.0.196
Triggering WIFI_CONNECTED event...
↕ Attempting to connect to MQTT...
Sending initial information...
✔ MQTT ready
Triggering MQTT_READY event...
Calling setup function...
〽 Sending statistics...
  • Interval: 65s (60s including 5s grace time)
  • Wi-Fi signal quality: 100%
  • Uptime: 9s

and ota_updater logs

$ ota_updater.py
Connecting to mqtt broker 192.168.0.6 on port 1883
Connected with result code 0
Waiting for device to come online...
Waiting for device info...
Publishing new firmware with checksum cd968a8b37a7d5c0c8ca338533e7e347
Expecting checksum cd968a8b37a7d5c0c8ca338533e7e347, got 6c80883d4703a310907d8bfdf985e9c1, update failed!
$ ota_updater
Connecting to mqtt broker 192.168.0.6 on port 1883
Connected with result code 0
Waiting for device to come online...
Waiting for device info...
Publishing new firmware with checksum cd968a8b37a7d5c0c8ca338533e7e347
[++++++++++++++++++++++++++    ] 393127/437808Device back online. Update Successful!

@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 14, 2020

@kleini that's great news! so if what I did on homie + async-mqtt improved ESP8266 as a side effect (and it was pure luck since I was targetting ESP32) it probably means that the ESPAsynTCP lib that uses a axtls ssl lib is also having issues with buffers that probably generate those MQTT disconnections due to timeouts. I am currently trying to build the binary using esp-idf since the sdkconfig.h allows to specify the underlying TCP window size. Thanks for the feedback. Hopefully I'll have more news soon.

@kleini
Copy link
Collaborator

kleini commented Jan 15, 2020

Oh, I missed your changes on AsyncMqttClient. It worked without that. After having a look into your changes, those are only for ESP32, I don't see any improvements for ESP8266. Furthermore I don't see, where axtls is replaced with mbedtls. But even without that, it is a big step forward for me.

@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 16, 2020

@kleini yes. you are right about AsyncMqttClient. axtls is only replaced by mbedtls only if use espressif32 as the platform since dependencies in AsyncMqttClient are :

"dependencies": [
    {
      "name": "ESPAsyncTCP",
      "version": "1.2.0",
      "platforms": "espressif8266"
    },
    {
      "name": "AsyncTCP",
      "version": "^1.0.0",
      "platforms": "espressif32"
    }
  ]

the branch for AsyncTCP in the ini file is the one that replaces axtls by mbed. Anyways I am still struggling with platformio using the arduino core as an isp-idf component in order to play with window
sizes and other mbed configs, fun and painful at the same time.

@kleini
Copy link
Collaborator

kleini commented Jan 16, 2020

Fiddling around with TLS implementations is currently too much for me. My C++ skills are too unexercised for that. But at least your changes make OTA possible for my devices. If I can further support you in getting more things tested and done, just tell me, how I can help.

@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 26, 2020

Ok, so I built homie and all it's dependencies using esp-idf for the ESP32 platform to see if playing around with the TCP window size, would remove the window dropping down to 0 from time to time when doing the OTA updates over TLS. Short story, did not work ...

  • tried different TCP windows sizes
  • tried different TLS message max sizes
  • tried having AsyncTCP using 1 core and both cores
  • tried some mbed specific configs

I just concluded that the window dropping down to zero is just the producer (broker) being much faster than the consumer (MCU) when doing too much decryption as needed for the OTA

Anyways, and regardless the window dropping to zero:

  • OTA over TLS using mbedTLS on ESP32 is stable which is the good news.
  • OTA over TLS under axtls on ESP8266 is working now with the tweaks in the homie branch and that @kleini tested out.

For ESP8266 since the changes are just in the homie repo I can separate them from the ESP32 and create a PR.

For ESP32 I first need :

  1. mbed TLS client support, try 2 me-no-dev/AsyncTCP#48 getting merged, then ...
  2. then do a PR in the async-mqtt-client project to add the PSK support, then ...
  3. Homie PR

Thus ... stay tunned for "TLS tweaks" PR during the week. Thanks

@robert-alfaro
Copy link

Do you have any issues with closing the AsyncTCP connection or do you simply auto-reboot upon completion (or failure) and avoid the bug? I am not using mqtt, but am using AsyncTCP with mbedTLS on ESP32 pulling a payload from GCP. All is great, no issues, except closing the connection.

@nemidiy
Copy link
Contributor Author

nemidiy commented Jan 26, 2020

hey @robert-alfaro, correct after OTA updating the device just reboots into the new firmware. Unless there is a problem on MQTT, the socket does not get closed, and so far I have not had any MQTT disconnections, but I can try it out and see what happens. Could you tell me about your use case so I can try and reproduce it ? Meaning, is the socket getting closed by your code because you are done doing whatever you need or is it closing due to a problem in the channel (ie, latency or whatever) ?

BTW, all my tests are in an internal network, and if I do any connections with the outside world I do so through an MQTT bridge (mosquitto) since I am paranoid about exposing devices and I can run the bridge in a more powerful and secured device (ie raspberry).

Also .. are you not getting this ? ... cant figure this log out.

[E][AsyncTCP.cpp:1130] _poll(): 0x3ffcc148 != 0x3ffd293c

nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Feb 2, 2020
+ During OTA do not publish any messages that are not OTA related
+ Publish 1 every 100 206 status messages
nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Feb 2, 2020
+ During OTA do not publish any messages that are not OTA related
+ Publish 1 every 100 206 status messages
nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Feb 8, 2020
+ During OTA do not publish any messages that are not OTA related
+ Publish 1 every 100 206 status messages
nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Feb 9, 2020
+ During OTA do not publish any messages that are not OTA related
+ Publish 1 every 100 206 status messages
nemidiy pushed a commit to nemidiy/homie-esp8266 that referenced this issue Feb 9, 2020
+ During OTA do not publish any messages that are not OTA related
+ Publish 1 every 100 206 status messages
luebbe pushed a commit that referenced this issue Feb 12, 2020
+ During OTA do not publish any messages that are not OTA related
+ Publish 1 every 100 206 status messages
@luebbe
Copy link
Collaborator

luebbe commented Feb 12, 2020

Wow, 4/4 approvals for the PR. I guess, we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants