├── LICENSE ├── INSTRUCTIONS.md └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Dan Brezeanu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /INSTRUCTIONS.md: -------------------------------------------------------------------------------- 1 | # Instructions for setting up interceptor 2 | 3 | ## Using mitmproxy 4 | 5 | ### Requirements 6 | * Android device (emulators can be used) 7 | * [WiiM Home](https://play.google.com/store/apps/details?id=com.linkplay.wiimhome) app 8 | * [mitmproxy](https://mitmproxy.org) 9 | 10 | ### Instructions 11 | * Install mitmproxy 12 | * Run `mitmweb --ssl-insecure` from a terminal 13 | * Configure Android to use the proxy: 14 | * Settings 15 | * Network & Internet 16 | * Internet 17 | * Settings cog (beside WiFi network name) 18 | * Pencil (in the top right) 19 | * Open "Advanced options" 20 | * Change "Proxy" to "Manual" 21 | * Set "Proxy hostname" to the proxy IP address 22 | * Set "Proxy port" to 8080 23 | * Filter HTTP requests by searching for "command=". 24 | * Open the WiiM Home app and start clicking various options in the app. The respective HTTP requests will appear in the HTTP interceptor. 25 | ![mitmweb example](https://github.com/user-attachments/assets/a600b64f-5691-49bc-a05a-7557bff804c8) 26 | * When done, don't forget to change "Proxy" back to "None" 27 | 28 | 29 | ## Using HTTP Toolkit PRO 30 | 31 | ### Requirements 32 | * Android device (emulators can be used) 33 | * [WiiM Home](https://play.google.com/store/apps/details?id=com.linkplay.wiimhome) app 34 | * [HTTP Toolkit **PRO**](https://httptoolkit.com/) - installed on both the Android device and a PC 35 | * You need the PRO version in order to allow trusting the self-signed SSL certificate on the WiiM device. 36 | * The non-PRO version can be used to see the what requests the app makes, but they won't be forwarded to the device. 37 | 38 | ### Instructions 39 | 40 | * Make sure the WiiM device is set up in the application 41 | * In HTTP Toolkit on the PC, navigate to Settings -> HOST HTTPS WHITELIST -> Add the IP address of the WiiM device 42 | ![image](https://github.com/user-attachments/assets/9be26b98-4528-4d29-b607-99c1d6f9f423) 43 | * Start the HTTP Toolkit with the Android device (via ADB or QR code) 44 | * Filter HTTP requests using the "command=" string. 45 | * Open the WiiM Home app and start clicking various options in the app. The respective HTTP requests will appear in the HTTP interceptor. 46 | ![image](https://github.com/user-attachments/assets/ba3be507-e5bd-4dcb-b50f-eba32ab4223e) 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WiiM Extended HTTP API 2 | 3 | In addition to the HTTP endpoints presented in the [official docs](https://www.wiimhome.com/pdf/HTTP%20API%20for%20WiiM%20Products.pdf), the WiiM's HTTP API allows for way more undocumented operations. 4 | 5 | If any functionality you need is not listed here, feel free to create a PR with additional info. The instructions on how to set up the interceptor are specified [here](https://github.com/DanBrezeanu/wiim-extended-http-api/blob/main/INSTRUCTIONS.md). 6 | 7 | **All HTTP requests use the GET method, regardless whether they set or get a resource.** 8 | 9 | --- 10 | 11 | ### Network 12 | 13 | * #### Get static network config 14 | * Command: `getStaticIpInfo` 15 | * Args: None 16 | * Example: https://192.168.1.100/httpapi.asp?command=getStaticIpInfo 17 | * Output example: 18 | ```json 19 | { 20 | "wlanStaticIp": "192.168.100/24", 21 | "wlanGateWay": "192.168.1.1", 22 | "wlanDnsServer": "8.8.8.8", 23 | "wlanStaticIpEnable": 1, 24 | "ethStaticIp": "", 25 | "ethGateWay": "", 26 | "ethDnsServer": "", 27 | "ethStaticIpEnable": 0 28 | } 29 | ``` 30 | * Observations 31 | * If the WiiM device is configured to use DHCP, the above string values will be empty (see the ethernet related keys). 32 | 33 | * #### Set static WLAN network config 34 | * Command: `setWlanStaticIp` 35 | * Keyword args: 36 | * `ipAddr`: Static IP address to set + netmask 37 | * `gateWay`: Gateway 38 | * `dnsServer`: The DNS Server (default: `8.8.8.8`) 39 | * Example: https://192.168.1.100/httpapi.asp?command=setWlanStaticIp:ipAddr=192.168.1.100/24:gateWay=192.168.1.1:dnsServer=8.8.8.8 40 | * Output: 41 | * Success: `OK` 42 | 43 | --- 44 | 45 | ### Bluetooth 46 | 47 | * #### Start Bluetooth device scan 48 | * Command: `startbtdiscovery` 49 | * Args: `NUM_SECONDS`: Number of seconds for which to run the scan for 50 | * Example: https://192.168.1.100/httpapi.asp?command=startbtdiscovery:3 51 | * Output: 52 | * Success: `OK` 53 | 54 | * #### Get Bluetooth device scan result 55 | * Command: `getbtdiscoveryresult` 56 | * Args: None 57 | * Example: https://192.168.1.100/httpapi.asp?command=getbtdiscoveryresult 58 | * Output (JSON): 59 | * `num`: Number of found devices 60 | * `scan_status`: BT scan step 61 | * `0`: Not started 62 | * `1`: Initializing 63 | * `2`: ??? (never seen it) 64 | * `3`: Scanning 65 | * `4`: Finished scanning 66 | * `list`: List of found devices 67 | * Output example: 68 | ```json 69 | { "num": 1, "scan_status": 3, "list": [ { "name": "Bedroom TV", "ad": "1d:a2:53:1a:85:9c", "ct": 0, "role": "Audio Source" } ] } 70 | ``` 71 | * Observations: 72 | * Already paired devices may be listed 73 | 74 | * #### Clear Bluetooth device scan result 75 | * Command: `clearbtdiscoveryresult` 76 | * Args: None 77 | * Example: https://192.168.1.100/httpapi.asp?command=clearbtdiscoveryresult 78 | * Output: 79 | * Success: `OK` 80 | 81 | * #### Get paired Bluetooth devices 82 | * Command: `getbthistory` 83 | * Args: None 84 | * Example: https://192.168.1.100/httpapi.asp?command=getbthistory 85 | * Output (JSON): 86 | * `num`: Number of found devices 87 | * `scan_status`: BT scan step 88 | * `1`: Initializing 89 | * `2`: ??? (never seen it) 90 | * `3`: Scanning 91 | * `4`: Finished scanning 92 | * `list`: List of found devices 93 | 94 | * Output example: 95 | ```json 96 | { "num": 1, "scan_status": 0, "list": [ { "name": "My Speaker", "ad": "9c:2a:be:2e:ce:f1", "ct": 0, "role": "Audio Sink" } ] } 97 | ``` 98 | 99 | * #### Connect to Bluetooth device 100 | * Command: `connectbta2dpsynk` 101 | * Args: `BT_MAC_ADDRESS` 102 | * Example: https://192.168.1.100/httpapi.asp?command=connectbta2dpsynk:9c:2a:be:2e:ce:f1 103 | * Output: 104 | * Success: `OK` 105 | * Error: `Failed` 106 | * Observations: 107 | * The device should be an `Audio Sink` (e.g. speaker, A/V reciever). The audio output will be changed to the device. 108 | 109 | * #### Disconnect from Bluetooth device 110 | * Command: `disconnectbta2dpsynk` 111 | * Args: `BT_MAC_ADDRESS` 112 | * Example: https://192.168.1.100/httpapi.asp?command=disconnectbta2dpsynk:9c:2a:be:2e:ce:f1 113 | * Output: 114 | * Success: `OK` 115 | 116 | * #### Get Bluetooth pairing status 117 | * Command: `getbtpairstatus` 118 | * Args: None 119 | * Example: https://192.168.1.100/httpapi.asp?command=getbtpairstatus 120 | * Output (JSON): 121 | * `result`: Pair status 122 | * `1`: Disconnected 123 | * `2`: Connecting (assumption, never seen it) 124 | * `3`: Connected 125 | * Output example: 126 | ```json 127 | {"result":3} 128 | ``` 129 | --- 130 | 131 | ### Audio 132 | 133 | * #### Get SPDIF sample rate switch latency 134 | * Command: `getSpdifOutSwitchDelayMs` 135 | * Args: None 136 | * Example: https://192.168.1.100/httpapi.asp?command=getSpdifOutSwitchDelayMs 137 | * Output example 138 | ``` 139 | 800 140 | ``` 141 | * Observations: 142 | * This value only makes sense if the output interface is SPDIF (optical out). 143 | * Value can be retrieved even if output is not SPDIF 144 | 145 | * #### Set SPDIF sample rate switch latency 146 | * Command: `setSpdifOutSwitchDelayMs` 147 | * Args: `SPDIF_OUT_SWITCH_DELAY_MS` 148 | * Example: https://192.168.1.100/httpapi.asp?command=setSpdifOutSwitchDelayMs:800 149 | * Output: 150 | * Success: `OK` 151 | * Observations: 152 | * Value can be set even if output is not SPDIF 153 | * `SPDIF_OUT_SWITCH_DELAY_MS` is upper bound to 3000. 154 | 155 | * #### Get left/right channel balance 156 | * Command: `getChannelBalance` 157 | * Args: None 158 | * Example: https://192.168.1.100/httpapi.asp?command=getChannelBalance 159 | * Output example 160 | ``` 161 | 0.0 162 | ``` 163 | * Observations: 164 | * The value will be a number ranging from `-1.0` (fully panned left) to `1.0` (fully panned right). 165 | * #### Set left/right channel balance 166 | * Command: `setChannelBalance` 167 | * Args: `CHANNEL_BALANCE`: `-1.0` to `1.0` (decimal is optional) 168 | * Example: https://192.168.1.100/httpapi.asp?command=setChannelBalance:0 169 | * Output 170 | * Success: `OK` 171 | * Error: `Failed` 172 | --- 173 | 174 | ### Equalizer 175 | 176 | * #### Disable Equalizer 177 | * Command: `EQOff` 178 | * Args: None 179 | * Example: https://192.168.1.100/httpapi.asp?command=EQOff 180 | * Output: `{"status":"OK"}` 181 | 182 | * #### Get list of available Equalizer presets 183 | * Command: `EQGetList` 184 | * Args: None 185 | * Example: https://192.168.1.100/httpapi.asp?command=EQGetList 186 | * Output (JSON): a list of equalizer presets 187 | * Output example: 188 | ```json 189 | [ 190 | "Acoustic", 191 | "Bass Booster", 192 | "Bass Reducer", 193 | "Classical", 194 | "Dance", 195 | "Deep", 196 | "Electronic", 197 | "Flat", 198 | "Game", 199 | "Hip-Hop", 200 | "Jazz", 201 | "Latin", 202 | "Loudness", 203 | "Lounge", 204 | "Movie", 205 | "Piano", 206 | "Pop", 207 | "R&B", 208 | "Rock", 209 | "Small Speakers", 210 | "Spoken Word", 211 | "Treble Booster", 212 | "Treble Reducer", 213 | "Vocal Booster" 214 | ] 215 | ``` 216 | 217 | * #### Set Equalizer preset 218 | * Command: `EQLoad` 219 | * Args: one of the preset names 220 | * Examples: 221 | * https://192.168.1.100/httpapi.asp?command=EQLoad:Hip-Hop 222 | * https://192.168.1.100/httpapi.asp?command=EQLoad:Bass+Booster 223 | * Output (JSON): the resulting 10-band equalizer configuration 224 | * Output example: 225 | ```json 226 | { 227 | "EQStat": "On", 228 | "Name": "Classical", 229 | "pluginURI": "http://moddevices.com/plugins/caps/Eq10HP", 230 | "EQBand": [ 231 | { 232 | "index": 0, 233 | "param_name": "band31Hz", 234 | "value": 4.8 235 | }, 236 | { 237 | "index": 1, 238 | "param_name": "band63Hz", 239 | "value": 3.8 240 | }, 241 | { 242 | "index": 2, 243 | "param_name": "band125Hz", 244 | "value": 3 245 | }, 246 | { 247 | "index": 3, 248 | "param_name": "band250Hz", 249 | "value": 2.5 250 | }, 251 | { 252 | "index": 4, 253 | "param_name": "band500Hz", 254 | "value": -1.5 255 | }, 256 | { 257 | "index": 5, 258 | "param_name": "band1kHz", 259 | "value": -1.5 260 | }, 261 | { 262 | "index": 6, 263 | "param_name": "band2kHz", 264 | "value": 0 265 | }, 266 | { 267 | "index": 7, 268 | "param_name": "band4kHz", 269 | "value": 2.2 270 | }, 271 | { 272 | "index": 8, 273 | "param_name": "band8kHz", 274 | "value": 3.2 275 | }, 276 | { 277 | "index": 9, 278 | "param_name": "band16kHz", 279 | "value": 3.8 280 | } 281 | ], 282 | "channelMode": "Stereo", 283 | "status": "OK", 284 | "source_name": "wifi" 285 | } 286 | ``` 287 | 288 | --- 289 | 290 | ### Squeezelite (Lyrion Music Server/Logitech Media Server) integration 291 | 292 | * #### Get information about the Squeezelite configuration 293 | * Command: `Squeezelite:getState` 294 | * Args: None 295 | * Output (JSON): 296 | * `default_server`: the LMS instance to which the player would connect automatically 297 | * `state`: 298 | * `discovering`: player is discovering LMS instances 299 | * `connected`: player is connected to an LMS 300 | * `discover_list`: list of LMS instances found in the player's network 301 | * `auto_connect`: whether to automatically re-connect to the previously connected LMS instance 302 | * Example: https://192.168.1.100/httpapi.asp?command=Squeezelite:getState 303 | * Output example: 304 | ```json 305 | { 306 | "default_server": "192.168.1.4:3483", 307 | "state": "discovering", 308 | "discover_list": [ 309 | "192.168.1.4:3483", 310 | "192.168.1.123:3483" 311 | ], 312 | "connected_server": "192.168.1.4:3483", 313 | "auto_connect": 1 314 | } 315 | ``` 316 | 317 | * #### Trigger Lyrion Music Server discovery 318 | * Command: `Squeezelite:discover` 319 | * Args: None 320 | * Example: https://192.168.1.100/httpapi.asp?command=Squeezelite:discover 321 | * Output: `OK` 322 | 323 | * #### Turn on/off LMS auto connect 324 | * Command: `Squeezelite:autoConnectEnable` 325 | * Args: `ON`: 0 or 1 326 | * Examples: 327 | * https://192.168.1.100/httpapi.asp?command=Squeezelite:autoConnectEnable:0 328 | * https://192.168.1.100/httpapi.asp?command=Squeezelite:autoConnectEnable:1 329 | * Output: `OK` 330 | 331 | * #### Connect player to previously discovered LMS instance 332 | * Command: `Squeezelite:connectServer` 333 | * Args: `LMS IP Address` 334 | * Example: 335 | * https://192.168.1.100/httpapi.asp?command=Squeezelite:connectServer:192.168.1.123 336 | * Output: `OK` 337 | 338 | --- 339 | 340 | ### Misc 341 | 342 | * #### Turn on/off status LED ("Status Light" option from app) 343 | * Command: `LED_SWITCH_SET` 344 | * Args: `ON`: 0 or 1 345 | * Examples: 346 | * https://192.168.1.100/httpapi.asp?command=LED_SWITCH_SET:0 347 | * https://192.168.1.100/httpapi.asp?command=LED_SWITCH_SET:1 348 | * Output: 349 | * Success: `OK` 350 | 351 | * #### Turn on/off touch controls 352 | * Command: `Button_Enable_SET` 353 | * Args: `ON`: 0 or 1 354 | * Examples: 355 | * https://192.168.1.100/httpapi.asp?command=Button_Enable_SET:0 356 | * https://192.168.1.100/httpapi.asp?command=Button_Enable_SET:1 357 | * Output: 358 | * Success: `OK` 359 | 360 | --------------------------------------------------------------------------------