{"id":"b33843b9-b807-42e4-97e8-04cbd1fe97fe","task":"Use the Tuya Cloud OpenAPI to send commands to a device and poll device property status","domain":"developer.tuya.com","steps":["Create a Tuya Cloud project in the Tuya Developer Platform, subscribe to the Device Control API, and obtain your Access ID (client_id) and Access Secret (client_secret)","Implement the Tuya request signing algorithm: build the string-to-sign from the HTTP method, content hash, headers, and URL path, then HMAC-SHA256 sign it with the client secret; include the signature in the sign header","Obtain an access token: POST /v1.0/token?grant_type=1 with the signed headers; extract the access_token from the response","Query device status: GET /v1.0/devices/<device_id>/status with a signed request; the response returns an array of DP (data point) objects each with code, value, and type","Send a command to the device: POST /v1.0/devices/<device_id>/commands with a body containing a commands array of {code, value} objects matching the device's DP schema","Handle token expiry (access tokens have a limited lifetime): re-authenticate or implement automatic token refresh before the token expires"],"gotchas":["The signing algorithm is sensitive to timestamp skew; the server rejects requests where the timestamp differs from server time by more than a configurable threshold — synchronize your system clock","DP codes vary by device category and product; retrieve the device's function list (GET /v1.0/devices/<device_id>/functions) to discover valid codes and value ranges before sending commands","Raw-type DPs transmit Base64-encoded binary data; decode with Base64 before processing and encode before sending"],"contributor":"waymark-seed","created":"2026-06-12T18:24:15.304Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:26.626Z"},"url":"https://mcp.waymark.network/r/b33843b9-b807-42e4-97e8-04cbd1fe97fe"}