Closed mark007 closed 1 year ago
Hey there @basnijholt, mind taking a look at this issue as it has been labeled with an integration (kef
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
kef documentation kef source (message by IssueLinks)
After rolling back to 2023.1.7 it's back working. Hopefully a fix can be found.
Hello
I just want to inform that this issue is not isolated to one user. I am experiencing the exact same problem.
Using the integration on LSX speakers result in same error. I've seen some deprecation of 'async setup' in other integrations, but this error doesnt show here on KEF code. The step the kef log comes from is when it tries to get the MAC adress of the speakers, not sure why its failing now, as ip comes from config. So maybe config reading is broken. and indeed the core .1.7 does not give the error and the integration works. Should be fixable enough to me. Let me know if there is anything to test or provide.
Exact same issue here. Thanks in advance for looking at it, I'm so grateful to this community of developers!!
Having the same issue with Kef LS50 W speakers
Same problem here with my LSX speakers, rolled back to 2023.1.7 to maintain control of speakers
Same issue for me. Kef LSX remains unavailable after 2023.2.0 update.
Unfortunately, I do not own the KEF speakers anymore so I cannot test this.
I assume this is a change that is unrelated to the direct KEF code.
Does anyone know more details about changes in HA core that might cause this problem?
Everything seems to be listed here. https://www.home-assistant.io/changelogs/core-2023.2
If it's a matter of putting my HA instance in debug level for the logs and providing you what I see I can do that.
If you walk me through how to best catch all the logs at once, I'll be OK to help you ;)
I believe it is because of the switch to Python 3.10 (https://github.com/home-assistant/core/pull/85456).
Perhaps this code works differently in Python 3.10:
Could anyone try to change that to:
def get_ip_mode(host):
return "ip"
I just verified that the behavior of ipaddress.ip_address
is unchanged in Python 3.10, however, there are some changes to the code (https://github.com/python/cpython/commits/main/Lib/ipaddress.py).
And also Home Assistant seems to have already been using Python 3.10 before the deprecation, so this is probably not the issue.
I'm also on standby to troubleshoot if needed
I just verified that the behavior of
ipaddress.ip_address
is unchanged in Python 3.10, however, there are some changes to the code (https://github.com/python/cpython/commits/main/Lib/ipaddress.py).And also Home Assistant seems to have already been using Python 3.10 before the deprecation, so this is probably not the issue.
agree.. the january version of core already ran on 3.10 here, so still suspect a 'config construct' change somewhere which fails to pickup the ip address.. I'll try to run a few PY tests outside HA today, not a developer myself, but ruling out a few things is bit in my capacity.
from debug i only get one line extra in the logs btw:
2023-02-07 09:20:56.906 DEBUG (MainThread) [homeassistant.components.kef.media_player] Setting up kef with host: 192.168.1.xxx, port: 50001, name: kef native, sources: ['Wifi', 'Bluetooth', 'Aux', 'Opt'] so it has the IP adress value anyway.
Has anyone tried the code change locally to
def get_ip_mode(host):
return "ip"
I wanted to ask before I update HA and try it. If it already is known to not work, I won't bother trying.
i didnt as i dont know where to get to the files for normal HA included integrations. I know to edit custom components files. If you point me where the file is in an HASSOS installation , i'll be ok to make the edit. If you have a 'outside HA python script' that i can run in a PY environment, that i can do too.
I created a kef custom_integration directory, copied the 4 kef integration files into it, added a version key to the manifest.json (otherwise the custom integration won't load). Changing the get_ip_mode function didn't help. It seems to be the getmac library having issues. There are other issues written like this one. https://github.com/home-assistant/core/issues/87623
Hopefully a fix for getmac can be added to the next HA version. For now I replaced the following line
with my speakers mac, in lowercase, like
mac = '84:17:15:00:xx:xx'
and rebooted HA and its back online. Using uppercase resulted in a second media_player entity being created so using lowercase solved that. At least its a temporary workaround.
I used some code suggestions from the https://github.com/home-assistant/core/issues/87623 issue and it worked. Hoping someone can review the changes, or let me know what the normal expectation is with this integration in terms of tests / code styles etc. It works for me anyways. Here's the pull request. https://github.com/home-assistant/core/pull/87712
Dont get it on this context as in previous 2023.1.x version, this is no issue. Did I miss a python bump in .02.x release?
The only thing I can think of is if HA changed something on the networking side of things that causes the default getmac mode to no longer work? Anyone know? Because the manifest for the kef integration has the same, fixed version of the getmac library for some time.
I created a kef custom_integration directory, copied the 4 kef integration files into it, added a version key to the manifest.json (otherwise the custom integration won't load). Changing the get_ip_mode function didn't help. It seems to be the getmac library having issues. There are other issues written like this one. #87623
Hopefully a fix for getmac can be added to the next HA version. For now I replaced the following line
with my speakers mac, in lowercase, like
mac = '84:17:15:00:xx:xx'
and rebooted HA and its back online. Using uppercase resulted in a second media_player entity being created so using lowercase solved that. At least its a temporary workaround.
did so too, wil remember this trick. happy to have the speakers back. Now i hope the fix proposed will do the same.
Does anyone know what the homeassistant 'DEFAULT_VERSION' does. It changed from 3.9 to 3.10 when comparing 2023.1.7 to 2023.2.0 in the builder.yml file
https://github.com/home-assistant/core/compare/2023.1.7...2023.2.0
Could that have broken getmac as its changelog recently refers to 'tentative' support for python 3.10 https://github.com/GhostofGoes/getmac/blob/56412aab460e73304b59c3dc8fb5520ce39f7ef7/CHANGELOG.md?
As requested by the getmac developer I have created an issue here as he thinks he might know the cause and a quick fix.
Cool, then it should be sorted there Indeed
@ManneW this and a few other HA issues seem to be caused by the fact that there are two getmac libraries (an old get-mac one and a new getmac one). Both can't be installed at the same time because internally they both have a 'getmac' python package inside. A ticket is open with the getmac developer to see if theres an elegant way out of this problem but the only integration I see in the core / homeassistant container is the vilfo integration via its manifest here. The version of the vilfo python package it references, uses the old get-mac package, but I see the latest vilfo python package now points to the new getmac package.
https://github.com/home-assistant/core/blob/dev/homeassistant/components/vilfo/manifest.json
https://github.com/ManneW/vilfo-api-client-python/commit/d659c10338c37bbde5a9e1ae0c7a9978a4c7ae9b
Is it possible to uplift the version of the vilfo python client in the homeassistant core? That to me would at least mean all core integrations that I can see within the HA container (checking with the pipdeptree command, are using getmac and not get-mac anymore.
some other question in this integration , but helpful in current state: is it possible to add the 'reload' this integration. When issues arise i have to completely restart HA, a reload of a specific integration like this would be very helpful.
Is there any alternative temporary fix while being on the latest 2023.3.1 version or is the only option to downgrade to version 2023.1.7?
Yes you can create a copy of the integration following the steps here if you wish which works around it for me and others while we wait for the fix to be reviewed and merged.
https://github.com/home-assistant/core/issues/87146#issuecomment-1422710364
Any news on an official fix ☺️ ? It's starting to be a bit long
Any news on an official fix ☺️ ? It's starting to be a bit long
One CI job was failing so with a small change today I hope that passes. We are waiting for a review / verification from another dev, as another integration required an update so as not to conflict with the kef integration. We are also awaiting that review / verification so it's unclear when they will be able to perform that test on their side. Hopefully soon.
In fact, I saw! I discovered your work here #87712 Amazing !! Thx for the status
nice.. progress :)
still stuck in review? although i still have local fix, i would prefer this integration to be active again :)
I created a kef custom_integration directory, copied the 4 kef integration files into it, added a version key to the manifest.json (otherwise the custom integration won't load). Changing the get_ip_mode function didn't help. It seems to be the getmac library having issues. There are other issues written like this one. #87623 Hopefully a fix for getmac can be added to the next HA version. For now I replaced the following line https://github.com/home-assistant/core/blob/94519de8dd9fcac684b510904a38c2269c27a042/homeassistant/components/kef/media_player.py#L120
with my speakers mac, in lowercase, like
mac = '84:17:15:00:xx:xx'
and rebooted HA and its back online. Using uppercase resulted in a second media_player entity being created so using lowercase solved that. At least its a temporary workaround.did so too, wil remember this trick. happy to have the speakers back. Now i hope the fix proposed will do the same.
Sorry, may i know more details that how to apply this workaround? thanks
That's basically it. In layman's terms
manifest.json
file to add a version number like "version": "0.0.1"
media_player.py
line 120The fix functions flawlessly. I hope its inclusion in the official release soon.
That's basically it. In layman's terms
- download the content of the kef integration (4 files)
- copy them in the directory custom_components (the same where HACS integrations are installed)
- edit the
manifest.json
file to add a version number like"version": "0.0.1"
- Hardcode the Mac address of your kef in
media_player.py
line 120- restart and enjoy
I think I'm being an idiot.. I've downloaded the files from here. Uploaded directly with custom_components, edited manifest.json to include the version number and replaced line 120 with my mac address, restarted, but the LSX's are still unavailable?!
you'll need subbfolder for the files, not in custom_components direcly. mine:
you'll need subbfolder for the files, not in custom_components direcly. mine:
Amazing! Thank you!
If have issues with downloading from GIT. You could use the below steps
you'll need subbfolder for the files, not in custom_components direcly. mine:
Hi, I'm new to Home Assistant and I'm trying to add my KEF LS50W to HA.
I've tried the fix as @checkiecheck suggested here, but after that I can't get my speaker to show up in devices. I've edited the configuration.yaml as follow, but when I restarted HA nothing happened, no notification.
media_player:
- platform: kef
host: 192.168.x.xxx
type: LS50
name: KEF LS50W
maximum_volume: 0.6
volume_step: 0.05
if you did literaly, then it need to be
i specifically did that to see the original component start working again when fixed in some release.
The problem
Since the 2023.2.0 update, the kef integration no longer can access my kef speaker, no matter how many times I reboot each. The speaker itself is pingable and connectable from the kef app, just not HA since the upgrade.
What version of Home Assistant Core has the issue?
2023.2.0
What was the last working version of Home Assistant Core?
2023.1.7
What type of installation are you running?
Home Assistant OS
Integration causing the issue
kef
Link to integration documentation on our website
https://www.home-assistant.io/integrations/kef/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response