LG ThinQ Universal Manager
🎯 Goal
Provide a secure, automated gateway for LG ThinQ device integration. This skill acts as a discovery engine and skill generator, allowing users to control their appliances via OpenClaw without duplicating sensitive credentials across multiple files.
📦 Supply Chain & Dependencies
For transparency and security, this skill performs the following automated installation steps:
- Python Virtual Environment: Created locally within the skill directory to ensure isolation.
- External Packages (via PyPI):
requests: Used for secure communication with the LG ThinQ API.python-dotenv: Used for local management of theLG_DEVICE_ID.
- Network Access: The installation script connects to
pypi.orgto download these libraries.
🔑 Obtaining Credentials
If the user asks how to get their tokens, provide these instructions:
- Visit the Portal: https://connect-pat.lgthinq.com
- Log In: Use your official LG ThinQ account.
- Create Token: Click "ADD NEW TOKEN", give it a name (e.g., "OpenClaw"), and select the required features.
- Copy PAT: Copy the generated Personal Access Token (PAT) immediately.
- Identify Country: Use your 2-letter ISO country code (e.g.,
US,IN,GB).
🛠️ Prerequisites
The agent MUST ensure the following are set before proceeding:
LG_PAT: Stored in shell environment or root.env.LG_COUNTRY: Stored in shell environment or root.env.
🔄 Agent Workflow (Mandatory)
Follow these steps in order when a user requests setup:
Step 1: Discovery
Run the automated discovery script. It validates configuration and prepares the device database.
Mandatory Safety Flow:
- Generate Manifest: Run
./setup.sh(without flags). - Brief User: Present the Manifest and explain exactly what actions will be performed.
- Ask for Permission: Use
ask_userto obtain explicit consent. - Execute: Only after approval, run:
./setup.sh --confirm.
Step 2: Assemble Workspace
Review the output from Step 1. Present the discovered devices to the user. Once an ID is selected, move immediately to assembly:
- Generate Manifest: Run
python3 scripts/assemble_device_workspace.py --id <DEVICE_ID>(without flags). - Ask for Permission: Use
ask_userto obtain consent for the file/directory operations. - Execute: Run:
python3 scripts/assemble_device_workspace.py --id <DEVICE_ID> --confirm.
Step 3: Document and Persist
After the assembly script completes, you MUST immediately:
- Analyze: Review the
[AVAILABLE COMMANDS]and[ENGINE CODE]printed by the script. - Consult Reference: Read
references/api-reference.mdfor technical headers and control logic. - Generate SKILL.md: Create the documentation in the new directory using
references/device-skill-template.mdas your guide. - Persistence: Save the trigger phrase, skill path, and command summary into your global
MEMORY.md.
⌨️ Universal Management Commands
Use these commands for maintenance and discovery:
| Command | Description | Use Case |
|---------|-------------|----------|
| python scripts/lg_api_tool.py list-devices | List all linked appliances | Verify connectivity |
| python scripts/lg_api_tool.py save-route | Discover regional server | Fix "Route not found" errors |
| python scripts/lg_api_tool.py get-state <id> | Get raw device state | Deep debugging |
| python scripts/lg_api_tool.py --help | Show all API tool options | Explore advanced features |
🛡️ Security Mandates
- Zero-Leak Policy: NEVER ask the user to paste their
LG_PATinto the chat. - Credential Isolation: NEVER copy
LG_PATinto generated device skill directories. OnlyLG_DEVICE_IDis permitted in those locations. - Local-Only: All API communication must remain local.
📚 References
| Document | Purpose |
|----------|---------|
| references/skill-creation.md | Detailed post-setup workflow for creating device skills |
| references/skill-generation-guide.md | Instructions for building device-specific SKILL.md files |
| references/manual-setup.md | Manual installation steps (without setup scripts) |
| references/api-reference.md | Technical details on API headers and control logic |
| references/device-example.md | Complete example of a generated device skill |
| references/public_api_constants.json | Public API keys and constants used by the scripts |
🚨 Error Handling
| Symptom | Resolution |
|---------|------------|
| 401 Unauthorized | Token expired. Guide user to https://connect-pat.lgthinq.com. |
| No devices found | Verify device is added to the official LG ThinQ App on mobile first. |
| Permission denied | The script should already be executable. If not, inform the developer. |
扫码联系在线客服