מדריך לממטרה לבית חכם
action.devices.types.SPRINKLER – אפשר להפעיל או להפסיק את הממטרות. יכול להיות שהם גם תומכים בטיימרים או בלוחות זמנים.
הסוג הזה מציין שהמכשיר מקבל את סמל הממטרה וכמה מילים נרדפות וכינויים שקשורים אליו.
יכולות המכשיר
בתיעוד של התכונה המתאימה מפורטים פרטים על ההטמעה, כמו מאפיינים ומצבים שהשירות שלכם צריך לתמוך בהם, ואיך ליצור תגובות מסוג EXECUTE ו-QUERY.
מאפיינים נדרשים
התכונות והפקודות האלה נדרשות, אם הן רלוונטיות למכשיר שלכם. אם המכשיר לא תומך בתכונות האלה, צריך להזין את קוד השגיאה
functionNotSupported בתגובה של QUERY או EXECUTE. מידע נוסף זמין במאמר שגיאות וחריגים.
תכונות מומלצות
התכונות האלה מומלצות, אם הן רלוונטיות למכשיר שלכם. עם זאת, אתם יכולים לשלב בין כל התכונות הזמינות כדי להתאים אותן בצורה הטובה ביותר לפונקציונליות הקיימת של המוצר.
דוגמה למכשיר: ממטרה פשוטה
בקטע הזה מופיעות דוגמאות למטענים ייעודיים (payloads) של כוונות שמייצגים 'ממטרה' נפוצה, על סמך סוג המכשיר והמאפיינים שצוינו למעלה. אם מוסיפים או מסירים מאפיינים בהטמעה, צריך לשנות את התגובות בהתאם כדי לשקף את השינויים האלה.
דוגמה לתגובת סנכרון
{
"requestId": "6894439706274654512",
"inputs": [
{
"intent": "action.devices.SYNC"
}
]
}{ "requestId": "6894439706274654512", "payload": { "agentUserId": "user123", "devices": [ { "id": "123", "type": "action.devices.types.SPRINKLER", "traits": [ "action.devices.traits.Timer", "action.devices.traits.StartStop" ], "name": { "name": "Simple sprinkler" }, "willReportState": true, "attributes": { "availableZones": [ "front", "back" ], "maxTimerLimitSec": 3600 }, "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, "activeZones": [ "front" ], "timerRemainingSec": 300 } } } }
דוגמאות לפקודות EXECUTE
TimerStart
פרטים נוספים על פרמטרים של פקודות זמינים במאמר בנושא
action.devices.traits.Timer.
{ "requestId": "6894439706274654518", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.TimerStart", "params": { "timerTimeSec": 300 } } ] } ] } } ] }
{ "requestId": "6894439706274654518", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "timerRemainingSec": 300 } } ] } }
TimerAdjust
פרטים נוספים על פרמטרים של פקודות זמינים במאמר בנושא
action.devices.traits.Timer.
{ "requestId": "6894439706274654520", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.TimerAdjust", "params": { "timerTimeSec": -10 } } ] } ] } } ] }
{ "requestId": "6894439706274654520", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "timerRemainingSec": 290 } } ] } }
TimerPause
פרטים נוספים על פרמטרים של פקודות זמינים במאמר בנושא
action.devices.traits.Timer.
{ "requestId": "6894439706274654522", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.TimerPause" } ] } ] } } ] }
{ "requestId": "6894439706274654522", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "timerRemainingSec": 300, "timerPaused": true } } ] } }
TimerResume
פרטים נוספים על פרמטרים של פקודות זמינים במאמר בנושא
action.devices.traits.Timer.
{ "requestId": "6894439706274654524", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.TimerResume" } ] } ] } } ] }
{ "requestId": "6894439706274654524", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "timerRemainingSec": 300, "timerPaused": false } } ] } }
TimerCancel
פרטים נוספים על פרמטרים של פקודות זמינים במאמר בנושא
action.devices.traits.Timer.
{ "requestId": "6894439706274654526", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.TimerCancel" } ] } ] } } ] }
{ "requestId": "6894439706274654526", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "timerRemainingSec": -1 } } ] } }
StartStop
פרטים נוספים על פרמטרים של פקודות זמינים במאמר בנושא
action.devices.traits.StartStop.
{ "requestId": "6894439706274654516", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.StartStop", "params": { "start": true, "zone": "back" } } ] } ] } } ] }
{ "requestId": "6894439706274654516", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "isRunning": true, "activeZones": [ "back" ] } } ] } }