Panduan Bak Mandi Smart Home

action.devices.types.BATHTUB - Bak mandi dapat diisi dan dikeringkan, mungkin ke tingkat tertentu jika bak mandi mendukungnya.

Jenis ini menunjukkan bahwa perangkat mendapatkan ikon Bak mandi serta beberapa sinonim dan alias yang terkait.

Kemampuan perangkat

Lihat dokumentasi fitur yang sesuai untuk detail penerapan, seperti atribut dan status yang harus didukung layanan Anda, serta cara membuat respons EXECUTE dan QUERY.

Trait ini direkomendasikan, jika sesuai untuk perangkat Anda. Namun, Anda bebas memadupadankan semua karakteristik yang tersedia agar cocok dengan fungsi produk yang ada.

Persyaratan kualitas

  • Latensi: harus kurang dari atau sama dengan 800 md.
  • Keandalan: harus lebih dari atau sama dengan 97%.

Contoh perangkat: Bak mandi sederhana

Bagian ini berisi contoh payload intent yang merepresentasikan "Bathtub" umum berdasarkan jenis dan karakteristik perangkat di atas. Jika Anda menambahkan atau menghapus trait dalam implementasi Anda, ubah respons tersebut agar mencerminkan perubahan tersebut.

Contoh respons SYNC

Permintaan
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
Respons
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.BATHTUB",
        "traits": [
          "action.devices.traits.Fill",
          "action.devices.traits.TemperatureControl",
          "action.devices.traits.OnOff"
        ],
        "name": {
          "name": "Simple bathtub"
        },
        "willReportState": true,
        "attributes": {
          "availableFillLevels": {
            "levels": [
              {
                "level_name": "half_key",
                "level_values": [
                  {
                    "level_synonym": [
                      "Half",
                      "Halfway",
                      "One half"
                    ],
                    "lang": "en"
                  }
                ]
              }
            ],
            "ordered": false
          },
          "temperatureRange": {
            "minThresholdCelsius": 25,
            "maxThresholdCelsius": 100
          },
          "temperatureUnitForUX": "F"
        },
        "deviceInfo": {
          "manufacturer": "smart-home-inc",
          "model": "hs1234",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        }
      }
    ]
  }
}

Contoh respons QUERY

Permintaan
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
Respons
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true,
        "on": false,
        "currentFillLevel": "half_key",
        "isFilled": true,
        "temperatureSetpointCelsius": 30
      }
    }
  }
}

Contoh perintah EXECUTE

Isi

Untuk detail tambahan tentang parameter perintah, lihat referensi action.devices.traits.Fill.

Permintaan
{
  "requestId": "6894439706274654516",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.Fill",
                "params": {
                  "fill": true,
                  "fillLevel": "half_key"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
Respons
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "on": true,
          "currentFillLevel": "half_key"
        }
      }
    ]
  }
}

SetTemperature

Untuk detail tambahan tentang parameter perintah, lihat referensi action.devices.traits.TemperatureControl.

Permintaan
{
  "requestId": "6894439706274654520",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.SetTemperature",
                "params": {
                  "temperature": 40
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
Respons
{
  "requestId": "6894439706274654520",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "temperatureSetpointCelsius": 40
        }
      }
    ]
  }
}

OnOff

Untuk detail tambahan tentang parameter perintah, lihat referensi action.devices.traits.OnOff.

Permintaan
{
  "requestId": "6894439706274654518",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.OnOff",
                "params": {
                  "on": true
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
Respons
{
  "requestId": "6894439706274654518",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "on": true
        }
      }
    ]
  }
}

KESALAHAN Perangkat

Lihat daftar lengkap error dan pengecualian.