Files
lg-smtv-mcp/docs/poc/capabilities.md
kiskaadee fdef27d574 docs(poc): verify SSAP subscriptions, msg id interleaving, and cold-boot WoL timing
- Add wake (--mac, --broadcast), subscribe-test, and turn-off subcommands to docs/poc/tv_test.py
- Document verified 'type': 'subscribe' behavior on audio/getStatus (including nested volumeStatus.soundOutput) and getForegroundAppInfo in docs/poc/capabilities.md
- Record empirical observation that mutating commands push subscription update frames before their own request response frame on the same WebSocket
- Record deep cold-standby WoL boot timing (~30-35s to TLS + register, requiring open_timeout >= 3-4s and ~45s wake budget)
2026-11-15 06:42:40 -05:00

50 lines
5.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LG webOS Control Frontier (`65UR8750PSA` / `WebOS/4.1.0`)
Empirical notes from probing `192.168.1.11` (`Ethernet`, MAC `7c:64:6c:94:d1:24`) over the local network.
## Transport & Discovery
| Protocol | Endpoint | Purpose | Notes |
| :--- | :--- | :--- | :--- |
| **SSDP** | `239.255.255.250:1900` (UDP) | Discover TV on LAN | `urn:lge-com:service:webos-second-screen:1` returns `Location: http://192.168.1.11:1783/`; `ssdp:all` also reveals DIAL (`:1978`) and Ethernet MAC (`WAKEUP: MAC=...`). |
| **SSAP** | `wss://192.168.1.11:3001` | Primary JSON RPC control bus | Self-signed TLS cert (`CN=LGE TV SSG`); requires `register` handshake and `client-key` saved after on-screen `PROMPT`. |
| **DIAL** | `http://192.168.1.11:36866/apps` | App casting / `<screenId>` lookup | Requires `Origin: https://www.youtube.com` for YouTube (`403` without it). |
---
## Verified SSAP Endpoints
### Working (Tested on `65UR8750PSA`)
- **System info**: `ssap://system/getSystemInfo` → returns `modelName`, `serialNumber`, `receiverType`, `features`.
- **Installed apps**: `ssap://com.webos.applicationManager/listLaunchPoints` → returned 28 apps (`netflix`, `youtube.leanback.v4`, `amazon`, `com.disney.disneyplus-prod`, `com.apple.appletv`, `tv.twitch.tv.starshot.lg`, etc.).
- **Foreground app**: `ssap://com.webos.applicationManager/getForegroundAppInfo` → requires `READ_RUNNING_APPS` permission.
- **Audio status**: `ssap://audio/getStatus` → returns `volume`, `maxVolume`, `mute`, `soundOutput`.
- **Notifications**: `ssap://system.notifications/createToast` with `{"message": "..."}` → displays toast on screen.
- **External inputs**: `ssap://tv/getExternalInputList` → requires `READ_INPUT_DEVICE_LIST` / `CONTROL_INPUT_TV`; returned `HDMI_1`, `HDMI_2`, `HDMI_3`.
- **Launch & close apps**:
- `ssap://system.launcher/launch` with `{"id": "<app_id>", "params": {...}}`
- `ssap://system.launcher/close` with `{"id": "<app_id>"}`
- **Deep-linking quirks observed**:
- **YouTube (`youtube.leanback.v4`)**: Expects `{"contentTarget": "v=<id>&t=<seconds>s"}` (full `https://...` URLs were ignored). If cold-started onto the profile picker, a second launch switches to the video.
- **Netflix (`netflix`)**: Expects `{"contentTarget": "m=https://www.netflix.com/title/<id>"}` (or `/watch/<episode_id>`). Without `m=`, Netflix hung on loading. Audio/subtitle track selection is not exposed via `params`.
- **Screen capture (via SSAP + Dev Mode SSH)**: `ssap://com.webos.service.capture/executeOneShot` with `{"path": "/tmp/test.jpg", "method": "DISPLAY", "format": "JPG"}` succeeded (`960x540`, `10410`–`12754` bytes):
- Calling without `"path"` fails with `5 ERROR_NOT_ENOUGH_MEMORY`.
- `/tmp/test.jpg` is not served over `https://192.168.1.11:3001/tmp/...` (timed out).
- **Verified workaround**: With **LG Developer Mode** + **Key Server** enabled (SSH on port `9922`, `ssh-rsa` host/pubkey algorithms enabled for the TV host), `scp webos-tv:/tmp/test.jpg .` transfers the `~10 KB` screenshot in `< 1s` (`1.1 MB/s`).
- **Pure-Python SFTP (`asyncssh`)**: Verified `asyncssh 2.24.0` on Python 3.14 connects to `192.168.1.11:9922` and lists `/tmp` over SFTP when passing `config=[]`, `server_host_key_algs=["ssh-rsa", ...]`, and `signature_algs=["ssh-rsa", ...]` (note: `asyncssh` rejects OpenSSH's `+ssh-rsa` prefix with `ValueError`).
- Dev Mode shell environment observed: `uid=6739(prisoner) gid=5000(jailer)`, home `/media/developer`, `Linux LGwebOSTV 5.4.268-294.24.papikonda.2 #1 SMP PREEMPT ... aarch64 GNU/Linux` (`1222 MB` RAM).
- **Pointer / D-pad input socket**: `ssap://com.webos.service.networkinput/getPointerInputSocket` returns a second `wss://` `socketPath` accepting plain-text frames (`type:button\nname:HOME|ENTER|BACK|UP|DOWN|LEFT|RIGHT\n\n`). Requires `manifest.permissions` in the `register` payload even when reusing a saved `client-key`.
- **Text input (`ime`)**: `ssap://com.webos.service.ime/insertText` (`{"text": "...", "replace": 0}`) and `ssap://com.webos.service.ime/sendEnterKey` work cleanly once the native webOS on-screen keyboard is open (calling `insertText` before opening the keyboard returns `returnValue: true` without populating the field).
- **Power lifecycle (`turnOff` + Wake-on-LAN)**:
- `ssap://system/turnOff` cleanly powers the TV into standby (`returnValue: true`).
- Sending a standard WoL magic packet (`0xff * 6 + mac * 16`) over UDP broadcast (`255.255.255.255:9`) to Ethernet MAC `7c:64:6c:94:d1:24` successfully wakes and powers on the TV from standby.
- While the TV is in warm standby/booting right after `turnOff`, `wss://192.168.1.11:3001` accepts the WebSocket upgrade and immediately closes with `1008 (policy violation) Try Again Later (EWS)`. In deep cold standby (after extended power-off), the TCP/TLS opening handshake times out (`TimeoutError`), and cold-booting via WoL until `wss://:3001` completes TLS + `register` takes `~30–35s` (requiring `open_timeout >= 3–4s` and a `~45s` wake timeout budget).
- **Subscriptions & `msg["id"]` interleaving (`"type": "subscribe"`)**:
- Verified `"type": "subscribe"` on both `ssap://com.webos.applicationManager/getForegroundAppInfo` (`{"subscribed": true, "returnValue": true, "appId": "com.webos.app.livetv", ...}`) and `ssap://audio/getStatus` (`{"returnValue": true, "mute": false, "volume": 27, "volumeStatus": {"soundOutput": "tv_speaker", "maxVolume": 100, "muteStatus": false, ...}}`).
- When sending a mutating request (`ssap://audio/setMute`) on the same WebSocket, the TV pushes the updated `sub_audio` subscription frame **before** the `req_mute_on` / `req_mute_off` response frame—confirming that persistent clients must demultiplex incoming frames by `msg["id"]`.
### Blocked on Retail Firmware
- **`ssap://settings/getSystemSettings`**: Returned `401 insufficient permissions` (low-level picture/network/system settings are restricted to signed LG system apps).