Install
openclaw skills install tuya-smart-homeControl Tuya/Smart Life smart home devices including pet feeders, lights, plugs, curtains via cloud API or local network. Use when: (1) controlling smart home devices, (2) feeding pets remotely, (3) managing Tuya/Smart Life devices, (4) scanning local Tuya devices, (5) querying device status like battery or temperature.
openclaw skills install tuya-smart-homeControl any Tuya/Smart Life device via cloud API or local network.
pip3 install tinytuya tuya-connector-python
Two control modes available:
Requires Tuya IoT Platform credentials from https://iot.tuya.com:
ACCESS_ID — from Cloud ProjectACCESS_SECRET — from Cloud ProjectREGION — cn (China), us (Americas/SEA), eu (Europe), in (India)Requires device info (obtain via cloud API first):
DEVICE_ID — device identifierLOCAL_KEY — device encryption keyIP — device local IP addressVERSION — protocol version (usually 3.4)python3 scripts/tuya_scan.py
python3 scripts/tuya_control.py --mode cloud --action info \
--device-id DEVICE_ID \
--access-id ACCESS_ID --access-secret ACCESS_SECRET --region cn
# Cloud
python3 scripts/tuya_control.py --mode cloud --action status \
--device-id DEVICE_ID \
--access-id ACCESS_ID --access-secret ACCESS_SECRET --region cn
# Local
python3 scripts/tuya_control.py --mode local --action status \
--device-id DEVICE_ID --ip IP --local-key KEY
# Cloud — feed pet 1 portion
python3 scripts/tuya_control.py --mode cloud --action send \
--device-id DEVICE_ID --code manual_feed --value 1 \
--access-id ACCESS_ID --access-secret ACCESS_SECRET --region cn
# Local — feed pet 1 portion
python3 scripts/tuya_control.py --mode local --action send \
--device-id DEVICE_ID --ip IP --local-key KEY \
--dp-id 3 --value 1
# Turn on light
python3 scripts/tuya_control.py --mode cloud --action send \
--device-id DEVICE_ID --code switch_led --value true \
--access-id ACCESS_ID --access-secret ACCESS_SECRET --region cn
# Open curtain
python3 scripts/tuya_control.py --mode cloud --action send \
--device-id DEVICE_ID --code control --value open \
--access-id ACCESS_ID --access-secret ACCESS_SECRET --region cn
| Device | Code | Values | Description |
|---|---|---|---|
| Pet Feeder | manual_feed | 1-12 | Feed N portions |
| Pet Feeder | quick_feed | true | Quick feed |
| Pet Feeder | light | true/false | Night light |
| Light | switch_led | true/false | On/off |
| Light | bright_value | 10-1000 | Brightness |
| Light | temp_value | 0-1000 | Color temperature |
| Plug | switch_1 | true/false | On/off |
| Curtain | control | open/stop/close | Movement |
| Curtain | percent_control | 0-100 | Position % |
China data center (openapi.tuyacn.com) blocks non-China IPs by default.
Solutions:
For detailed API documentation, DP code tables, and setup guide, see references/tuya_api.md.