מדריך לרמקולים חכמים לבית
action.devices.types.SPEAKER
– המכשיר הזה הוא רמקול מחובר שלא מפצל אודיו לערוצים נפרדים (לדוגמה, בין שני מכשירים שמאליים וימניים).
הסוג הזה מציין שהמכשיר מקבל את סמל הרמקול וכמה מילים נרדפות וכינויים קשורים.
היכולות של המכשיר
עיינו במסמכי התיעוד של התכונה המתאימה לקבלת פרטים על ההטמעה, כמו המאפיינים והמצבים שבהם השירות צריך לתמוך, והסבר על בניית תשובות EXECUTE ו-QUERY.
התכונות הנדרשות
המאפיינים והפקודות האלה נדרשים, אם הם רלוונטיים למכשיר שלכם. אם המכשיר לא תומך בתכונות האלה, מזינים את קוד השגיאה functionNotSupported
בתשובה QUERY או EXECUTE. מידע נוסף זמין במאמר שגיאות וחריגים.
-
action.devices.traits.MediaState
-
action.devices.traits.OnOff
-
action.devices.traits.TransportControl
-
action.devices.traits.Volume
תכונות מומלצות
מומלץ להשתמש בתכונות האלה, אם הן רלוונטיות למכשיר שלך. עם זאת, אתם יכולים לשלב בין כל התכונות הזמינות ולהתאים אותן בצורה הטובה ביותר לפונקציונליות הקיימת של המוצר.
דרישות איכות
- זמן האחזור: הערך חייב להיות קטן מ-3,000 אלפיות השנייה.
- אמינות: חייבת להיות שווה ל-97%.
מכשיר לדוגמה: רמקול פשוט
בקטע הזה מפורטים מטענים ייעודיים לדוגמה שמייצגים "רמקול" משותף, בהתאם לסוג המכשיר ולתכונות שלמעלה. אם מוסיפים או מסירים תכונות, משנים את התשובות בהתאם בהתאם לשינויים.
דוגמה לתגובת 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 לדוגמה
מצב כבוי
למידע נוסף על הפרמטרים של הפקודות, אפשר לעיין במאמר
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" } } ] } }
הפעלת מדיה
למידע נוסף על הפרמטרים של הפקודות, אפשר לעיין במאמר
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" } } ] } }
mediaהקודם
למידע נוסף על הפרמטרים של הפקודות, אפשר לעיין במאמר
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" } } ] } }
עצירת מדיה
למידע נוסף על הפרמטרים של הפקודות, אפשר לעיין במאמר
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" } } ] } }