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

HA release 2024.1 breaks this integration #76

Closed
jaymunro opened this issue Jan 3, 2024 · 7 comments · Fixed by #79
Closed

HA release 2024.1 breaks this integration #76

jaymunro opened this issue Jan 3, 2024 · 7 comments · Fixed by #79

Comments

@jaymunro
Copy link
Contributor

jaymunro commented Jan 3, 2024

Version of the custom_component

0.0.0 as in const.py
0.3.1 in HACS

Configuration

Add your logs here.

Describe the bug

Integration will not load. Has the errors:

Setup failed for custom integration 'bermuda': Unable to import component: cannot import name 'monotonic_time_coarse' from 'homeassistant.util.dt' (/usr/src/homeassistant/homeassistant/util/dt.py)

and

Error occurred loading flow for integration bermuda: cannot import name 'monotonic_time_coarse' from 'homeassistant.util.dt' (/usr/src/homeassistant/homeassistant/util/dt.py)

This seems to have been caused by the PR: Remove monotonic_time_coarse datetime helper released with 2024.1

Debug log

Setup failed for custom integration 'bermuda': Unable to import component: cannot import name 'monotonic_time_coarse' from 'homeassistant.util.dt' (/usr/src/homeassistant/homeassistant/util/dt.py)
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 822, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/bermuda/__init__.py", line 37, in <module>
    from homeassistant.util.dt import monotonic_time_coarse
ImportError: cannot import name 'monotonic_time_coarse' from 'homeassistant.util.dt' (/usr/src/homeassistant/homeassistant/util/dt.py)
@jaymunro
Copy link
Contributor Author

jaymunro commented Jan 4, 2024

It seems the location of monotonic_time_coarse has changed:

Bluetooth-Devices/bluetooth-data-tools#38

@agittins
Copy link
Owner

agittins commented Jan 4, 2024

Do you want to try this out on your system now? I think this should work on both prior and future versions.
Thanks for your work on chasing this down and providing the initial solution!

@agittins agittins reopened this Jan 4, 2024
@jaymunro
Copy link
Contributor Author

jaymunro commented Jan 4, 2024 via email

@jaymunro
Copy link
Contributor Author

jaymunro commented Jan 4, 2024

I've manually edited __init__.py, changed the import and removed line 63 and that loads correctly.
I will reload from the repository and try again to make sure the repository is 100% working.
Shouldn't we also update the version number to 0.3.2 (or similar)? Where is the version number updated?

@jaymunro
Copy link
Contributor Author

jaymunro commented Jan 4, 2024

@agittins I see you've already taken care of the version in HACS (this is still showing as 0.0.0 in const.py and would be nice to fix this as there is no indication of the version in the downloaded code - something still not working with the auto replace?).

However, the repo now correctly loads so I think we can close this. Agree?

@jaymunro
Copy link
Contributor Author

jaymunro commented Jan 4, 2024

Note, I have no chance to test with versions prior to 2024.1

@agittins
Copy link
Owner

agittins commented Jan 5, 2024

All good, it worked fine on my pre-2024 HA test setup, and also works on my live 2024.1 so I think we're good.

I have a task to work out how HACS is doing it's thing re versions. It shows the version in the HACS UI, so it seems to be aware of the release tags I guess, but I think it checks out the repo at that tag rather than downloading the release files. I need to find out what the expected workflow is there, because I'd rather avoid the repo having the version coded in, as it will mislead users into thinking they're using a particular version when they might be using a checkout from some time after that version. Anyway, it's on my TODO.

@agittins agittins closed this as completed Jan 5, 2024
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

Successfully merging a pull request may close this issue.

2 participants