Tuya · Capability

Tuya Smart Home Control

IoT device management and control capability for smart home applications. Combines device querying, real-time status monitoring, device commands, and operation log analysis. Used by smart home app developers, facility managers, and IoT platform integrators to monitor and control devices such as lights, thermostats, sensors, and appliances.

Run with Naftiko TuyaIoTSmart HomeDevice ControlAutomation

What You Can Do

GET
List devices — List all devices in the project
/v1/devices
GET
Get device — Get device details and current state
/v1/devices/{device_id}
GET
Get device status — Get current status of all data points
/v1/devices/{device_id}/status
POST
Send commands — Control a device
/v1/devices/{device_id}/commands
GET
Get device logs — Get operation logs for a device
/v1/devices/{device_id}/logs

MCP Tools

list-devices

List all IoT devices registered to the Tuya project

read-only
get-device

Get details and current state of a specific IoT device

read-only
get-device-status

Get the current value of all data points for a device (e.g., switch state, brightness, temperature)

read-only
control-device

Send control commands to an IoT device. Specify code/value pairs for data points (e.g., switch_led=true, bright_value=500)

update-device-name

Update the friendly display name of a device

idempotent
get-device-logs

Query operation and event logs for a device over a time range

read-only
remove-device

Remove and deregister a device from the cloud account

idempotent

Capability Spec

smart-home-control.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Tuya Smart Home Control
  description: IoT device management and control capability for smart home applications. Combines device querying, real-time
    status monitoring, device commands, and operation log analysis. Used by smart home app developers, facility managers,
    and IoT platform integrators to monitor and control devices such as lights, thermostats, sensors, and appliances.
  tags:
  - Tuya
  - IoT
  - Smart Home
  - Device Control
  - Automation
  created: '2026-05-03'
  modified: '2026-05-06'
binds:
- namespace: env
  keys:
    TUYA_ACCESS_ID: TUYA_ACCESS_ID
    TUYA_ACCESS_SECRET: TUYA_ACCESS_SECRET
capability:
  consumes:
  - type: http
    namespace: tuya-devices
    baseUri: https://openapi.tuyaus.com
    description: Tuya Device Management API
    authentication:
      type: apikey
      key: client_id
      value: '{{TUYA_ACCESS_ID}}'
      placement: header
    resources:
    - name: devices
      path: /v1.0/devices/{device_id}
      description: Manage individual devices
      operations:
      - name: get-device
        method: GET
        description: Get device details including status and attributes
        inputParameters:
        - name: device_id
          in: path
          type: string
          required: true
          description: Unique device identifier
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: update-device
        method: PUT
        description: Update device name
        inputParameters:
        - name: device_id
          in: path
          type: string
          required: true
          description: Unique device identifier
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        body:
          type: json
          data:
            name: '{{tools.name}}'
      - name: remove-device
        method: DELETE
        description: Remove a device from the account
        inputParameters:
        - name: device_id
          in: path
          type: string
          required: true
          description: Unique device identifier
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: device-list
      path: /v1.0/devices
      description: List and search devices
      operations:
      - name: list-devices
        method: GET
        description: Query devices by project
        inputParameters:
        - name: device_ids
          in: query
          type: string
          required: false
          description: Comma-separated device IDs
        - name: page_size
          in: query
          type: integer
          required: false
          description: Results per page
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: device-commands
      path: /v1.0/devices/{device_id}/commands
      description: Send device control commands
      operations:
      - name: send-commands
        method: POST
        description: Send control commands to a device
        inputParameters:
        - name: device_id
          in: path
          type: string
          required: true
          description: Unique device identifier
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        body:
          type: json
          data:
            commands: '{{tools.commands}}'
    - name: device-status
      path: /v1.0/devices/{device_id}/status
      description: Get device data point status
      operations:
      - name: get-device-status
        method: GET
        description: Get current status of all device data points
        inputParameters:
        - name: device_id
          in: path
          type: string
          required: true
          description: Unique device identifier
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: device-logs
      path: /v1.0/devices/{device_id}/logs
      description: Query device operation logs
      operations:
      - name: get-device-logs
        method: GET
        description: Get device operation and event logs
        inputParameters:
        - name: device_id
          in: path
          type: string
          required: true
          description: Unique device identifier
        - name: type
          in: query
          type: integer
          required: true
          description: Log type (1=device, 7=automation)
        - name: start_time
          in: query
          type: integer
          required: false
          description: Start timestamp in milliseconds
        - name: end_time
          in: query
          type: integer
          required: false
          description: End timestamp in milliseconds
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
  exposes:
  - type: rest
    port: 8080
    namespace: tuya-smart-home-api
    description: Unified REST API for Tuya smart home device control.
    resources:
    - path: /v1/devices
      name: devices
      description: List and search IoT devices
      operations:
      - method: GET
        name: list-devices
        description: List all devices in the project
        call: tuya-devices.list-devices
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/devices/{device_id}
      name: device
      description: Retrieve a specific device
      operations:
      - method: GET
        name: get-device
        description: Get device details and current state
        call: tuya-devices.get-device
        with:
          device_id: rest.device_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/devices/{device_id}/status
      name: device-status
      description: Get device data point status
      operations:
      - method: GET
        name: get-device-status
        description: Get current status of all data points
        call: tuya-devices.get-device-status
        with:
          device_id: rest.device_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/devices/{device_id}/commands
      name: device-commands
      description: Send control commands to a device
      operations:
      - method: POST
        name: send-commands
        description: Control a device
        call: tuya-devices.send-commands
        with:
          device_id: rest.device_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/devices/{device_id}/logs
      name: device-logs
      description: Query device operation logs
      operations:
      - method: GET
        name: get-device-logs
        description: Get operation logs for a device
        call: tuya-devices.get-device-logs
        with:
          device_id: rest.device_id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    port: 9090
    namespace: tuya-smart-home-mcp
    transport: http
    description: MCP server for AI-assisted Tuya smart home device control.
    tools:
    - name: list-devices
      description: List all IoT devices registered to the Tuya project
      hints:
        readOnly: true
        openWorld: true
      call: tuya-devices.list-devices
      outputParameters:
      - type: object
        mapping: $.
    - name: get-device
      description: Get details and current state of a specific IoT device
      hints:
        readOnly: true
        openWorld: false
      call: tuya-devices.get-device
      with:
        device_id: tools.device_id
      outputParameters:
      - type: object
        mapping: $.
    - name: get-device-status
      description: Get the current value of all data points for a device (e.g., switch state, brightness, temperature)
      hints:
        readOnly: true
        openWorld: false
      call: tuya-devices.get-device-status
      with:
        device_id: tools.device_id
      outputParameters:
      - type: object
        mapping: $.
    - name: control-device
      description: Send control commands to an IoT device. Specify code/value pairs for data points (e.g., switch_led=true,
        bright_value=500)
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: tuya-devices.send-commands
      with:
        device_id: tools.device_id
      outputParameters:
      - type: object
        mapping: $.
    - name: update-device-name
      description: Update the friendly display name of a device
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: tuya-devices.update-device
      with:
        device_id: tools.device_id
      outputParameters:
      - type: object
        mapping: $.
    - name: get-device-logs
      description: Query operation and event logs for a device over a time range
      hints:
        readOnly: true
        openWorld: true
      call: tuya-devices.get-device-logs
      with:
        device_id: tools.device_id
      outputParameters:
      - type: object
        mapping: $.
    - name: remove-device
      description: Remove and deregister a device from the cloud account
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: tuya-devices.remove-device
      with:
        device_id: tools.device_id
      outputParameters:
      - type: object
        mapping: $.