From 24a8e661a9746128f3f2f6250c6e30d392e81342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Hilligs=C3=B8e?= Date: Thu, 20 Apr 2023 08:27:21 +0000 Subject: [PATCH] More research done, notes added, vscode extension suggestion --- .vscode/extensions.json | 3 + NOTES.md | 15 ++++ README.md | 32 +++++++ research/commands.http | 185 ++++++++++++++++++++++++++++++++++++++-- 4 files changed, 230 insertions(+), 5 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 NOTES.md diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..1f11831 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["humao.rest-client"] +} \ No newline at end of file diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..6f44bb1 --- /dev/null +++ b/NOTES.md @@ -0,0 +1,15 @@ +# Notes taken during the course of the project + +## Getting the protocol with Wireshark and tcpdump + +### tcpdump + +Using the KEF Connect app on a Mac with Apple Silicon, I was able to capture the traffic between the app and the speaker. I used the following command to capture the traffic: + +```bash +sudo tcpdump -s 0 -B8096 -w KEF.pcap -vvv host 10.0.0.93 +``` + +### Wireshark + +Opening the KEF.pcap file in Wireshark, filtering on `http` (Just typing http in the filter box) and then selecting the first packet, right click on it and select `Follow -> HTTP Stream` gives you a window with all HTTP requests and responses. This is a good way to get an overview of the protocol. diff --git a/README.md b/README.md index ce86043..c9b62f3 100644 --- a/README.md +++ b/README.md @@ -33,3 +33,35 @@ func main() { ## License MIT License + + +## Command line tool + +### TODO + +- [ ] Backup/restore settings to file +- [ ] Set volume +- [ ] Mute/unmute +- [ ] Select source +- [ ] Get status +- [ ] Get settings +- [ ] Set settings +- [ ] Turn on/off + +### Usage + +```bash +``` + +## Web interface & HomeKit HUB + +### TODO + +- [ ] Turn on/off +- [ ] Set volume +- [ ] Mute/unmute +- [ ] Select source +- [ ] Status page, refreshing (web) +- [ ] Settings page, editing (web) +- [ ] Backup/restore settings to file download (web) +- [ ] ?? Streaming page, playing (web) diff --git a/research/commands.http b/research/commands.http index d94392b..b49099b 100644 --- a/research/commands.http +++ b/research/commands.http @@ -23,7 +23,6 @@ Content-Type: application/json {"path": "settings:/deviceName", "roles": "value"} - ### Get Device Status # Possible Statuses are: # standby or powerOn @@ -68,7 +67,6 @@ Content-Type: application/json "roles": "value" } - ### Set Volume POST {{baseurl}}/api/setData Accept: application/json @@ -83,9 +81,21 @@ Content-Type: application/json } } +### Mute Volume +# Aka set volume to 0 +# 'true' is returned if successful (+200 OK) +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json - - +{ + "path": "player:volume", + "roles": "value", + "value": { + "type": "i32_", + "i32_": 0 + } +} ### Song Progress POST {{baseurl}}/api/getData @@ -105,4 +115,169 @@ Content-Type: application/json { "path": "player:player/data", "roles": "value" -} \ No newline at end of file +} + +### Set Device Name +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:\/deviceName", + "roles": "value", + "value": { + "type": "string_", + "string_": "KEFs" + } +} + +### Get Device Profile +POST {{baseurl}}/api/getData +Accept: application/json +Content-Type: application/json + +{ + "path": "kef:eqProfile/v2", + "roles": "value" +} + +### Get messages from the queue +POST {{baseurl}}/api/getRows +Accept: application/json +Content-Type: application/json + +{ + "from": 0, + "to": 0, + "path": "notifications:/display/queue", + "roles": "@all" +} + +### Is front standby LED disabled? +POST {{baseurl}}/api/getData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:/kef/host/disableFrontStandbyLED", + "roles": "value" +} + +### GoogleCast Usage Report (Google Cast state) +GET {{baseurl}}/api/getData?path=googlecast%3AusageReport&roles=value +Accept: application/json +Content-Type: application/json + +### Bluetooth Usage Report (Bluetooth state) +GET {{baseurl}}/api/getData?path=bluetooth%3Astate&roles=value +Accept: application/json +Content-Type: application/json + +### Get playlists (Returns the number 1000?) +GET {{baseurl}}/api/getData?path=settings%3A%2Fplaylists%2FdbItemsLimit&roles=value +Accept: application/json +Content-Type: application/json + +### Get current DSP settings +GET {{baseurl}}/api/getRows?path=kef%3Adsp%2FeditValue&roles=%40all&from=0&to=99 +Accept: application/json +Content-Type: application/json + +### Set app analytics +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:\/kef\/host\/disableAppAnalytics", + "role": "value", + "value": { + "type": "bool_", + "bool_": false + } +} + +### Get standby time +GET {{baseurl}}/api/getData?roles=value&path=settings%3A%2Fkef%2Fhost%2FstandbyMode +Accept: application/json +Content-Type: application/json + +### Set standby time +# Possible values are: +# standby_20mins, standby_30mins, standby_60mins, standby_none +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:\/kef\/host\/standbyMode", + "role": "value", + "value": { + "type": "kefStandbyMode", + "kefStandbyMode": "standby_30mins" + } +} + +### Get secondary wakeup source +# Possible values are: +# wakeup_default, tv, optical, coaxial, analog, bluetooth +GET {{baseurl}}/api/getData?roles=value&path=settings%3A%2Fkef%2Fhost%2FwakeUpSource +Accept: application/json +Content-Type: application/json + +### Set secondary wakeup source +# Possible values are: +# wakeup_default (or none), tv, optical, coaxial, analog, bluetooth +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:\/kef\/host\/wakeUpSource", + "role": "value", + "value": { + "type": "kefWakeUpSource", + "kefWakeUpSource": "wakeup_default" + } +} + +### Get statup tone for sources +GET {{baseurl}}/api/getData?roles=value&path=settings%3A%2Fkef%2Fhost%2FstartupTone +Accept: application/json +Content-Type: application/json + +### Set statup tone for sources +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:\/kef\/host\/startupTone", + "role": "value", + "value": { + "type": "bool_", + "bool_": false + } +} + +### Get cabled (vs wireless) mode +GET {{baseurl}}/api/getData?roles=value&path=settings%3A%2Fkef%2Fhost%2FcableMode +Accept: application/json +Content-Type: application/json + +### Set cabled mode on or off +# Possible values are: +# wired, wireless +POST {{baseurl}}/api/setData +Accept: application/json +Content-Type: application/json + +{ + "path": "settings:\/kef\/host\/cableMode", + "role": "value", + "value": { + "type": "kefCableMode", + "kefCableMode":"wired" + } +} +