Hi All,
I installed Homeassistant Supervised (In docker) on a raspberry pi 4 running Debian 10 (Buster). I installed several addons: Mosquitto MQTT broker, Zigbee2MQTT and ESPHome.
I wanted to use a ESP-32S as a bridge between several LYWSD03MMC temperature and humidity sensors and integrate that into homeassistant via ESPHome.
I prepared the configuration file based on several examples i found on the internet as shown below: (Passes validation)
esphome:
name: xiaomi_sensor_bridge_1
platform: ESP32
board: nodemcu-32s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
level: debug
api:
reboot_timeout: 60min
ota:
password: !secret ota_password
time:
- platform: homeassistant
esp32_ble_tracker:
switch:
- platform: gpio
name: "Onboard-LED"
pin: 2
inverted: True
- platform: restart
name: restart
id: restart_switch
sensor:
- platform: uptime
name: "Uptime Sensor"
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
- platform: xiaomi_lywsd03mmc
mac_address: A4:C1:38:FA:4C:CB
bindkey: "8ab5d4db49b2e003c6d6db9955763841"
temperature:
name: "Temperature"
humidity:
name: "Humidity"
battery_level:
name: "Battery Level"
Then, upon compiling the firmware for the ESP-32S i run into issues when the compiler is trying to access web-based resources. Namely when trying to update/upgrade platformio and install libraries such as: toolchain-xtensa32, AsyncTCP-esphome @ 1.1.1 and platformio/tool-scons @ ~4.40001.0.
Ultimately the compile always fails due to âFailed to establish a new connection: [Errno -2] Name or service not knownâ. The order in which these dependencies are installed seems to vary over time (while the system has been âidleâ) and as such the error log also varies.
ESPHome compiler log:
INFO Reading configuration /config/esphome/xiaomi_sensor_bridge_1.yaml...
INFO Detected timezone 'CET' with UTC offset 1 and daylight savings time from 27 March 02:00:00 to 30 October 03:00:00
INFO Generating C++ source...
INFO Compiling app...
INFO Running: platformio run -d /config/esphome/xiaomi_sensor_bridge_1
Processing xiaomi_sensor_bridge_1 (board: nodemcu-32s; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
Tool Manager: Installing toolchain-xtensa32 @ ~2.50200.0
Tool Manager: Warning! More than one package has been found by toolchain-xtensa32 @ ~2.50200.0 requirements:
- platformio/toolchain-xtensa32 @ 2.50200.97
- tasmota/toolchain-xtensa32 @ 2.80400.2020
Tool Manager: Please specify detailed REQUIREMENTS using package owner and version (showed above) to avoid name conflicts
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: toolchain-xtensa32 @ 2.50200.97 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40001.0
WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xf66d9cb0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /v3/packages/platformio/tool/tool-scons
WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xf66d9cf0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /v3/packages/platformio/tool/tool-scons
WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xf66d9db0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /v3/packages/platformio/tool/tool-scons
Error: Please read http://bit.ly/package-manager-ioerror
Tool Manager: Tool Manager: Warning! Package Mirror: HTTPSConnectionPool(host='dl.registry.nm1.platformio.org', port=443): Max retries exceeded with url: /tools/4b/5d/7f5a13840b4ac9110d535744aa4414e9266c1b18b8ca69919f97aa6cdeb6/tool-scons-4.40001.0.tar.gz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xf66c0bb0>: Failed to establish a new connection: [Errno -2] Name or service not known',))
Tool Manager: Looking for another mirror...
Tool Manager: tool-scons @ 4.40001.0 has been installed!
Tool Manager: Removing tool-scons @ 3.30102.0
Tool Manager: tool-scons @ 3.30102.0 has been removed!
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif32 3.10004.200129 (1.0.4)
- tool-esptoolpy 1.20600.0 (2.6.0)
- toolchain-xtensa32 2.50200.97 (5.2.0)
Library Manager: Installing AsyncTCP-esphome @ 1.1.1
HTTPClientError: HTTPSConnectionPool(host='api.registry.ns1.platformio.org', port=443): Max retries exceeded with url: /v3/packages?query=type%3A%22library%22+name%3A%22asynctcp-esphome%22 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0xf63a6270>: Failed to establish a new connection: [Errno -2] Name or service not known',)):
File "/usr/local/lib/python3.6/dist-packages/platformio/builder/main.py", line 170:
env.SConscript("$BUILD_SCRIPT")
File "/root/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 598:
return _SConscript(self.fs, *files, **subst_kw)
File "/root/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 287:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/root/.platformio/platforms/espressif32/builder/main.py", line 223:
target_elf = env.BuildProgram()
File "/root/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Environment.py", line 219:
return self.method(*nargs, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/platformio/builder/tools/platformio.py", line 62:
env.ProcessProjectDeps()
File "/root/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Environment.py", line 219:
return self.method(*nargs, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/platformio/builder/tools/platformio.py", line 140:
project_lib_builder = env.ConfigureProjectLibBuilder()
File "/root/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Environment.py", line 219:
return self.method(*nargs, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/platformio/builder/tools/piolib.py", line 1062:
project.install_dependencies()
File "/usr/local/lib/python3.6/dist-packages/platformio/builder/tools/piolib.py", line 898:
lm.install(spec)
File "/usr/local/lib/python3.6/dist-packages/platformio/package/manager/_install.py", line 49:
spec, silent=silent, skip_dependencies=skip_dependencies, force=force
File "/usr/local/lib/python3.6/dist-packages/platformio/package/manager/library.py", line 86:
force=force,
File "/usr/local/lib/python3.6/dist-packages/platformio/package/manager/_install.py", line 99:
pkg = self.install_from_registry(spec, search_filters, silent=silent)
File "/usr/local/lib/python3.6/dist-packages/platformio/package/manager/_registry.py", line 88:
packages = self.search_registry_packages(spec, search_filters)
File "/usr/local/lib/python3.6/dist-packages/platformio/package/manager/_registry.py", line 135:
return self.get_registry_client_instance().list_packages(filters=filters)[
File "/usr/local/lib/python3.6/dist-packages/platformio/clients/registry.py", line 131:
"get", "/v3/packages", params=params, cache_valid="1h"
File "/usr/local/lib/python3.6/dist-packages/platformio/clients/http.py", line 144:
response = self.send_request(method, path, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/platformio/util.py", line 73:
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/platformio/clients/http.py", line 131:
raise HTTPClientError(str(e))
========================= [FAILED] Took 43.51 seconds =========================
I have done some research and some people seem to be talking about DNS issues. However, my setup seems rather straightforward. My Raspberry pi is connected to my router which manages its own subnet behind a modem (Required for my IPTV to work). Besides ESPHome the raspberry does not seem to have internet connection issues (Maybe aside from some spurious connection errors in the homeassistant log: 21-03-28 17:21:05 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.32.1:64042 ssl:default [Connect call failed (â172.30.32.1â, 64042)]).
I have followed the second answer on: https://stackoverflow.com/questions/39400886/docker-cannot-resolve-dns-on-private-network
But unfortunately to no avail.
I was able to manually access the addresses and download contents that failed to be resolved by ESPHome during firmware compilation.
Has anyone else had this problem or can help me solve it? I know some linux and networking basics, but unfortunately i am not very knowledgeable on networking stuff or linux.