Open animal6496 opened 4 years ago
I can confirm the bug. Verified with NodeMCU and docker (latest and dev).
The build process will work when the ssl_fingerprints section in the config file is removed. The device will connect to the mqtt server on the tls port 8883, but the connection attempt will fail. I cannot get a encrypted connection to a mqtt server. Regardless if add the certificate fingerprint to the config or if it is not present in the config.
Here are my config and the needed docker commands to reproduce the issue.
root@linux:/tmp# cat test.yaml
esphome:
name: test
build_path: ./builds/test
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "myssid"
password: "mypassword"
mqtt:
broker: "mqtt.example.com"
username: "esphome"
password: "bar"
port: "8883"
ssl_fingerprints:
- 1234567890123458789012345678901234567890
root@linux:/tmp# docker run -it --rm --device=/dev/ttyUSB0 -v "$PWD":/config esphome/esphome:dev /config/test.yaml mqtt-fingerprint
INFO Reading configuration /config/test.yaml...
INFO Getting fingerprint from mqtt.example.com:8883
SHA1 Fingerprint: 1234567890123458789012345678901234567890
Copy the string above into mqtt.ssl_fingerprints section of /config/test.yaml
root@linux:/tmp# docker run -it --rm --device=/dev/ttyUSB0 -v "$PWD":/config esphome/esphome:dev /config/test.yaml run
[...]
PlatformIO has been successfully upgraded to 4.1.0!
[...]
Processing neopixel_livingroom (board: nodemcuv2; framework: arduino; platform: espressif8266@2.2.3)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Looking for ESPAsyncTCP-esphome library in registry
LibraryManager: Installing id=6757 @ 1.2.2
ESPAsyncTCP-esphome @ 1.2.2 has been successfully installed!
Looking for AsyncMqttClient-esphome library in registry
LibraryManager: Installing id=6759 @ 0.8.4
AsyncMqttClient-esphome @ 0.8.4 has been successfully installed!
LibraryManager: Installing id=6757 @ ^1.2.2
Looking for AsyncTCP-esphome library in registry
LibraryManager: Installing id=6798 @ ^1.1.1
AsyncTCP-esphome @ 1.1.1 has been successfully installed!
Looking for ArduinoJson-esphomelib library in registry
LibraryManager: Installing id=3837 @ 5.13.3
ArduinoJson-esphomelib @ 5.13.3 has been successfully installed!
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.2
| |-- <ESP8266WiFi> 1.0
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
| |-- <ESP8266WiFi> 1.0
|-- <AsyncMqttClient-esphome> 0.8.4
| |-- <ESPAsyncTCP-esphome> 1.2.2
| | |-- <ESP8266WiFi> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
[...]
Compiling .pioenvs/neopixel_livingroom/lib813/ESPAsyncTCP-esphome_ID6757/SyncClient.cpp.o
Compiling .pioenvs/neopixel_livingroom/lib813/ESPAsyncTCP-esphome_ID6757/tcp_axtls.c.o
Compiling .pioenvs/neopixel_livingroom/lib0d3/ESP8266mDNS/ESP8266mDNS.cpp.o
.piolibdeps/neopixel_livingroom/ESPAsyncTCP-esphome_ID6757/src/ESPAsyncTCP.cpp: In member function 'err_t AsyncServer::_poll(tcp_pcb*)':
.piolibdeps/neopixel_livingroom/ESPAsyncTCP-esphome_ID6757/src/ESPAsyncTCP.cpp:1324:31: error: no matching function for call to 'AsyncClient::_recv(tcp_pcb*&, pbuf*&, int)'
c->_recv(pcb, p->pb, 0);
^
.piolibdeps/neopixel_livingroom/ESPAsyncTCP-esphome_ID6757/src/ESPAsyncTCP.cpp:1324:31: note: candidate is:
.piolibdeps/neopixel_livingroom/ESPAsyncTCP-esphome_ID6757/src/ESPAsyncTCP.cpp:565:6: note: void AsyncClient::_recv(std::shared_ptr<ACErrorTracker>&, tcp_pcb*, pbuf*, err_t)
void AsyncClient::_recv(std::shared_ptr<ACErrorTracker>& errorTracker, tcp_pcb* pcb, pbuf* pb, err_t err) {
^
.piolibdeps/neopixel_livingroom/ESPAsyncTCP-esphome_ID6757/src/ESPAsyncTCP.cpp:565:6: note: candidate expects 4 arguments, 3 provided
*** [.pioenvs/neopixel_livingroom/lib813/ESPAsyncTCP-esphome_ID6757/ESPAsyncTCP.cpp.o] Error 1
================================================================================= [FAILED] Took 44.81 seconds =================================================================================
For what it's worth, I tried the changes described here: https://github.com/esphome/issues/issues/786#issuecomment-549071645
.piolibdeps/<device>/ESPAsyncTCP-esphome_ID6757/
, compilation is successful but the resulting firmware never completes a MQTT connection..piolibdeps/<device>/AsyncMqttClient-esphome_ID6759/
as well, MQTT connection is established, but is very unstable: protocol errors, timeouts, and garbage in message contents.Looks like the problem lies deeper in the async-mqtt-client
library, see https://github.com/marvinroger/async-mqtt-client/issues/196
IMHO moving from async-mqtt-client
to PangolinMQTT
could fix this and many other MQTT-related issues. Author kindly provided a quickstart for this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any indication of this getting fixed?
EasyasyncTCP has not been updated since 2019. I think it might be wise to move on to a smaller SSL library like BearSSL.
Some useful starting points: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino
https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/bearssl-client-secure-class.html
Operating environment/Installation (Hass.io/Docker/pip/etc.):
Pip on Ubuntu 19.10. Using the docker environment gives the same compiler error.
ESP (ESP32/ESP8266, Board/Sonoff):
I've tried with D1-mini and generic Sonoff.
Affected component:
Affects mqtt component https://esphome.io/components/mqtt.html
Description of problem: I'm trying to set up a link to my MQTT broker with TLS using fingerprint validation. When adding the ssl_fingerprints directive to the yaml file the compiler raises an error on ESPAsyncTCP.cpp.
Problem-relevant YAML-configuration entries:
Logs (if applicable):
I 'm using esphome 1.14.3 and tried to use other Arduino libraries (recommended, latest) but all resulted in same error message. Additional information and things you've tried:
As stated above I've tried different boards, esphome (via pip) and dockerized environment and I've tried different Arduino Library versions including latest. I did some searches on the web and it looks the problem is reported as solved Oct 2019 in version 1.2.2. but I've still the same compiler errors. Here on the esphome the discussion is closed and only open for developers since summer 2019. I've no idea how to tackle this myself any help appreciated.