gvigroux / hon

Support of all Haier, Candy, Hoover appliances integrated in the official hOn mobile app. Direct access to all possible services and parameters
MIT License
135 stars 51 forks source link

Python 3.12 support needed #125

Closed ruudleijnse closed 7 months ago

ruudleijnse commented 7 months ago

First of all, thank you for your time put in to this custom component.

Since version 2024.2 the hacs component is not working anymore due to the python update in homeassistant core.

please see: https://www.home-assistant.io/blog/2024/02/07/release-20242/#shipping-on-a-new-python-version

Shipping on a new Python version This release ships running on Python 3.12! In case you are wondering, what is that? Well, Python is the programming language Home Assistant is written in.

Why it matters? It provides many improvements to the foundation we are building Home Assistant on, most notably: It is faster! 🚀

Don’t worry! If you run the Home Assistant Operating System or are using the Home Assistant Container installation type: You won’t have to do anything, as we handle the upgrade to Python 3.12 for you. Just upgrade Home Assistant as you normally would, and you are good to go! 😎

An fork of this custom component also has the same issue. refference: https://github.com/Andre0512/hon/issues/164

Logger: homeassistant.setup
Source: setup.py:251
First occurred: 22:47:15 (1 occurrences)
Last logged: 22:47:15

Setup failed for custom integration 'hon': Unable to import component: No module named 'imp'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 827, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/hon/__init__.py", line 2, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'
ruudleijnse commented 7 months ago

I have found the solution was to replace the import imp for importlib.

But wanted to do a pull request seeing you already fixed it. But i don't get the update in my home assistant. Did you make a release for HACS for it ?

ruudleijnse commented 7 months ago

Found why i wasn't getting the update. I have installed your component manually instead of via HACS. Now installed the HACS version and it is working great! Thank you so much for your time and effort!