LS50 Wireless II & Home Automation

anyone into home automation ? I sniffed my network and found out how to address the speakers. Now I can control quite a bit with node red, but could be used elsewhere.

I will off course share if there is any interest. Best would be if someone would take my work and make it a formal github repo.!

3 Likes

Would love to see the API.

Hello @DigitalFrog,

You may want to check out GitHub - rodupont/pykefcontrol: Python library for controling the KEF LS50 Wireless II

-John

3 Likes

Hey @john,

thanks for sharing this repo. Do you know if the API is documented somewhere? I’d like to rewrite it in Dart to build a Flutter app

Edit: For fellow dart developers: GitHub - pirminj/ls50w2_client: A client for the KEF LS50 Wireless 2 written in Dart

1 Like

Thanks a lot for this! It shouldn’t be to hard now to string a few http requests together to build a Shortcut for getting and setting volume, muting and unmuting the speaker or setting the source. This is all I want to make out of this, for example:

http://192.168.50.40/api/getData?path=settings:/kef/host/speakerStatus&roles=value
gives me this response:
[{“type”:“kefSpeakerStatus”,“kefSpeakerStatus”:“powerOn”}]

from there I could parse this answer and toggle powerOn and powerOff with a new request.

I just want one or two Shortcuts to tell Siri via my HomePod mini to get/set the volume, change source, for example “Hey Siri set KEF to Aux” or “Hey Siri mute KEF” and “Hey Siri set KEF to loud” or quiet or whatever then translates to a preset volume between 0 and 100.

This Shortcuts could also be of help for my wife just to set the basics for her needs without delving deep into the KEF App. Will this work without Python?

Thanks again and sorry for off-topic! Maybe we should create a new thread for this new topic.

I split the relevant posts off to a new topic, guys. Keep it coming. :slight_smile:

do you have node red ? I control mine with it (see first post)
I can send you my nodes and you can extract the html code

Hi @DigitalFrog, I’m also interested in your node red setup

Ralph, sure, thanks for this offer, I may install RED if needed, if I compose something useful out of this I’m glad to offer it here too.

@RBM thanks for the service René!

Looks like there is also Home Assistant integration for the Kefs.

Given they also have room integration (which I maintain) that probably gives you a lot of interesting integration / automation possibilities.

1 Like

Here is what I have done so far with NodeRed.

Basically I sniffed the network and saw how the Kef client was sending messages to the speakers and replicated what I could in node red. The commands can be sent from a web browser too so It can be adapted to anything.

I hope I’m not breaking any copyright or anything, I’ll pull it away if there is any complains.

It can be improved for sure, and would love to see this growing.

[{"id":"ac6f2947.90c7c8","type":"tab","label":"KEF","disabled":false,"info":""},{"id":"ed802f56.41cfa","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 OPTICAL","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"optical\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":180,"y":180,"wires":[["519a06c1.b4b7b8"]]},{"id":"519a06c1.b4b7b8","type":"http request","z":"ac6f2947.90c7c8","name":"kef","method":"POST","ret":"obj","paytoqs":"ignore","url":"192.168.1.227/api/setData","tls":"","persist":false,"proxy":"","authType":"","x":470,"y":320,"wires":[["25684655.89d16a"]]},{"id":"5ea5dbc6.20b2b4","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 AUX","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"analog\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":160,"y":140,"wires":[["519a06c1.b4b7b8"]]},{"id":"25684655.89d16a","type":"debug","z":"ac6f2947.90c7c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":320,"wires":[]},{"id":"a32f07b2.222088","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 COAXIAL","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"coaxial\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":180,"y":220,"wires":[["519a06c1.b4b7b8"]]},{"id":"c5d5a287.5f6b3","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 TV/HDMI","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"tv\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":180,"y":260,"wires":[["519a06c1.b4b7b8"]]},{"id":"fb61fb3b.3b7888","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 BTOOTH","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"bluetooth\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":180,"y":300,"wires":[["519a06c1.b4b7b8"]]},{"id":"a1fa2a51.0847b8","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 WIFI","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"wifi\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":170,"y":100,"wires":[["519a06c1.b4b7b8"]]},{"id":"9fcdb489.e1dfc8","type":"inject","z":"ac6f2947.90c7c8","name":"BassExtention Less","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/bassExtension\",\"roles\":\"value\",\"value\":{\"kefBassExtension\":\"less\",\"type\":\"kefBassExtension\"}}","payloadType":"json","x":150,"y":380,"wires":[["519a06c1.b4b7b8"]]},{"id":"789719fc.d65648","type":"inject","z":"ac6f2947.90c7c8","name":"BassExtention Standard","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/bassExtension\",\"roles\":\"value\",\"value\":{\"kefBassExtension\":\"standard\",\"type\":\"kefBassExtension\"}}","payloadType":"json","x":160,"y":420,"wires":[["519a06c1.b4b7b8"]]},{"id":"c42a4226.d5d87","type":"inject","z":"ac6f2947.90c7c8","name":"BassExtention Extra","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/bassExtension\",\"roles\":\"value\",\"value\":{\"kefBassExtension\":\"extra\",\"type\":\"kefBassExtension\"}}","payloadType":"json","x":150,"y":460,"wires":[["519a06c1.b4b7b8"]]},{"id":"b2bb1f9f.1c616","type":"inject","z":"ac6f2947.90c7c8","name":"DeskModeOn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/deskMode\",\"roles\":\"value\",\"value\":{\"bool_\":true,\"type\":\"bool_\"}}","payloadType":"json","x":130,"y":520,"wires":[["519a06c1.b4b7b8"]]},{"id":"26339462.00f7ec","type":"inject","z":"ac6f2947.90c7c8","name":"DeskModeOff","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/deskMode\",\"roles\":\"value\",\"value\":{\"bool_\":false,\"type\":\"bool_\"}}","payloadType":"json","x":130,"y":560,"wires":[["519a06c1.b4b7b8"]]},{"id":"75c02954.59ec08","type":"inject","z":"ac6f2947.90c7c8","name":"WallModeOn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/wallMode\",\"roles\":\"value\",\"value\":{\"bool_\":true,\"type\":\"bool_\"}}","payloadType":"json","x":130,"y":600,"wires":[["519a06c1.b4b7b8"]]},{"id":"feafec8b.b53e1","type":"inject","z":"ac6f2947.90c7c8","name":"WallModeOff","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/wallMode\",\"roles\":\"value\",\"value\":{\"bool_\":false,\"type\":\"bool_\"}}","payloadType":"json","x":130,"y":640,"wires":[["519a06c1.b4b7b8"]]},{"id":"ecee2a6c.8368a8","type":"inject","z":"ac6f2947.90c7c8","name":"phaseCorrectionOn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/phaseCorrection\",\"roles\":\"value\",\"value\":{\"bool_\":true,\"type\":\"bool_\"}}","payloadType":"json","x":150,"y":700,"wires":[["519a06c1.b4b7b8"]]},{"id":"d2ca5f62.30f89","type":"inject","z":"ac6f2947.90c7c8","name":"phaseCorrectionOn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/phaseCorrection\",\"roles\":\"value\",\"value\":{\"bool_\":false,\"type\":\"bool_\"}}","payloadType":"json","x":150,"y":740,"wires":[["519a06c1.b4b7b8"]]},{"id":"5f79fa32.f02534","type":"inject","z":"ac6f2947.90c7c8","name":"highPassModeOn","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/highPassMode\",\"roles\":\"value\",\"value\":{\"bool_\":true,\"type\":\"bool_\"}}","payloadType":"json","x":150,"y":780,"wires":[["519a06c1.b4b7b8"]]},{"id":"273a6643.87d9ba","type":"inject","z":"ac6f2947.90c7c8","name":"highPassModeOff","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/highPassMode\",\"roles\":\"value\",\"value\":{\"bool_\":false,\"type\":\"bool_\"}}","payloadType":"json","x":150,"y":820,"wires":[["519a06c1.b4b7b8"]]},{"id":"8609defe.fceb5","type":"comment","z":"ac6f2947.90c7c8","name":"Placeholder","info":"{\"subscribe\":[{\"path\":\"playlists:pq/getitems\",\"type\":\"rows\"},{\"path\":\"notifications:/display/queue\",\"type\":\"rows\"},{\"path\":\"settings:/mediaPlayer/playMode\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/wallMode\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/host/volumeLimit\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/highPassMode\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/host/speakerStatus\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/deskMode\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/host/volumeStep\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/balance\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/host/maximumVolume\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/bassExtension\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/highPassModeFreq\",\"type\":\"itemWithValue\"},{\"path\":\"kef:fwupgrade/info\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/subwooferGain\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/mediaPlayer/mute\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/wallModeSetting\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/subwooferPolarity\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/deskModeSetting\",\"type\":\"itemWithValue\"},{\"path\":\"player:volume\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/trebleAmount\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/phaseCorrection\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/play/physicalSource\",\"type\":\"itemWithValue\"},{\"path\":\"player:player/data/playTime\",\"type\":\"itemWithValue\"},{\"path\":\"settings:/kef/dsp/subOutLPFreq\",\"type\":\"itemWithValue\"},{\"path\":\"player:player/data\",\"type\":\"item\"}],\"unsubscribe\":[]}","x":700,"y":460,"wires":[]},{"id":"946cf5f.8fb7308","type":"inject","z":"ac6f2947.90c7c8","name":"SubwooferPolarityNormal","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/subwooferPolarity\",\"roles\":\"value\",\"value\":{\"kefSubwooferPolarity\":\"normal\",\"type\":\"kefSubwooferPolarity\"}}","payloadType":"json","x":170,"y":860,"wires":[["519a06c1.b4b7b8"]]},{"id":"aafefc22.65bd8","type":"inject","z":"ac6f2947.90c7c8","name":"SubwooferPolarityInverted","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/dsp/subwooferPolarity\",\"roles\":\"value\",\"value\":{\"kefSubwooferPolarity\":\"inverted\",\"type\":\"kefSubwooferPolarity\"}}","payloadType":"json","x":170,"y":900,"wires":[["519a06c1.b4b7b8"]]},{"id":"17843604.24093a","type":"comment","z":"ac6f2947.90c7c8","name":"Hipassmode with value","info":"{\"path\":\"settings:/kef/dsp/highPassModeFreq\",\"roles\":\"value\",\"value\":{\"i16_\":5,\"type\":\"i16_\"}}","x":720,"y":500,"wires":[]},{"id":"7ce1b878.661b38","type":"comment","z":"ac6f2947.90c7c8","name":"suboutfreqvalue","info":"{\"path\":\"settings:/kef/dsp/subOutLPFreq\",\"roles\":\"value\",\"value\":{\"i16_\":10,\"type\":\"i16_\"}}","x":700,"y":540,"wires":[]},{"id":"5d25cb8a.343004","type":"inject","z":"ac6f2947.90c7c8","name":"Kef LS50W2 STANDBY","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"path\":\"settings:/kef/play/physicalSource\",\"roles\":\"value\",\"value\":{\"kefPhysicalSource\":\"standby\",\"type\":\"kefPhysicalSource\"}}","payloadType":"json","x":180,"y":60,"wires":[["519a06c1.b4b7b8"]]},{"id":"1d4d7734.845689","type":"comment","z":"ac6f2947.90c7c8","name":"replace kef with name of your speaker in all json strings","info":"{\"path\":\"settings:/**kef**","x":780,"y":220,"wires":[]},{"id":"f3e89ba9.0bfef8","type":"castv2-sender","z":"ac6f2947.90c7c8","name":"Kef_Chromecast","connection":"922d6530.f17e48","x":890,"y":80,"wires":[[]]},{"id":"da233391.bcf55","type":"inject","z":"ac6f2947.90c7c8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"MUTE\"}","payloadType":"json","x":620,"y":40,"wires":[["f3e89ba9.0bfef8"]]},{"id":"a07c2532.1198d8","type":"inject","z":"ac6f2947.90c7c8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"UNMUTE\"}","payloadType":"json","x":630,"y":80,"wires":[["f3e89ba9.0bfef8"]]},{"id":"6f59fdfc.babd74","type":"inject","z":"ac6f2947.90c7c8","name":"vol 10%","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"type\":\"VOLUME\", \"volume\": 10}","payloadType":"json","x":590,"y":140,"wires":[["f3e89ba9.0bfef8"]]},{"id":"922d6530.f17e48","type":"castv2-
connection","name":"Kef_Chromecast","target":"","host":"192.168.1.227","port":"8009"}]
4 Likes

Thanks for sharing that Ralph!

If anyone is interested, I made a little app to control our speaker and get more information than the official app: GitHub - pirminj/ls50w2: A Flutter app to control the LS50 Wireless II

3 Likes

Hey

Would it be possible to use the above to change the EQ settings based on source? For example I use one EQ profile for TV and one for music, if I could set it up somehow to auto change the profile based on the source that would be fantastic.

Thanks

Absolutely doable, great idea! I’ll do it on the weekend if I find the time.

Hello everyone,

I am the creator of pykefcontrol. I am really sorry I did not take the time to write a proper documentation for pykefcontrol. I have made a few change to simplify the installation process (through pip) and write documentation for this library.
I also transfered the library to my other github account. The new address is : GitHub - N0ciple/pykefcontrol: Python library for controling the KEF LS50 Wireless II
Dont hesitate to contact me if you have questions or suggestions about pykefcontrol :wink:

3 Likes

Thats great, thanks!

Hello!

A quick update on the app for those who care:
I updated the UI for desktop and added EQ profile support, including automatic profile switching when select an input source. You can try the (non-functional) app here ls50w2 (Because it runs in the browser it can’t communicate with the speakers)

The repo is here GitHub - pirminj/ls50w2: A Flutter app to control the LS50 Wireless II

@ mods: If this is too much off-topic please move it to another topic :slight_smile:

Great – thanks! I finally got around to toying with pykefcontrol. One the few pet peeves I have with the LS50WII is that they don’t autoswitch to the TV source when the TV is turned on while music is playing.

I now made a small script with pykefcontrol that switches the LS50WII to the TV source – and an iOS Shortcut that:

  • Calls the script (on a Linux box over SSH)
  • Sets the volume
  • Wakes up the Apple TV (which in turn wakes the TV)
  • Opens the iPhone Apple TV controller with the correct ATV selected

All with one button on my iPhone’s homescreen. Niceness!

Hello everyone,
I am happy to announce that the Kef LS50W2 are integrated in Home Assistant as a media player.
Available features are : on/off, control volume, play/pause, previous/next, current track metadata (as well as cover) and source selection.
The integration is available through HACS. More info on the github repo : GitHub - N0ciple/hass-kef-connector: A Home Assistant integration for the Kef LS50W2

I’m happy to help if you have troubles setting this up !

2 Likes

Hi, Many thanks for this. I’ve got it integrated at home with Node-RED.

One question: do you know how to detect changes that happen on the LS50W2 without a specific command being sent to the speaker? I’m interested in two 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 after a period without signal).

I’m guessing that there is something sent out of the speaker in these circumstances because KEF’s app is updated when these things happen. I’d like to be able to detect these changes and make the rest of my system respond appropriately if I can. Thanks