Kef ls50 Wireless

Just found a way to make it work based on this post here: XBOX ONE and PS4 components do not work with Hassio 0.88

Commented out line 15 import and added other lines as follows:

"""
from homeassistant.components.media_player import (
PLATFORM_SCHEMA, SUPPORT_SELECT_SOURCE, SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET, SUPPORT_TURN_ON, SUPPORT_VOLUME_STEP, SUPPORT_TURN_OFF,
MediaPlayerDevice
)
"""
from homeassistant.components.media_player import (
MediaPlayerDevice, MEDIA_PLAYER_SCHEMA, PLATFORM_SCHEMA)

from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOURCE, SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET, SUPPORT_TURN_ON, SUPPORT_VOLUME_STEP, SUPPORT_TURN_OFF
)

Also, got this as a warning so the rename will affect your setups eventually:

WARNING (MainThread) [homeassistant.loader] Integrations need to be in their own folder. Change media_player/kefwireless.py to kefwireless/media_player.py. This will stop working soon.

I don’t know whether this means pykef.py needs to be moved too, or if other modifications are needed in kefwireless :confused:

@chimpy you have to rename the folder structure as stated in the warning:

WARNING (MainThread) [homeassistant.loader] Integrations need to be in their own folder. Change media_player/kefwireless.py to kefwireless/media_player.py. This will stop working soon.

Since 0.88 the folder structure is changed for custom_components and the location of the constants are moved, therefore some custom_components were broken.

pykef probably needs to be moved to kefwireless folder as well.

Can confirm. Moved the files to kefwireless folder and renamed kefwireless.py to media_player.py
A small modification is also needed on line 28 of pykef (kefwireless must be changed to media_player).

Currently on 0.89 with the new structure with no problems.

Hi guys, I just found this thread and wondering if you can help or point me in the right direction.
I have a pair of these speakers as well, and am trying to program a smart remote to control the speakers. (got it off Kickstarter - it’s this one https://sevenhugs.com). Going fine but having trouble with the input selection as I’m trying to find the IR commands that set a specific Input (ie optical) rather than just repeat what the LS50 speaker remote does (moves you to the next input). Any thoughts would be much appreciated. Thanks!
Richard.

I started out controlling these speakers via IR, but I could not find any commands that sets a specific input, only toggle works. I believe that no such IR command is implemented. Note: I tried this using an older firmware, so they might have implemented it later but I doubt it.

1 Like

Does this remote have wifi? If so, maybe it could work to control these speakers over wifi with this remote.

Hi Gronis. It might work with the newer firmware. I found this Tivo thread which lists IR commands, and that list includes specific commands for each actual input. https://www.tivocommunity.com/community/index.php?threads/remote-code-for-kef-ls50-wireless-speakers.563664/
And on Kef’s support page I found this list of codes.


Problem is the remote doesn’t actually let you type codes manually.
Strangely enough I was able to load a control file for another KEF AV device. Some of the commands work, some don’t. BUT, the PREVIOUS button command actually happens to change the speaker’s input to Optical. So I got one!
This remote is able to control by wifi. But I’ve never set up a remote to work this way, so don’t know how to do it. But worth checking into.

Just FYI, in 0.92, to keep the platform working you need to add an empty __init__.py file to the kefwireless folder.

Hope you’re all well!

Hi everyone, excellent work on this!!!
I loose my connection to the speakers via the app. Apparently the LS50 is not broadcasting the LS50_Wireless network during the setup, so the app cannot finish the config and the speak keeps blinking the white/red wifi light…
Although I can use the system normally (except the Roon client), I’d like to have access to the properties adjustments (Basic and Expert setups, invert channels, disable power on tones, etc).

Is there any chances to discover also these setup codes?

I was studying the error log of the app and discovered some clues of the local IP address of the speakers when connected to de local LS50_Wireless wifi (192.168.1.12).

Also, opening the IP address from a ethernet conection, I could access an index page that alows me to change the wifi login config and connect to my wireless network. But the app keeps without connection as per the intial setup did not run.

Hope a new firmware can solve this… But I’d like to start working on a plan B…

Best Regards,

Adriano

all, nice work to get the KEF speakers integrated into HA. Got it to work in Hass.io last week for my KEF-LS50W but wondering about one thing:

It is repeatedly mentioned that Turn-On can’t be done through the integration as the speakers turn wireless off when powered off. In my case the speakers are connected hardwired to the LAN and the Android (and iOS) KEF Control app are both able to turn the speakers off and on again. I assume there must be some TCP/IP communication to achieve this.

I have tried to capture IP traffic but my network setup right now doesn’t allow me to do it (would need a passive hub to capture traffic w/ Wireshark or the like).

Has anyone with the same setup (hardwired connection to the KEF) tried to do this to figure out what the command codes might be ?

This would be a great last-mile achievement for this plugin at least for those having the speaker connected this way.

Thanks, Michael

Hi! Are you using KEF LSX or LS50W?

Sorry, should have been more precise. KEF-LS50W it is. Cheers M.

1 Like

Ok, how did you manage to turn it on with the KEF Control app? Did you upgrade your speakers firmware recently? I cannot turn on the speakers even if I have an ethernet cable hooked up to my KEF LS50W when using the app.

Hi Robin,

I am not doing anything special. Just using the control app and select the leftmost button at the top. Below is a link to a short screen recording. You don’t see the click so you have to trust me that I click that wireless symbol button repeatedly :smiley:.
I also used the remote in between uses of the app - still works if I switch off via the remote, then switch on via the app.
I am not so sure if the speaker at some point in time enters a ‘deeper sleep’ and if in that the above wouldn’t work anymore. I have seen the app to be unable to connect and the speaker marked as [offline] - haven’t checked exactly when that happens. As the app is a little buggy in general I thought that’s just a problem of the app.
But no matter what, at least as long as it is in what it calls [standby] the speaker can be turned on through the app.

Firmware on the KEF-LS50W is: p6.2101809171.105039 which I think is the latest, at least I do not get offered something newer. App is running on an Android phone.

Standby mode is set to 60 minutes. That turns the speaker into standby mode after this time - and I am able to bring it back online after that time with the app.

Update: playing around a little more I have seen now a few casse where another Android device (a Galaxy tablet) is not able to connect to the switched-off speaker while the other one still is. The drop-down in the app lists the speaker as [offline]. Switched the speaker on via the remote, then had to kill and start the app again to make it recognise the speaker. I still believe this has to do with the buggy nature of the KEF apps (both). Frequently I see Spotify being perfectly happy with the speakers and controlling them fine whereas the KEF apps refuse to connect to them (isn’t this a shame? such a fine pair of speakers and the app not keeping up at all with them).

Thx, Michael

Screen recording

I have now been watching the behavior for a little longer and it seems to be that in the majority of the cases I am able to turn on the speakers via the Android or iOS app. So I must believe there is a command sequence that can be sent via the network. This for at least when the speakers are hardwired. I have not checked the behavior when just WLAN connected.

Is anyone having an idea how to best capture the commands sent on the network from either the Android or iOS devices ? I would invest some time and energy to find the codes.

I’m still unable to replicate turning on via the app, even though I’m connected through Ethernet. Maybe KEF updated the onboard electronics in newer speakers to support this, and you have one of these newer revisions?

If you want to capture network traffic, use wireshark and listen to tcp traffic. We have mentioned previously in this thread I think. You also have to expose the network traffic from the phone to the computer, but this is specific for each operating system. I use a Mac and an iPhone. I’m not sure how to do it on other systems.

Here we go. Finally found time to take a network capture (thx to the good ol’ Fritz!Box router w/ built-in capturing).

The sequence to turn on the speaker is: 0x53, 0x30, 0x81, 0x12, 0x0b

    def turnOn(self):

        msg = bytes([0x53, 0x30, 0x81, 0x12, 0x0b])
        self.__sendCommand(msg)

hex 0x12 as the 4th byte (instead of 0x9b for off). I am not sure about the 5th byte as my capture was only capturing 4 bytes and never 5, no idea why. So used the same 5th byte as for turn off and it seems to work.

For completeness, firmware on the speakers: p6.2101809171.105039. They are connected via LAN. I will also check if this is working when connected via WLAN - maybe not.

Maybe someone with the same setup may want to try this. I only changed the sources locally on my installation)

Hi, I tried the command and it does not work for me. I realized that I wasn’t using the latest version, so I updated the speakers to oct 2018. This new version displays as p6.2001806071.105039 which is different from yours, Also the speaker disconnect from the network when turned off, just as before, even when using LAN. I’m not sure why this works for you and not me. Also not sure how your version seems to be later than mine, when I have installed the latest firmware I can find.

I cannot replicate the behaviour either @mleiber - my iOS app doesn’t even respond the same way. Immediately upon selecting Wireless, then tapping Wireless to turn off the speaker I am presented with a dialog box warning me that the speaker will be turned off and must be turned on again manually. Once I click OK, the speaker turns off and the app disconnects: no commands/inputs are available.

LS50W, fw: 27-Jun-18