Kef ls50 Wireless

More references of use of pykefcontrol: GitHub - pirminj/ls50w2: A Flutter app to control the LS50 Wireless II (still non functional though)
I am guessing that ls50w2 will require a new integration, separate from the one we currently have in HA, based on pykefcontrol which is a different library from the one currently used, and it doesn’t seem to be backwards compatible with ls50w v1. It doesn’t look like there is a simple upgrade path for the current integration to a new one supporting version 2 of these speakers.

for the time being,

pip3 install pykefcontrol

allows writing scripts that can be called from HA to capture state and issue commands for automations

I am the author of pykefcontrol, and I am happy to announce that Kef LS50WII are integrated in home assistant as a media player through a custom components in HACS. I has been a few days already but I did not actively communicate about it.
You can find the interation as well as the instructions here : GitHub - N0ciple/hass-kef-connector: A Home Assistant integration for the Kef LS50W2

1 Like

Hi @basnijholt,

First of all, I’d like to thank you for your work: it motivated me to install HA to integrate my KEF LSX speakers.
I’m a noob and I didn’t have found your custom component in the HACS store as you can see on my screenshot below.

Did I miss something?

Hope you can help to figure this out.

Thanks in advance!

Best

@N0ciple Thanks a bunch for this. I have been using the LS50W2 integration for a few days now and it’s really solid. These are great great speakers that deserved a great integration and now they have it, thank you

Hi Robin

I was wondering if you could give me some pointers about interaction with the LS50W2. In particular, what communications does the LS50W2 send to update clients about changed status.

I’m not using your Python app (yet!) As I’m already controlling my speaker using NodeRED and openHAB. I’m not a programmer and Python is impenetrable to me.

I’m interested in two specific things that can change at the LS50W2 end without instruction from an app or other source: changing to WiFi source (happens automatically if someone starts streaming), and going on to standby (happens automatically simply after a period of time without music being played).

I’m guessing that there is something sent from the speaker in these circumstances because KEF’s app is updated when either of these two events occur. I’d like to be able to detect these events and make the rest of my system respond appropriately if I can. I guess I could simply poll the speaker regularly to confirm the status, that would have to be very frequently to be of any use. Is there a more elegant and efficient solution? Any pointers you can give me would be very helpful. Thanks

Hello John !

I was wondering as well how does the app knows about the changes. I thought that the speaker would push some kind of information to the app, but that is not the case.

I thoroughly inspected the packets from the app to the speaker and from the speaker to the app, and I found out that actually, the app fetches every second for changes. That is not the best solution but that is the one which is used.

So if you want to get the info as soon as possible, you have to poll the speaker frequently.

Kef implemented a polling queue feature to avoid polling for all the possible parameters that could change. The app sends a get request to create a queue containing some events the app wants to track (for example the volume, the player status, the source, etc…) and subscribe to this queue. Then it polls this queue every second or so. If something changes, the speaker answer with what has changed. This is more efficient than polling indiviually volume, source, etc…

I did not finished reverse engineered this part and I did not implemented it yet in pykefcontrol. Altough, I think I might have some python code which try to mimic this feature if you are interested.

Hi Robin

This is very interesting and helpful. I guess for my purposes a polling of the source will give me what I need but I would be interested in trying to understand a bit more of what you discovered about KEF’s query queue if you can point me to whatever you made of it. I don’t know Python but I hope I can get the gist of it.

Thanks again. Happy Christmas!

There you go : Subscribe to KEF LS50 Wireless II event queue · GitHub
I created a gist from a python notebook I had and added a few comments to help understanding.
The queue ID management is quite strange, that’s why I said that I did not finished reverse engineered the thing. I have not fully understood yet how it works.

I hope this small piece of code can help you !

Happy Holidays !

Maybe someone in this thread knows. I’m using mini media player card to play my music in combination with the KEF Connector for my LS50W2 speakers. All is working wel, except for…

I wanted to add shortcuts to switch radio channels, but HA is telling me “entity xxx does not support this service”. Am I doing something wrong, or is this indeed not supported with the KEF Connector?

Hello @renegrunn,

Indeed, pykefcontrol (the library used by Kef Connector) is not currently supporting this feature but it should be doable! I’ll have a look at it.

At the moment I use pykefcontrol to control playback, volume, etc… But for playing radio I use the DLNA Integration. I guess it is possible to port DLNA feature in pykefcontrol so that we can use only one Integration!

Currently I’m working on faster update time. I’ve updated the library and I have to upgrade Kef Connector as well.

By the way if anybody stumble upon this post, I think pykefcontrol and Kef Connector might be compatible with LSX 2 and LS60, but I need beta testers to make sure. I wrote a testing script that anybody wanting to help can run. Instructions are on the README.md of the repo here.

Thanks for your reply! Great, I’ll keep an eye on this topic, and in the meantime will use DLNA as well :slight_smile:

I have a set of KEF LSX speakers, and i am trying for weeks now to play radio streams to the speaker, with no result.
i get the message Entity media_player.kef does not support this device.

i see in this topic that there are more people with this problem, and also see that it should be possible with the DLNA feature.

But i don’t know how to do this, can somebody explain what i have to do to play radio stations on the KEF LSX speakers?

Thank you Robin for this great integration.

When I am not using my speakers I turn them off (by cutting the power). This result logically in an error:

2023-01-30 09:13:11.894 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.kef_ls50wii fails and result in OSError: [Errno 113] Connect call failed ('192.168.72.8', 80)

But this keeps on going endlessly and fills up my logs. Is there anything I can do about this?

Hello, I am completely new to Home Assistant. I have KEF LSX speakers and I would like to integrate them in Home Assistant. They appear as “DLNA Digital Media Renderer” but I would like to used the KEF integration, I tried many things: added them to configuration.yaml, installed HACS and searched for KEF (but only found KEF connector for LS50W2 and that gives an “Unknown Error” when I try to install). Can someone point me out how I can use the KEF integration and assign the speakers to KEF instead of DLNA renderer? What do I do wrong, or what step(s) I am missing? Thanks in advance!

Or is this caused by #87146 ???

My configuration.yaml entry looks like this (note, I use a static IP allocation via DHCP in my router):

 - platform: kef
   host: 192.168.0.109
   type: LSX
   name: KEF LSX
   maximum_volume: 0.81
   volume_step: 0.03
   inverse_speaker_mode: true
   standby_time: 60

Just for anyone late to the KEF LSX party (and I don’t think it has been mentioned in this thread), the custom DSP settings resetting was finally fixed with the latest firmware some 2 years ago.

I don’t know if KEF ever fixed the potential for crashing the control interface, but at least I have never again experienced it after the update to the aiokef integration.