Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken after update to HA 2024.2.0 #693

Closed
RobertoCravallo opened this issue Feb 8, 2024 · 51 comments
Closed

Broken after update to HA 2024.2.0 #693

RobertoCravallo opened this issue Feb 8, 2024 · 51 comments

Comments

@RobertoCravallo
Copy link

Describe the bug
Integration does not load after todays HA update to 2024.2.0

Expected behavior

Screenshots
08564dbde913062df56e941543b1d1abd2691ae3

Environment details:

  • HA 2024.2.0 under PROXMOX
  • v0.37.2

Output of HA logs

Additional context
Worked fine up to the HA update

@ollo69
Copy link
Owner

ollo69 commented Feb 8, 2024

Please check and provide error log

@RobertoCravallo
Copy link
Author

Sorry, not very firm with the LOG thingy, this helpful?

home-assistant_smartthinq_sensors_2024-02-08T08-40-38.299Z.log

@ollo69
Copy link
Owner

ollo69 commented Feb 8, 2024

Seems that there are something wrong in your env that cause the config flow to not load.
The error is connected to Python 3.12, as reported in this thread: https://stackoverflow.com/questions/77364550/attributeerror-module-pkgutil-has-no-attribute-impimporter-did-you-mean
This is not an integration error but something related to HA environment.
I still do not upgrade HA to last version but I'm already using Python 3.12 from some days without any issue. I will upgrade it later today and report here if it works for me, in the meantime I suggest you to check in HA forum for similar error and possible solution.

@mbalug7
Copy link

mbalug7 commented Feb 8, 2024

I got the same problem.
HA 2024.2 docker
Ubuntu Server 22.04
Rollback to 2021.6 version has fixed my issue, so I don't have additional logs (there was some error with pkgutil module), but it should be reproduceable in docker container as well.

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 8, 2024

Uninstalled LG and reinstalled. Still getting this message.

Settings – Home Assistant 2024-02-08 14-56-48

@ollo69
Copy link
Owner

ollo69 commented Feb 8, 2024

Again, as I explain at the beginning of this thread this problem is related to outdated version of pip, not the integration. You need to fix this or the config flow will never start.

@RobertoCravallo
Copy link
Author

I reverted to 2024.1.6 and all is well again...

So how do I update PIP?

@ollo69
Copy link
Owner

ollo69 commented Feb 8, 2024

Depend on the environment that you have. In the link that I provide there are the instruction for venv, I don't know which king of HA envirnoment you re using

@RobertoCravallo
Copy link
Author

I am running HA in a PROXMOX VM.

@RobertoCravallo
Copy link
Author

2024 2: More voice, more icons, more integrations, more  everything! - Blog - Home Assistant Community 2024-02-08 15-44-02

This is what HA moderator has to say about this.

@ollo69
Copy link
Owner

ollo69 commented Feb 8, 2024

Ok, I will take a deeper look to the version of PYCountry used and if exist new version

@ollo69
Copy link
Owner

ollo69 commented Feb 8, 2024

Think that I found the issue. Is new versions of PyCountry library that fail to install with Python 3.12. I have fixed this and will be available with next release.

@ollo69
Copy link
Owner

ollo69 commented Feb 9, 2024

Please try last release, should work properly with Python 3.12 and HA 2024.2

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 9, 2024

Hello ollo69,
perfection, with your update of LG, it is now functioning. My GARMIN integration was also not working, but after your fix, that is now working also. Thank you very much for your work.
Regards from Germany,
Robert

@ollo69
Copy link
Owner

ollo69 commented Feb 9, 2024

My GARMIN integration was also not working, but after your fix, that is now working also

I do not exactly understand the relation, unless also that integration is using PyCountry (and so should implement same fix that I did).

I close this.

@ollo69 ollo69 closed this as completed Feb 9, 2024
@mbalug7
Copy link

mbalug7 commented Feb 9, 2024

It works in HA docker container as well. Tnx

@mbalug7
Copy link

mbalug7 commented Feb 9, 2024

It works in HA docker container as well. Tnx

Initially it worked fine (I tried to change the temperature, and it was updated in LG app as well), but then I rebooted my server, and now I have this:

2024-02-09 13:41:51.439 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.smartthinq_sensors.config_flow
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 847, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 864, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/smartthinq_sensors/config_flow.py", line 9, in <module>
    from pycountry import countries as py_countries, languages as py_languages
  File "/usr/local/lib/python3.12/site-packages/pycountry/__init__.py", line 10, in <module>
    import pkg_resources
  File "/usr/local/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2191, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
2024-02-09 13:41:51.441 ERROR (MainThread) [homeassistant.config_entries] Error importing platform config_flow from integration smartthinq_sensors to set up smartthinq_sensors configuration entry: Exception importing custom_components.smartthinq_sensors.config_flow

EDIT:
I restarted it again several times, and now it works without any error.

@ollo69
Copy link
Owner

ollo69 commented Feb 9, 2024

@mbalug7,

good to know that it works, but my suspect is that there is another integration that force installation of newer pycountry version that cause the problem, and so the result can be random.
If you will have again the issue, you could try to disable other custom integration to try to identify the one that is causing the problem.

@RobertoCravallo
Copy link
Author

You where right, the problem is back as of today. I did not install or update anything, but still...

@ollo69
Copy link
Owner

ollo69 commented Feb 10, 2024

You where right, the problem is back as of today. I did not install or update anything, but still...

Because you said that my change also fix Garmin integration, you could try to disable that to see if it is the cause.

@RobertoCravallo
Copy link
Author

I disabled GARMIN, no change. Uninstalled GARMIN, no change. For me, LGE-Sensors is still not working...

@ollo69
Copy link
Owner

ollo69 commented Feb 11, 2024

Try disabling also other integration, quite sure that this is not an issue on this integration.
Eventually, if you can open a terminal on your HA server, try to run the command pip show pycountry and report here the returned values.

@RobertoCravallo
Copy link
Author

Terminal – Home Assistant 2024-02-11 17-20-19

@ollo69
Copy link
Owner

ollo69 commented Feb 11, 2024

Uhm, quite strange that pycountry is not installed at all. And if you install it with command pip install pycountry<23.0.0,>=22.1.10 and that reboot HA? This could solve the issue...

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 11, 2024

Terminal – Home Assistant 2024-02-11 17-32-25
Guess I am doing something wrong. I am using the HA TERMINAL.

image

https://www.home-assistant.io/faq/pip/

@ollo69
Copy link
Owner

ollo69 commented Feb 11, 2024

pip install pycountry"<23.0.0,>=22.1.10"

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 11, 2024

That worked...
Terminal – Home Assistant 2024-02-11 17-46-12
Rebooted HA, no change. Reinstalled SmartThinQ LGE Sensors, no change.

@ollo69
Copy link
Owner

ollo69 commented Feb 11, 2024

Uhm, I suspect that HA is running inside a venv, so you are not installing in the right place. You must understand how to activate the correct venv and perform the same check inside it.

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 11, 2024

HA is running in a PROXMOX VM. I'm an old guy (68) and am just a user. I guess I will just wait and see what happens. I am very surprised, that there are not more people that have this problem. Thank you for your time!!!

@mbalug7
Copy link

mbalug7 commented Feb 11, 2024

I executed the following commands inside my HA docker container: https://stackoverflow.com/a/77364602

Now it works after every reboot. Since I have dockerized version of Home Assistant, I would expect that all changes I make in the Docker container disappear after a restart, but for some reason it works.

Currently, I really don't have time to delve deeper into this, but after I implemented the suggestions provided in the Stack Overflow answer, things started working correctly.

@RobertoCravallo
Copy link
Author

.. unfortunately, my knowledge is nowhere close to even try to implement this!!!

@mbalug7
Copy link

mbalug7 commented Feb 11, 2024

.. unfortunately, my knowledge is nowhere close to even try to implement this!!!

try to run these commands in terminal here:
image

@RobertoCravallo
Copy link
Author

That is my screenshot... Did not work.

@mbalug7
Copy link

mbalug7 commented Feb 11, 2024

That is my screenshot... Did not work.

yes, I just used is as a reference to show where to run the commands from stack overflow answer.
Have you tried to reboot?
As I said, I don't know why it works now for me, but it just does.
Also, I think I reinstalled this integration as a last step before reboot:

  • I removed custom_components/smartthinq_sensors directory and installed it again with HACS, so that might be the step that actually fixed my problem

@ollo69
Copy link
Owner

ollo69 commented Feb 11, 2024

Sorry but I really have no idea on what could be the problem. I have Python 3.12 and HA 2024.2.1 and everything work properly.

@RobertoCravallo,

are you sure that the problem is the same reported at beginning of this thread? As last option you could try to install the native component Radio Browser that should force installation of right version of pycountry

@ollo69
Copy link
Owner

ollo69 commented Feb 11, 2024

I reopen this issue, let's see if others have same issue.

@ollo69 ollo69 reopened this Feb 11, 2024
@upthinkweb
Copy link

Have the same issue. Running on HASSOS/VM on TrueNAS Scale.

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 12, 2024

Settings – Home Assistant 2024-02-12 07-14-55

Trying to load radio browser I get this. Maybe my whole HA is broken somehow!!

I had radio browser installed before the HA update and it was broke after....

e16f12ab9297fe8923842d64afe6d3bdbd689a94

@RobertoCravallo RobertoCravallo changed the title Brokwn after update to HA 2024.2.0 Broken after update to HA 2024.2.0 Feb 12, 2024
@ollo69
Copy link
Owner

ollo69 commented Feb 12, 2024

I suggest you to disable all custom integration and try again. If still doesn't work, you can ask support to HA team because this is a native integration. But probably something is broken in your HA installation.

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 12, 2024

Very, very strange. I installed HA on PROXMOX and then installed my back-up. After all was said and done, the error is gone. After restarting HA, it is back.... I am going crazy!!!!

I set up HA from scratch and started adding add-ons. All was well for hours and then it was not. The error is back. LQ does not like something, do not know hat. Went back and uninstalled one add-on at a time and did a boot (PROXMOX). I guess once the error shows, nothing seems to make it go away.

@countrock
Copy link

Mine was broken! But it's fixed now by itself! Not sure what fixed it!

@RobertoCravallo
Copy link
Author

I have a integration that is called TANKERKÖNIG (checks gasoline prices) which gives me a "internal server 500 error" most of the day. In the morning, it works just fine. Still have not figured out why this is so. Maybe it does not like a HA restart / boot?

I am hoping, just as it happened for countrock, that it will go away by itself at some point...

@RobertoCravallo
Copy link
Author

RobertoCravallo commented Feb 16, 2024

With todays update to 2024.2.2 it is working again...

Unfortunately not!! Worked and then gone again...

@ollo69
Copy link
Owner

ollo69 commented Feb 16, 2024

So at the end was not integration issue.😉.
I suppose that some library used by HA was causing the issue and in last update this has been fixed.
I close this, hoping that this issue do not come back again.

@ollo69 ollo69 closed this as completed Feb 16, 2024
@RobertoCravallo
Copy link
Author

Just wanted to let you know, that I found the problem and it was SOLARFOCUS.

This is what I wrote the developer:
"I just installed a new HA VM under PROXMOX. From my running system I deinstalled SOLARFOCUS and made a back-up. Installed the back-up in the new VM HA and everything is fine. So I am very sure the problem lies with SOLARFOCUS."

@ollo69
Copy link
Owner

ollo69 commented Feb 21, 2024

@RobertoCravallo ,

good catch!
May be this should also be sent to the attention of HA team. They should not allow to break some functionality (included native integration) due to a custom integration.

@FreyrPL
Copy link

FreyrPL commented Feb 27, 2024

Hi,
With HA Core update 2024.2.4 everything is back to normal. Addon works as it should ;)

@pcartwright81
Copy link

Updated to 2024.4.0.dev20240319 and the issue is back. I'm using Home Assistant Operating System 12.2.dev20240313.
I have tried the following:
Reinstalled Smarthinq Sensors
Installing Radio Browser
From the logs 2024-03-19 23:07:27.676 ERROR (SyncWorker_1) [homeassistant.util.package] Unable to install package pycountry<23.0.0,>=22.1.10: ERROR: Cannot install pycountry<23.0.0 and >=22.1.10 because these package versions have conflicting dependencies.

Looking at the screenshots above, wouldn't we need to be inside of the docker container that core is running in to install pycountry?

@FreyrPL
Copy link

FreyrPL commented Mar 22, 2024

Problem is back. The thing is, after updating HA core to next version problem is gone untill HA restart. After restart problem is back untill next core update. Looks like some dependencies regarding 'pycountry ' are being reinstalled every restart.
I have no clue how to resolve this.

@pcartwright81
Copy link

This is being tracked in issue 725. I edited manifest.json at the location \\homeassistant.local\config\homeassistant\custom_components\smartthinq_sensors to say pycountry>23.0.0 and it seems to be working now. The version has to be greater than 23.0.0 for the new beta versions.

@nickrout
Copy link

Home assistant seems to have constrained pycountry to >23.12.11 two weeks ago.

home-assistant/core@f3984a9

This custom integration constrains pycountry to pycountry<23.0.0,>=22.1.10

You can't be >23.12.11 and <23.0.0. I suspect that is the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants