מדריך ליחידה של מיזוג אוויר חכם

action.devices.types.AC_UNIT – יחידות מיזוג אוויר דומות לתרמוסטטים, אבל הן לא תומכות בחימום ויכול להיות שלא תומכות בהגדרת יעדי הטמפרטורה.

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

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

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

ה-traits הנדרשות

התכונות והפקודות האלה נדרשות, אם זה רלוונטי למכשיר שלכם. אם המכשיר שלך לא תומך בתכונות האלה, יש להזין את קוד השגיאה functionNotSupported בתגובה מסוג QUERY או EXECUTE. מידע נוסף זמין בקטע שגיאות וחריגים.

דרישות איכות

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

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

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

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

בקשה
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.AC_UNIT",
        "traits": [
          "action.devices.traits.FanSpeed",
          "action.devices.traits.OnOff",
          "action.devices.traits.TemperatureSetting"
        ],
        "name": {
          "name": "Simple AC unit"
        },
        "willReportState": true,
        "attributes": {
          "availableFanSpeeds": {
            "speeds": [
              {
                "speed_name": "low_key",
                "speed_values": [
                  {
                    "speed_synonym": [
                      "Low",
                      "Slow"
                    ],
                    "lang": "en"
                  }
                ]
              },
              {
                "speed_name": "high_key",
                "speed_values": [
                  {
                    "speed_synonym": [
                      "High",
                      "Speed 2"
                    ],
                    "lang": "en"
                  }
                ]
              }
            ],
            "ordered": true
          },
          "availableThermostatModes": [
            "off",
            "cool",
            "fan-only",
            "on"
          ],
          "thermostatTemperatureUnit": "C"
        },
        "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,
        "on": true,
        "currentFanSpeedSetting": "low_key",
        "thermostatMode": "cool",
        "thermostatTemperatureAmbient": 25,
        "thermostatTemperatureSetpoint": 20
      }
    }
  }
}

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

SetFanSpeed

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

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

OnOff

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

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

ThermostatTemperatureSetpoint

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

בקשה
{
  "requestId": "6894439706274654520",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.ThermostatTemperatureSetpoint",
                "params": {
                  "thermostatTemperatureSetpoint": 22
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654520",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "thermostatMode": "cool",
          "thermostatTemperatureSetpoint": 22,
          "thermostatTemperatureAmbient": 25.1
        }
      }
    ]
  }
}

ThermostatSetMode

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

בקשה
{
  "requestId": "6894439706274654522",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.ThermostatSetMode",
                "params": {
                  "thermostatMode": "cool"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654522",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "thermostatMode": "cool",
          "thermostatTemperatureSetpoint": 22,
          "thermostatTemperatureAmbient": 25.1
        }
      }
    ]
  }
}

מכשיר ERRORS

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