Files
lgtv/.claude/handoffs/2026-06-01-consolidate-and-fix.md
T
2026-06-01 20:17:18 -04:00

45 lines
2.2 KiB
Markdown
Raw 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 TV Bridge — consolidated, fixed, deployed (2026-06-01)
## State: DONE, live, verified end-to-end.
Single MQTT→HA bridge now runs on **steel141** as systemd `lgtv-mqtt.service`
(User=seth). Repo: `git.sethpc.xyz/Seth/lgtv` (was 0 commits; now pushed).
## What was wrong + what fixed it
1. **Flaky HA state** — old code ping-swept all 254 hosts over SSH every 30s
(racy ARP). + I briefly made it worse by deploying a 2nd bridge with the
same MQTT `client_id` as the pve173 one → broker eviction war.
→ Cached-IP probe (`~/.cache/lgtv/last_ip`), sweep only on miss. Single
bridge; pve173 service retired.
2. **Won't turn ON** — weak WoL. → unicast+broadcast, ports 9/7, 3 bursts.
**TV-side settings are the remaining half** (Quick Start+ / Mobile TV On;
prefer wired Ethernet) — only Seth can set these.
3. **power_off failed under systemd** — bscpylgtv key DB defaulted to a
CWD-relative path. → pass absolute `key_file_path`. Plus a 2× retry for the
"OFF within ~30s of ON" LG quirk (TV not ready for WebSocket control yet).
## Verified live
- MQTT ON → TV woke <8s, found at 192.168.0.5, IP cached.
- Cache-hit status: 0.041s (was ~1s sweep).
- MQTT OFF (settled): power_off in 3.4s → TV off in ~13s.
- MQTT OFF (10s after ON, the hard case): retry path → rc=0 → TV off.
- Broker: 0 client_id evictions; service 0 restarts.
## Decommissioned
pve173 `lgtv-mqtt.service`: stopped, disabled, unit moved to
`pve173:/root/.backup/lgtv-mqtt.service.retired` (+ old lgtv_mqtt.py backed up).
Reversible: restore the unit file + `daemon-reload` + `enable --now`.
## If something regresses
- Logs: `sudo journalctl -u lgtv-mqtt.service -f` (on steel141).
- Broker churn check: mosquitto log in CT 301 on pve241,
`/var/log/mosquitto/mosquitto.log`, grep `lgtv-bridge already`.
- Redeploy from repo: `./install.sh` (needs `$HOMELAB_PASSWORD`).
- WebOS pairing key: `/home/seth/.aiopylgtv.sqlite` (steel141, seth). If lost,
re-pair with `bscpylgtvcommand <ip> ...` from seth's shell (TV prompts).
## Open / deferred
- TV-side WoL settings unverified (Seth to confirm on the TV).
- No DHCP reservation for the TV (Pi-hole isn't the DHCP server; router is).
Not required — cache handles it — but would let us drop the sweep fallback.