{"skill":{"slug":"smarthome","displayName":"smarthome","summary":"Control global smart home devices via Home Assistant (preferred) and Tuya Smart (fallback) with fuzzy name matching and local device caching.","description":"SKILL.md\nuniversal-smarthome\n通用智能家居支配Skill\nDominate your smart home with seamless control across Home Assistant and Tuya Smart.\n通过Home Assistant（首选）和涂鸦智能（备选）操控全球品牌家电，支持模糊名称匹配。\n\nSetup\n设置\nOption 1: Config File (Recommended)\n选项1：配置文件（推荐）\nCreate ~/.config/universal-smarthome/config.json:\n创建~/.config/universal-smarthome/config.json：\n\n{\n  \"homeassistant\": {\n    \"url\": \"http://homeassistant.local:8123\",\n    \"token\": \"your-long-lived-access-token\"\n  },\n  \"tuya\": {\n    \"access_id\": \"your-access-id\",\n    \"access_secret\": \"your-access-secret\",\n    \"endpoint\": \"https://openapi.tuyacn.com\"\n  }\n}\nOption 2: Environment Variables\n选项2：环境变量\nexport HA_URL=\"http://homeassistant.local:8123\"\nexport HA_TOKEN=\"your-long-lived-access-token\"\nexport TUYA_ACCESS_ID=\"your-access-id\"\nexport TUYA_ACCESS_SECRET=\"your-access-secret\"\nGetting Home Assistant Token\n获取Home Assistant令牌\nOpen Home Assistant → Profile (bottom left)\n打开Home Assistant → 个人资料（左下角）\nScroll to \"Long-Lived Access Tokens\"\n滚动到“长期访问令牌”\nClick \"Create Token\", name it (e.g., \"Clawdbot\")\n点击“创建令牌”，将其命名（例如，“Clawdbot”）\nCopy the token immediately (shown only once)\n立即复制令牌（仅显示一次）\nGetting Tuya Credentials\n获取涂鸦凭据\nLog in to Tuya Smart Platform (https://iot.tuya.com/)\n登录涂鸦智能开放平台（https://iot.tuyacn.com/）\nCreate a cloud project or navigate to \"Cloud Development\"\n创建云项目或进入“云开发”\nGet access_id and access_secret from the project credentials\n从项目凭据中获取access_id和access_secret\nQuick Reference\n快速参考\nDiscovery\n设备发现\npython3 scripts/smart.py discovery\nSync all devices from Home Assistant and Tuya to local cache.\n从Home Assistant和涂鸦同步所有设备到本地缓存。\n\nControl Devices\n控制设备\n# Turn on device by name\npython3 scripts/smart.py control \"device_name\" on\n\n# Turn off device by name\npython3 scripts/smart.py control \"device_name\" off\n\n# The script automatically identifies the platform (HA or Tuya) based on device ID\n# 脚本根据设备ID自动识别平台（HA或涂鸦）\nDevice Name Matching\n设备名称匹配\nThe script supports fuzzy name matching:\n脚本支持模糊名称匹配：\n\n# If device_cache.json contains:\n# {\"id\": \"light.living_room\", \"name\": \"客厅灯\", \"platform\": \"homeassistant\"}\n# User can say: \"打开客厅灯\" or \"打开灯\"\n# 用户可以说：“打开客厅灯”或“打开灯”\n\nPriority: Exact name match → ID match → Fuzzy match\n优先级：精确名称匹配 → ID匹配 → 模糊匹配\nCLI Wrapper\nCLI包装器\nThe scripts/smart.py CLI provides smart home control:\nscripts/smart.py CLI提供智能家居控制：\n\n# Discovery - sync all devices\npython3 scripts/smart.py discovery\n\n# Control device by name\npython3 scripts/smart.py control \"客厅灯\" on\npython3 scripts/smart.py control \"卧室灯\" off\n\n# The script will:\n# 1. Look up device ID from local cache\n# 2. Try Home Assistant first (preferred)\n# 3. Fallback to Tuya Cloud if HA fails or device not found\n# 脚本将：\n# 1. 从本地缓存查找设备ID\n# 2. 优先尝试Home Assistant\n# 3. 若HA失败或设备不存在，回退到涂鸦云端\nSupported Platforms\n支持平台\nPlatform平台\tFeatures功能\tPriority优先级\nHome Assistant\tLocal control, fast response, entity-based\n本地控制，响应快，基于实体\t1 (Primary)\n首选\nTuya Cloud\tCloud API, broader device support\n云端API，更广泛的设备支持\t2 (Fallback)\n备选\nCommon Issues & Solutions\n常见问题与解决方案\nError: Config missing\n错误：配置文件缺失\nSolution: Create ~/.config/universal-smarthome/config.json\n解决方案：创建~/.config/universal-smarthome/config.json\n\nError: 1004: Sign Invalid\n错误：1004: 签名无效\nSolution: Check Tuya access_id and access_secret. Ensure endpoint matches your region (cn/com/us/eu).\n解决方案：检查涂鸦access_id和access_secret。确保endpoint匹配您的区域（cn/com/us/eu）。\n\nError: Entity not found\n错误：实体未找到\nSolution: Run \"python3 scripts/smart.py discovery\" to sync devices first.\n解决方案：先运行“python3 scripts/smart.py discovery”同步设备。\n\nError: Connection refused (HA)\n错误：连接被拒绝（HA）\nSolution: Check HA_URL, ensure Home Assistant is running and accessible.\n解决方案：检查HA_URL，确保Home Assistant正在运行且可访问。\n\nError: 401 Unauthorized (HA)\n错误：401未授权（HA）\nSolution: Token expired or invalid. Generate a new Long-Lived Access Token.\n解决方案：令牌过期或无效。生成新的长期访问令牌。\n\nDevice not responding\n设备无响应\nSolutions:\n解决方案：\n\n1. Check if device is online in respective app (HA or Tuya)\n   检查设备是否在相应应用（HA或涂鸦）中在线\n2. Try controlling directly in Home Assistant or Tuya app\n   尝试直接在Home Assistant或涂鸦应用中控制\n3. Run discovery again to refresh device cache\n   再次运行discovery刷新设备缓存\nArchitecture\n架构设计\n┌─────────────────┐\n│   User Request  │\n│   用户请求       │\n└────────┬────────┘\n         │\n         ▼\n┌─────────────────┐\n│  Semantic Parse │\n│  语义解析       │\n└────────┬────────┘\n         │\n         ▼\n┌─────────────────┐\n│  Device Lookup  │\n│  设备查找       │──────▶ Local Cache\n│                 │       (device_cache.json)\n└────────┬────────┘\n         │\n         ▼\n    ┌────┴────┐\n    │         │\n    ▼         ▼\n┌───────┐ ┌───────┐\n│   HA  │ │ Tuya  │\n│  优先 │ │ 备选  │\n└───┬───┘ └───┬───┘\n    │         │\n    └────┬────┘\n         │\n         ▼\n┌─────────────────┐\n│  Control Result │\n│  控制结果       │\n└─────────────────┘\nSecurity\n安全说明\nCredentials are stored locally at ~/.config/universal-smarthome/\n凭据存储在本地~/.config/universal-smarthome/\nNo hardcoded tokens or secrets in scripts\n脚本中无硬编码的令牌或密钥\nOnly访问用户定义的HA address and Tuya official API\n只访问用户定义的HA地址和涂鸦官方API\nNo third-party data exfiltration\n无第三方数据回传\nTroubleshooting\n故障排除\n401 Unauthorized: HA token expired or invalid. Generate a new one.\n401未授权：HA令牌过期或无效。生成新的令牌。\n\nConnection refused: Check HA_URL, ensure HA is running and accessible.\n连接被拒绝：检查HA_URL，确保HA正在运行且可访问。\n\nEntity not found: Run discovery to sync devices first.\n实体未找到：先运行discovery同步设备。\n\n1004 Sign Invalid: Verify Tuya credentials and region endpoint.\n1004签名无效：验证涂鸦凭据和区域endpoint。\n\nAll platforms failed: Check network connection and device online status.\n所有平台失败：检查网络连接和设备在线状态。\n\nAPI Reference\nAPI参考\nFor advanced usage and custom integrations, see:\n高级使用和自定义集成，请参阅：\n\nHome Assistant API: https://developers.home-assistant.io/docs/api/rest/\nTuya Cloud API: https://developer.tuya.com/en/docs/iot/api-reference/list\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":776,"installsAllTime":29,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1773155551730,"updatedAt":1779077938648},"latestVersion":{"version":"1.0.0","createdAt":1773155551730,"changelog":"Initial release of universal-smarthome skill:\n\n- Seamless smart home control across Home Assistant (preferred) and Tuya Cloud (fallback).\n- Supports device discovery and fuzzy name matching for global brands.\n- Local config file or environment variable setup; no hardcoded credentials.\n- CLI utility for device discovery and on/off control with automatic platform detection.\n- Troubleshooting guides and architecture overview included.","license":"MIT-0"},"metadata":null,"owner":{"handle":"airoom-ai","userId":"s17f4t8hxa9bksgkc57pc5cmys83kvpg","displayName":"airoom-ai","image":"https://avatars.githubusercontent.com/u/263522073?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089824661}}