מדריך למקלחת לבית חכם

action.devices.types.SHOWER – אפשר להפעיל ולכבות מקלחות ועשויות לתמוך בכוונון של הטמפרטורה.

הסוג הזה מציין שהמכשיר מקבל את סמל מקלחת וגם כמה מילים נרדפות וכינויים קשורים.

יכולות המכשיר

עיינו בתיעוד של ה-trait כדי לקבל את פרטי ההטמעה, כמו מאפיינים ומצבים שהשירות צריך לתמוך בהם, ואיך ליצור תשובות EXECUTE ו-QUERY.

התכונות האלה מומלצות למכשיר, אם הן רלוונטיות אליו. עם זאת, אפשר לשלב בין כל התכונות הזמינות כדי להתאים אותן בצורה הטובה ביותר לפונקציונליות הקיימת של המוצר.

דרישות איכות

  • זמן אחזור: חייב להיות קצר מ-800 אלפיות שנייה או שווה לו.
  • אמינות: צריכה להיות 97% ומעלה.

מכשיר לדוגמה: מקלחת פשוטה

בקטע הזה יש דוגמאות למטענים ייעודיים (payloads) של Intent שמייצגים 'מקלחת' נפוצה על סמך סוג המכשיר והתכונות שלמעלה. אם מוסיפים או מסירים traits בהטמעה, צריך לשנות את התגובות בהתאם כדי לשקף את השינויים.

תגובת SYNC לדוגמה

בקשה
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.SHOWER",
        "traits": [
          "action.devices.traits.TemperatureControl",
          "action.devices.traits.StartStop"
        ],
        "name": {
          "name": "Simple shower"
        },
        "willReportState": true,
        "attributes": {
          "temperatureRange": {
            "minThresholdCelsius": 25,
            "maxThresholdCelsius": 100
          },
          "temperatureUnitForUX": "F"
        },
        "deviceInfo": {
          "manufacturer": "smart-home-inc",
          "model": "hs1234",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        }
      }
    ]
  }
}

דוגמה לתשובה מסוג QUERY

בקשה
{
  "requestId": "6894439706274654514",
  "inputs": [
    {
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [
          {
            "id": "123"
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654514",
  "payload": {
    "devices": {
      "123": {
        "status": "SUCCESS",
        "online": true,
        "isRunning": true,
        "temperatureSetpointCelsius": 30
      }
    }
  }
}

פקודות EXECUTE לדוגמה

SetTemperature

פרטים נוספים על הפרמטרים של הפקודות זמינים בחומר העזר בנושא action.devices.traits.TemperatureControl.

בקשה
{
  "requestId": "6894439706274654516",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.SetTemperature",
                "params": {
                  "temperature": 45
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654516",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "temperatureSetpointCelsius": 45
        }
      }
    ]
  }
}

StartStop

פרטים נוספים על הפרמטרים של הפקודות זמינים בחומר העזר בנושא action.devices.traits.StartStop.

בקשה
{
  "requestId": "6894439706274654518",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.StartStop",
                "params": {
                  "start": true
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654518",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "isRunning": true
        }
      }
    ]
  }
}

מכשיר ERRORS

כדאי לעיין ברשימה המלאה של שגיאות וחריגים.