Closed soloam closed 2 years ago
Hi @soloam, can you confirm if you have any error logs linked to Spotcast other than the traceback. If no, could you add the logger for Spotcast (How to)?
I'll check this and get back to you! Tks
I tested out, and I don't have any error from the "custom_components.spotcast". I go to my config, uncomment the spotcast yaml, save. When I go to home assistant and click "Check Config" it loops and starts sending errors
I get this in the UI:
Logger: aiohttp.server
Source: custom_components/spotcast/spotcast_controller.py:141
Integration: spotcast (documentation, issues)
First occurred: 10:46:32 (1 occurrences)
Last logged: 10:46:32
Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 181, in auth_middleware
return await handler(request)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 137, in handle
result = await result
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/core.py", line 29, in post
errors = await async_check_ha_config_file(request.app["hass"])
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 938, in async_check_ha_config_file
res = await check_config.async_check_ha_config_file(hass)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/check_config.py", line 118, in async_check_ha_config_file
await merge_packages_config(
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 736, in merge_packages_config
component = integration.get_component()
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/loader.py", line 522, in get_component
cache[self.domain] = importlib.import_module(self.pkg_path)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/spotcast/__init__.py", line 43, in <module>
from .spotcast_controller import SpotcastController
File "/home/homeassistant/.homeassistant/custom_components/spotcast/spotcast_controller.py", line 118, in <module>
class SpotifyToken:
File "/home/homeassistant/.homeassistant/custom_components/spotcast/spotcast_controller.py", line 141, in SpotifyToken
def get_spotify_token(self) -> tuple[str, int]:
TypeError: 'type' object is not subscriptable
In the log I see:
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/config/core.py", line 29, in post
errors = await async_check_ha_config_file(request.app["hass"])
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 938, in async_check_ha_config_file
res = await check_config.async_check_ha_config_file(hass)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/check_config.py", line 118, in async_check_ha_config_file
await merge_packages_config(
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/config.py", line 736, in merge_packages_config
component = integration.get_component()
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/loader.py", line 522, in get_component
cache[self.domain] = importlib.import_module(self.pkg_path)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/homeassistant/.homeassistant/custom_components/spotcast/__init__.py", line 43, in <module>
from .spotcast_controller import SpotcastController
File "/home/homeassistant/.homeassistant/custom_components/spotcast/spotcast_controller.py", line 118, in <module>
class SpotifyToken:
File "/home/homeassistant/.homeassistant/custom_components/spotcast/spotcast_controller.py", line 141, in SpotifyToken
def get_spotify_token(self) -> tuple[str, int]:
TypeError: 'type' object is not subscriptable
@soloam .it looks like a problem with the python type hinting, but it shouldn't since you should have Python 3.9 at least for Home Assistant.
I do see that you marked Core
as your install type. Can you confirm you mean this install type?
If this is the case, can you confirm the python version you run by typing and confirm the version you get?
foo@bar:~$ python --version
That can be it, I have 3.8.2. I will update to 3.9 (I need it to the new release).
@soloam .it looks like a problem with the python type hinting, but it shouldn't since you should have Python 3.9 at least for Home Assistant.
I do see that you marked
Core
as your install type. Can you confirm you mean this install type?If this is the case, can you confirm the python version you run by typing and confirm the version you get?
foo@bar:~$ python --version
Problems arised when upgrading to 3.6.24. When downgrading to 23, everything worked perfect as always, even on Pyton 3.8.2. Since a day or 2 all versions don't work anymore.
I think a lot of people are in the same boat as me because they can't upgrade without losing files to Bullseye on a RPi. Because it is to much hassle, I decided to stay on Buster.
Is it possible to set back the files on older releases like it waws, so everyone can still use this great add-on?
That can be it, I have 3.8.2. I will update to 3.9 (I need it to the new release).
Did you found a solutution without upgrading to 3.9? Till not long ago the earlier versions of Spotcast worked perfect, but now I have the same problems as you. Downgrading also doesn't work anymore.
Do you run on Buster by the way?
Possible workaround: run docker on your pi with HA Container installation method.
It was solved when I changed to 3.9! Tks for the help
@quadrophenianl, the problem is that you could end up with a lot more problem in home assistant if your core install is not able to target the correct python interpreter.
Currently, Home Assistant targets the 2 last major releases of Python. Since 3.10.0 as release, that means that currently (since 2022.1) 3.9.X and 3.10 are targeted. Right now, it's just Spotcast, but you could have a lot more interpreter problems down the line.
I know Raspbian isn't always the best to provide fast release of Python, but it is possible to do a manual install and point python
to the latest version. It's not as convivial, but it's the safest option since other components might start to use new functionalities that should be.
There are ways to make the code more backward compatible. I'll try to do a quick fix release for that, but still, I would make sure you have a targeted python version. I do see a lot a comments on the forum stating they have notification that they must update there Python interpreter to 3.9 since the 2022.1 release.
@quadrophenianl, the problem is that you could end up with a lot more problem in home assistant if your core install is not able to target the correct python interpreter.
Currently, Home Assistant targets the 2 last major releases of Python. Since 3.10.0 as release, that means that currently (since 2022.1) 3.9.X and 3.10 are targeted. Right now, it's just Spotcast, but you could have a lot more interpreter problems down the line.
I know Raspbian isn't always the best to provide fast release of Python, but it is possible to do a manual install and point
python
to the latest version. It's not as convivial, but it's the safest option since other components might start to use new functionalities that should be.There are ways to make the code more backward compatible. I'll try to do a quick fix release for that, but still, I would make sure you have a targeted python version. I do see a lot a comments on the forum stating they have notification that they must update there Python interpreter to 3.9 since the 2022.1 release.
Would be great if you can release a quick fix fot the time being, thanks!
Yes, there is a notification for a while already, that's why I decided to stay on the 2021 releases of HASS. The best solution is to upgrade to BULLSEYE, but that's also not that straightforward if you want to do it on an excisting install. That's why it take some before I can (and maybe others) can do that.
Anyway, thanks for your help and off course this nice add-on.
Cheers!
@quadrophenianl, would it be possible for you to edit the spotcast_controller.py and simply add the following line at the top:
from __future__ import annotations
it should resolve the problem, the only hiccup is that I don't have a dev env that can test with Python 3.8, the oldest python interpreter I have on my home assistant test machines is 3.9.
If you could do that, that would validate the possible fix and expedite the pull request to get you working again.
@quadrophenianl, would it be possible for you to edit the spotcast_controller.py and simply add the following line at the top:
from __future__ import annotations
it should resolve the problem, the only hiccup is that I don't have a dev env that can test with Python 3.8, the oldest python interpreter I have on my home assistant test machines is 3.9.
If you could do that, that would validate the possible fix and expedite the pull request to get you working again.
This weekend I found some time to go to 3.9, so I have Spotcast working again. Some other problems showed up, but I think I have Hass stable running for now on Buster. Do you want me to roll back to 3.8 and test if your solution works for others who are not able to upgrade yet?
But anyway thanks for your support, I can imagine it's difficult to approach it on a right way for everyone. Must be frustrating at times...
Do you want me to roll back to 3.8 and test if your solution works for others who are not able to upgrade yet?
No need, I'll take the time to setup a 3.8 dev env at that point.
dev env at that point.
Great!
Thanks again for your time and effort and good luck with this plugin in the future!
Describe the bug When I install the component and add i to the config file, I'm not even able to restart the home assisant, get a lot of errors
Describe the bug
I get errors hat don't even allow me to reboot
Environment (please complete the following information):
Configuration Add your configuration
Additional context