Open lcavalli opened 3 years ago
Opened also upstream: https://github.com/me-no-dev/ESPAsyncTCP/issues/174.
Hey there @ottowinter, mind taking a look at this issue as it has been labeled with an integration (async_tcp
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
Issue already present and closed upstream: https://github.com/me-no-dev/ESPAsyncTCP/issues/170
Searching for additional information I found this ESPAsyncTCP fork that switched over a different SSL implementation (bearssl): https://github.com/Adam5Wu/ESPAsyncTCP/. Here a discussion regarding bearssl usage in ESPAsyncTCP: https://github.com/me-no-dev/ESPAsyncTCP/issues/95. I don't know the level of maturity of this port though.
Not a great help unfortunately, but if anyone else is wondering how to get this working quickly, the last stable version that works is esphome/esphome:2021.10.3
I can confirm. It is working with 2021.10.3. Actual version makes an error with include/ssl.h
Same problem with the latest version(esphome/esphome:2022.6.1). Is downgrade the only chance?
Since the issue has no visibility upstream, I think we need to raise the visibility upstream https://github.com/me-no-dev/ESPAsyncTCP/issues/170 . Otherwise downgrade is the only chance.
Same here with 2022.8.3 on HA. Tried to use ssl for mqtt and faced this compilation error.
Similar for esphome 2022.9.4. I think maybe the manual should be updated to say ssl is not supported for esp8266, untill this upstream issue is resolved and esphome is migrated to a newer version.
Same here with 2022.9.4. I keep getting this error:
In file included from .piolibdeps/deskdisplay/AsyncMqttClient-esphome/src/AsyncMqttClient.hpp:18,
from .piolibdeps/deskdisplay/AsyncMqttClient-esphome/src/AsyncMqttClient.h:4,
from src/esphome/components/mqtt/mqtt_backend_arduino.h:6,
from src/esphome/components/mqtt/mqtt_client.h:15,
from src/esphome/components/mqtt/custom_mqtt_device.h:7,
from src/esphome/components/mqtt/custom_mqtt_device.cpp:1:
.piolibdeps/deskdisplay/ESPAsyncTCP-esphome/src/tcp_axtls.h:44:10: fatal error: include/ssl.h: No such file or directory
44 | #include "include/ssl.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/deskdisplay/src/esphome/components/mqtt/custom_mqtt_device.cpp.o] Error 1
In file included from .piolibdeps/deskdisplay/AsyncMqttClient-esphome/src/AsyncMqttClient.hpp:18,
from .piolibdeps/deskdisplay/AsyncMqttClient-esphome/src/AsyncMqttClient.h:4,
from src/esphome/components/mqtt/mqtt_backend_arduino.h:6,
from src/esphome/components/mqtt/mqtt_client.h:15,
from src/esphome/components/mqtt/mqtt_component.h:11,
from src/esphome/components/mqtt/mqtt_binary_sensor.h:7,
from src/esphome/components/mqtt/mqtt_binary_sensor.cpp:1:
.piolibdeps/deskdisplay/ESPAsyncTCP-esphome/src/tcp_axtls.h:44:10: fatal error: include/ssl.h: No such file or directory
44 | #include "include/ssl.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/deskdisplay/src/esphome/components/mqtt/mqtt_binary_sensor.cpp.o] Error 1
I was able to build
Example esphome section
esphome:
name: ssl_test
platform: ESP8266
board: esp01_1m
platformio_options:
platform: espressif8266@2.6.3
platform_packages:
- platformio/toolchain-xtensa@2.40802.200502
- platformio/framework-arduinoespressif8266@3.20704.0
Run in shell
docker run --rm -it -v "${PWD}":/config --device /dev/ttyUSB0 --entrypoint="/bin/bash" esphome/esphome:2021.10.3
Run in docker container
pip install platformio==6.0.0
esphome run ssl_test.yaml
I was able to build
This no longer appears to work :(
I was able to build
Works great for me thanks! @aneisch try run an esphome clean project.yaml first
I just now updated to last version (pip install esphome --upgrade), cleaned the project and no success. Only was to build is to use esphome in version 2021.10.3 (pip install esphome==2021.10.3) but there is a problem in other projects :/
With this
esphome:
name: propagator-ht
board: nodemcuv2
platform: ESP8266
platformio_options:
platform: espressif8266@2.6.3
platform_packages:
- platformio/toolchain-xtensa@2.40802.200502
- platformio/framework-arduinoespressif8266@3.20704.0
It fails on mqtt_client.h
/esphome/components/mqtt/mqtt_component.cpp.o
In file included from src/esphome/components/mqtt/mqtt_client.h:15:0,
from src/esphome/components/mqtt/custom_mqtt_device.h:7,
from src/esphome/components/mqtt/custom_mqtt_device.cpp:1:
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::set_secure(bool)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:27:34: error: 'mqtt_client' was not declared in this scope
void set_secure(bool secure) { mqtt_client.setSecure(secure); }
^
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::add_server_fingerprint(const uint8_t*)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:28:61: error: 'mqtt_client' was not declared in this scope
void add_server_fingerprint(const uint8_t *fingerprint) { mqtt_client.addServerFingerprint(fingerprint); }
^
Compiling /data/propagator-ht/.pioenvs/propagator-ht/src/esphome/components/mqtt/mqtt_cover.cpp.o
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-nonnull-compare" [enabled by default]
*** [/data/propagator-ht/.pioenvs/propagator-ht/src/esphome/components/mqtt/custom_mqtt_device.cpp.o] Error 1
In file included from src/esphome/components/mqtt/mqtt_client.h:15:0,
from src/esphome/components/mqtt/mqtt_client.cpp:1:
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::set_secure(bool)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:27:34: error: 'mqtt_client' was not declared in this scope
void set_secure(bool secure) { mqtt_client.setSecure(secure); }
^
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::add_server_fingerprint(const uint8_t*)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:28:61: error: 'mqtt_client' was not declared in this scope
void add_server_fingerprint(const uint8_t *fingerprint) { mqtt_client.addServerFingerprint(fingerprint); }
^
In file included from src/esphome/components/mqtt/mqtt_client.h:15:0,
from src/esphome/components/mqtt/mqtt_component.h:11,
from src/esphome/components/mqtt/mqtt_component.cpp:1:
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::set_secure(bool)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:27:34: error: 'mqtt_client' was not declared in this scope
void set_secure(bool secure) { mqtt_client.setSecure(secure); }
^
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::add_server_fingerprint(const uint8_t*)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:28:61: error: 'mqtt_client' was not declared in this scope
void add_server_fingerprint(const uint8_t *fingerprint) { mqtt_client.addServerFingerprint(fingerprint); }
^
src/esphome/components/mqtt/mqtt_client.cpp: In member function 'void esphome::mqtt::MQTTClientComponent::add_ssl_fingerprint(const std::array<unsigned char, 20u>&)':
src/esphome/components/mqtt/mqtt_client.cpp:585:23: error: 'class esphome::mqtt::MQTTBackendArduino' has no member named 'setSecure'
this->mqtt_backend_.setSecure(true);
^
src/esphome/components/mqtt/mqtt_client.cpp:586:23: error: 'class esphome::mqtt::MQTTBackendArduino' has no member named 'addServerFingerprint'
this->mqtt_backend_.addServerFingerprint(fingerprint.data());
^
In file included from src/esphome/components/mqtt/mqtt_client.h:15:0,
from src/esphome/components/mqtt/mqtt_component.h:11,
from src/esphome/components/mqtt/mqtt_cover.h:4,
from src/esphome/components/mqtt/mqtt_cover.cpp:1:
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::set_secure(bool)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:27:34: error: 'mqtt_client' was not declared in this scope
void set_secure(bool secure) { mqtt_client.setSecure(secure); }
^
src/esphome/components/mqtt/mqtt_backend_arduino.h: In member function 'void esphome::mqtt::MQTTBackendArduino::add_server_fingerprint(const uint8_t*)':
src/esphome/components/mqtt/mqtt_backend_arduino.h:28:61: error: 'mqtt_client' was not declared in this scope
void add_server_fingerprint(const uint8_t *fingerprint) { mqtt_client.addServerFingerprint(fingerprint); }
^
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-nonnull-compare" [enabled by default]
*** [/data/propagator-ht/.pioenvs/propagator-ht/src/esphome/components/mqtt/mqtt_cover.cpp.o] Error 1
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-nonnull-compare" [enabled by default]
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-nonnull-compare" [enabled by default]
*** [/data/propagator-ht/.pioenvs/propagator-ht/src/esphome/components/mqtt/mqtt_client.cpp.o] Error 1
*** [/data/propagator-ht/.pioenvs/propagator-ht/src/esphome/components/mqtt/mqtt_component.cpp.o] Error 1
========================= [FAILED] Took 42.18 seconds =========================
Any reason why esphome can't use BearSSL for this type of thing like Tasmota does?
No reason other than no one has done it yet.
Well, it seems this issue is pretty old, yet I got the SSL error message while trying to use it for my MQTT connection... Any chance someone has a clue to deal with this? (ESP8266 / NodeMCU here)
I haven't compiled this in a while, but I suspect it still works or would with a little tweaking:
I haven't compiled this in a while, but I suspect it still works or would with a little tweaking:
Thank you Aneisch,
adding the librairies from your script I now got another error, which does not seem related to SSL.
Actually I got the same error than the pal above: 'mqtt_client' was not declared in this scope
Hello. This is still an issue with latest version of ESPHOME. Compiling with a previous version is not possible because it gives another set of problems (now pip doesn't even install the version 2021.10.3).
Could you address this issue? It's not possible to use ESPHOME with MQTT over a secure connection with this bug present.
Not a great help unfortunately, but if anyone else is wondering how to get this working quickly, the last stable version that works is
esphome/esphome:2021.10.3
This version does not install anymore!
When trying to install it (pip install esphome==2021.10.3
) I receive the following error:
Collecting esphome==2021.10.3
Using cached esphome-2021.10.3-py2.py3-none-any.whl (1.9 MB)
Collecting voluptuous==0.12.2 (from esphome==2021.10.3)
Using cached voluptuous-0.12.2.tar.gz (48 kB)
Preparing metadata (setup.py) ... done
Collecting PyYAML==5.4.1 (from esphome==2021.10.3)
Using cached PyYAML-5.4.1.tar.gz (175 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [62 lines of output]
C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\config\setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
!!
********************************************************************************
The license_file parameter is deprecated, use license_files instead.
By 2023-Oct-30, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
********************************************************************************
!!
parsed = self.parsers.get(option_name, lambda x: x)(value)
running egg_info
writing lib3\PyYAML.egg-info\PKG-INFO
writing dependency_links to lib3\PyYAML.egg-info\dependency_links.txt
writing top-level names to lib3\PyYAML.egg-info\top_level.txt
Traceback (most recent call last):
File "C:\Users\Gonza\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\Gonza\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\Gonza\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires
self.run_setup()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup
exec(code, locals())
File "<string>", line 271, in <module>
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\__init__.py", line 107, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
return run_commands(dist)
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
dist.run_commands()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
self.run_command(cmd)
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\dist.py", line 1234, in run_command
super().run_command(command)
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 314, in run
self.find_sources()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 322, in find_sources
mm.run()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 551, in run
self.add_defaults()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 589, in add_defaults
sdist.add_defaults(self)
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\command\sdist.py", line 104, in add_defaults
super().add_defaults()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 251, in add_defaults
self._add_defaults_ext()
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 336, in _add_defaults_ext
self.filelist.extend(build_ext.get_source_files())
File "<string>", line 201, in get_source_files
File "C:\Users\Gonza\AppData\Local\Temp\pip-build-env-vwkt3ncw\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 107, in __getattr__
raise AttributeError(attr)
AttributeError: cython_sources
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Found the workaround to install esphome 2021.10.3
You need to install it using Python 3.9.13. Does not work with newer versions of Python.
But now we have another problem. When trying to compile the yaml I get this error. My version of platformio is too old (because is the one installed with esphome 2021.10.3) and it fails to compile.
Platform Manager: Installing platformio/espressif8266 @ 2.6.3
Error: Please upgrade to the PlatformIO Core 6
I'm facing the same issue. The moment I add ssl_fingerprints
to the yaml file the compiler misses the ssl.h file.
Any workaround to this?
Same problem here. I can't compile esphome with the ssl_fingerprints option. Error with missing ssl.h file.
Same problem with the latest HA and ESPhome
same here on 2024.5.1 ....still missing ssl.h during compiling on esp8266 with ssl fingerprint
Same Problem with the current version
Does it means that the mqtt connection through TLS/SSL in ESPHome is not supported?
Does it means that the mqtt connection through TLS/SSL in ESPHome is not supported?
I'm not sure but i think the bug is limited to esp8266 due to the necessity of using "ssl figerprint" instead of regular ssl cert verification like on esp-idf (esp32). The feature is supported though it's just not working and needs to be fixed to compile succesfully
Same with ESPHome 2024.6.2: include/ssl.h: No such file or directory
Really hope this gets fixed. Wanted to connect to a public mqtt broker so i could have a remote sensor at my friends cabin without much of a headache and I've been chasing my tail all evening.
@HeMan without any pressure: maybe, you are the owner the https://github.com/HeMan/async-mqtt-client repo and you have also enough rights to collaborate in https://github.com/esphome/ESPAsyncTCP repos. Can you please check how we can proceed the compilation error with ESPAsyncTCP? I bet it tries to fetch axTLS-8266 components such as ssl.h, etc...
Searching for additional information I found this ESPAsyncTCP fork that switched over a different SSL implementation (bearssl): https://github.com/Adam5Wu/ESPAsyncTCP/. Here a discussion regarding bearssl usage in ESPAsyncTCP: me-no-dev/ESPAsyncTCP#95. I don't know the level of maturity of this port though.
UP!
plus adding another interesting repo: https://github.com/mcspr/ESPAsyncTCP/tree/bearssl
Oh, hadn't noticed that! I'll have a look!
In a nutshell, after I've complemented the missing modules from axTLS I've got the same (masked) error as using the bearSSL variant of mcspr or Adam5wu. This is in a recursive log:
In file included from src/esphome/components/mqtt/mqtt_client.h:15,
from src/esphome/components/mqtt/custom_mqtt_device.h:7,
from src/esphome/components/mqtt/custom_mqtt_device.cpp:1:
src/esphome/components/mqtt/mqtt_backend_esp8266.h: In member function 'void esphome::mqtt::MQTTBackendESP8266::set_secure(bool)':
src/esphome/components/mqtt/mqtt_backend_esp8266.h:26:34: error: 'mqtt_client' was not declared in this scope; did you mean 'mqtt_client_'?
26 | void set_secure(bool secure) { mqtt_client.setSecure(secure); }
| ^~~~~~~~~~~
| mqtt_client_
src/esphome/components/mqtt/mqtt_backend_esp8266.h: In member function 'void esphome::mqtt::MQTTBackendESP8266::add_server_fingerprint(const uint8_t*)':
src/esphome/components/mqtt/mqtt_backend_esp8266.h:27:61: error: 'mqtt_client' was not declared in this scope; did you mean 'mqtt_client_'?
27 | void add_server_fingerprint(const uint8_t *fingerprint) { mqtt_client.addServerFingerprint(fingerprint); }
| ^~~~~~~~~~~
| mqtt_client_
and
src/esphome/components/mqtt/mqtt_client.cpp: In member function 'void esphome::mqtt::MQTTClientComponent::add_ssl_fingerprint(const std::array<unsigned char, 20>&)':
src/esphome/components/mqtt/mqtt_client.cpp:660:23: error: 'class esphome::mqtt::MQTTBackendESP8266' has no member named 'setSecure'; did you mean 'set_secure'?
660 | this->mqtt_backend_.setSecure(true);
| ^~~~~~~~~
| set_secure
src/esphome/components/mqtt/mqtt_client.cpp:661:23: error: 'class esphome::mqtt::MQTTBackendESP8266' has no member named 'addServerFingerprint'; did you mean 'add_server_fingerprint'?
661 | this->mqtt_backend_.addServerFingerprint(fingerprint.data());
| ^~~~~~~~~~~~~~~~~~~~
| add_server_fingerprint
*** [.pioenvs/wstation/src/esphome/components/mqtt/mqtt_component.cpp.o] Error 1
*** [.pioenvs/wstation/src/esphome/components/mqtt/mqtt_cover.cpp.o] Error 1
*** [.pioenvs/wstation/src/esphome/components/mqtt/mqtt_client.cpp.o] Error 1
I suspect the issue persists with Libretiny alongside ESP8266.
it sucks that this isn't fixed
The problem
Compiling a firmware for wemos d1 mini (ESP8266) using the MQTT over SSL component (with ssl_fingerprints set in yaml configuration file) on dev Docker container version 2021.11.0-dev fails due to missing included include/ssl.h file. Switching over MQTT in clear text solves the issue and compilation completes successfully.
Which version of ESPHome has the issue?
2021.11.0-dev
What type of installation are you using?
Docker
Which version of Home Assistant has the issue?
NA
What platform are you using?
ESP8266
Board
wemos d1 mini (d1_mini)
Component causing the issue
MQTT
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response