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

action.devices.types.SPEAKER – המכשיר הזה הוא רמקול מחובר שלא מפצל את האודיו לערוצים נפרדים (לדוגמה, בין שני מכשירים מימין לשמאל).

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

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

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

התכונות הנדרשות

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

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

דרישות איכות

  • זמן האחזור:חייב להיות 3000 אלפיות שנייה או שווה לו.
  • אמינות: הערך צריך להיות 97% או יותר.

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

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

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

בקשה
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.SPEAKER",
        "traits": [
          "action.devices.traits.MediaState",
          "action.devices.traits.OnOff",
          "action.devices.traits.Volume",
          "action.devices.traits.TransportControl"
        ],
        "name": {
          "name": "Simple speaker"
        },
        "willReportState": true,
        "attributes": {
          "transportControlSupportedCommands": [
            "NEXT",
            "PREVIOUS",
            "PAUSE",
            "STOP",
            "RESUME"
          ],
          "volumeMaxLevel": 11,
          "volumeCanMuteAndUnmute": true,
          "supportActivityState": true,
          "supportPlaybackState": true
        },
        "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,
        "currentVolume": 10,
        "isMuted": false,
        "activityState": "ACTIVE",
        "playbackState": "PAUSED"
      }
    }
  }
}

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

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
        }
      }
    ]
  }
}

השתקה

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

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

setVolume

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

בקשה
{
  "requestId": "6894439706274654532",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.setVolume",
                "params": {
                  "volumeLevel": 11
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654532",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "currentVolume": 11,
          "isMuted": false
        }
      }
    ]
  }
}

mediaClosedCaptioningOff

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

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

mediaClosedCaptioningOn

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

בקשה
{
  "requestId": "6894439706274654520",
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "123"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.mediaClosedCaptioningOn",
                "params": {
                  "closedCaptioningLanguage": "en"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654520",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "online": true,
          "playbackState": "PLAYING"
        }
      }
    ]
  }
}

mediaNext

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

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

mediaPause

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

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

mediaPrevious

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

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

mediaResume

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

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

mediaStop

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

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

מכשיר ERRORS

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