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

action.devices.types.AUDIO_VIDEO_RECEIVER – מכשיר שמקבל קלט אודיו (לדוגמה, HDMI, אופטי ו-RCA) ומפיק צליל לרמקול אחד או יותר.

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

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

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

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

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

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

דרישות איכות

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

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

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

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

בקשה
{
  "requestId": "6894439706274654512",
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ]
}
תשובה
{
  "requestId": "6894439706274654512",
  "payload": {
    "agentUserId": "user123",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.AUDIO_VIDEO_RECEIVER",
        "traits": [
          "action.devices.traits.AppSelector",
          "action.devices.traits.InputSelector",
          "action.devices.traits.MediaState",
          "action.devices.traits.OnOff",
          "action.devices.traits.TransportControl",
          "action.devices.traits.Volume"
        ],
        "name": {
          "name": "Simple audio video receiver"
        },
        "willReportState": true,
        "attributes": {
          "transportControlSupportedCommands": [
            "NEXT",
            "PREVIOUS",
            "PAUSE",
            "STOP",
            "RESUME",
            "CAPTION_CONTROL"
          ],
          "volumeMaxLevel": 11,
          "volumeCanMuteAndUnmute": true,
          "availableApplications": [
            {
              "key": "youtube",
              "names": [
                {
                  "name_synonym": [
                    "Youtube",
                    "Youtube_en"
                  ],
                  "lang": "en"
                }
              ]
            }
          ],
          "availableInputs": [
            {
              "key": "hdmi_1",
              "names": [
                {
                  "name_synonym": [
                    "HDMI 1",
                    "DVD Player"
                  ],
                  "lang": "en"
                }
              ]
            },
            {
              "key": "hdmi_2",
              "names": [
                {
                  "name_synonym": [
                    "HDMI 2",
                    "TV"
                  ],
                  "lang": "en"
                }
              ]
            }
          ]
        },
        "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,
        "currentApplication": "youtube",
        "currentInput": "hdmi_1",
        "currentVolume": 10,
        "isMuted": false,
        "activityState": "ACTIVE",
        "playbackState": "PAUSED"
      }
    }
  }
}

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

appInstall

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

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

appSearch

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

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

appSelect

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

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

SetInput

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

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

PreviousInput

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

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

NextInput

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

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

OnOff

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

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

mediaClosedCaptioningOff

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

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

mediaClosedCaptioningOn

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

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

mediaNext

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

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

mediaPause

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

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

mediaPrevious

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

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

mediaResume

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

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

mediaStop

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

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

השתקה

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

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

setVolume

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

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

מכשיר ERRORS

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