home-assistant / connectzbt1.home-assistant.io

https://connectzbt1.home-assistant.io
Apache License 2.0
22 stars 10 forks source link

WebSerial flasher fails due to missing 'ssl' Python library #92

Closed tofurky closed 11 months ago

tofurky commented 11 months ago

The problem

When attempting to flash a SkyConnect via the WebSerial updater, the following is seen in browser JS console. It seems that the ssl library needs to be manually installed, as it's not bundled with pyodide.

pyodide.asm.js:10 Uncaught (in promise) PythonError: Traceback (most recent call last):
  File "/lib/python3.10/_pyodide/_base.py", line 460, in eval_code
    .run(globals, locals)
  File "/lib/python3.10/_pyodide/_base.py", line 304, in run
    coroutine = eval(self.code, globals, locals)
  File "<exec>", line 2, in <module>
  File "/lib/python3.10/site-packages/universal_silabs_flasher/flasher.py", line 15, in <module>
    from .gbl import GBLImage
  File "/lib/python3.10/site-packages/universal_silabs_flasher/gbl.py", line 8, in <module>
    from zigpy.ota.validators import parse_silabs_gbl
  File "/lib/python3.10/site-packages/zigpy/ota/__init__.py", line 23, in <module>
    import zigpy.ota.provider
  File "/lib/python3.10/site-packages/zigpy/ota/provider.py", line 14, in <module>
    import ssl
ModuleNotFoundError: The module 'ssl' is unvendored from the Python standard library in the Pyodide distribution.
You can install it by calling:
  await micropip.install("ssl") in Python, or
  await pyodide.loadPackage("ssl") in JavaScript
See https://pyodide.org/en/stable/usage/loading-packages.html for more details.

    at new_error (pyodide.asm.js:10:179954)
    at pyodide.asm.wasm:0xe78a8
    at pyodide.asm.wasm:0xe79ad
    at Module._pythonexc2js (pyodide.asm.js:10:928566)
    at Module.callPyObjectKwargs (pyodide.asm.js:10:123572)
    at Module.callPyObject (pyodide.asm.js:10:123781)
    at Function.apply (pyodide.asm.js:10:134751)
    at Object.apply (pyodide.asm.js:10:133745)
    at Object.runPython (pyodide.asm.js:10:161550)
    at Ne.onPyodideLoaded (flashing-dialog-a8f5f5ab.js?module:281:970)
    at Ne.selectSerialPort (flashing-dialog-a8f5f5ab.js?module:281:552)

This causes the updater to hang at the Connecting... This can take a few seconds. step.

Using Chrome 120.0.6099.71 on Linux x86_64.

image

Link to the page

https://skyconnect.home-assistant.io/firmware-update/

puddly commented 11 months ago

This will be addressed once https://github.com/NabuCasa/sl-web-tools/pull/12 is merged.

tofurky commented 11 months ago

This will be addressed once NabuCasa/sl-web-tools#12 is merged.

Ah, didn't see that other repo and the existing ticket. Feel free to close this now or when that's merged.