スマートホーム シャッター ガイド
action.devices.types.SHUTTER - シャッターは開閉可能で、場合によっては複数の方向に開閉することもできます。一部のシャッターには、回転可能なスラットがあります。
このタイプのデバイスにはシャッターのアイコンが設定され、関連する類義語や別名が与えられます。
デバイスの機能
サービスがサポートする必要がある属性や状態、EXECUTE レスポンスと QUERY レスポンスの作成方法など、実装の詳細については、対応するトレイトのドキュメントを参照してください。
必須のトレイト
これらの特性とコマンドは、デバイスに該当する場合に必要です。デバイスがこれらの特性をサポートしていない場合は、QUERY または EXECUTE レスポンスで functionNotSupported のエラーコードを入力します。詳しくは、エラーと例外をご覧ください。
推奨トレイト
これらのトレイトは、デバイスに適用できる場合は推奨されます。ただし、利用可能なすべてのトレイトの中から、既存の製品機能に最適な組み合わせを自由に選択できます。
デバイスの例: シンプル シャッター
このセクションでは、上記のデバイスタイプとトレイトに基づく一般的な「シャッター」を表すインテント ペイロードの例を示します。実装で特性を追加または削除する場合は、それらの変更を反映するようにレスポンスを適宜変更します。
SYNC レスポンスの例
{
"requestId": "6894439706274654512",
"inputs": [
{
"intent": "action.devices.SYNC"
}
]
}{ "requestId": "6894439706274654512", "payload": { "agentUserId": "user123", "devices": [ { "id": "123", "type": "action.devices.types.SHUTTER", "traits": [ "action.devices.traits.OpenClose", "action.devices.traits.Rotation" ], "name": { "name": "Simple shutter" }, "willReportState": true, "attributes": { "openDirection": [ "UP", "DOWN" ], "supportsDegrees": false, "supportsPercent": 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, "openState": [ { "openPercent": 30, "openDirection": "DOWN" }, { "openPercent": 50, "openDirection": "UP" } ], "rotationPercent": 30 } } } }
EXECUTE コマンドの例
OpenClose
コマンド パラメータの詳細については、
action.devices.traits.OpenClose リファレンスをご覧ください。
{ "requestId": "6894439706274654516", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.OpenClose", "params": { "openPercent": 10, "openDirection": "DOWN" } } ] } ] } } ] }
{ "requestId": "6894439706274654516", "payload": { "commands": [ { "ids": [ "123" ], "status": "PENDING", "states": { "online": true, "openState": [ { "openPercent": 10, "openDirection": "DOWN" }, { "openPercent": 50, "openDirection": "UP" } ] } } ] } }
OpenCloseRelative
コマンド パラメータの詳細については、
action.devices.traits.OpenClose リファレンスをご覧ください。
{ "requestId": "6894439706274654518", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.OpenCloseRelative", "params": { "openRelativePercent": 10, "openDirection": "DOWN" } } ] } ] } } ] }
{ "requestId": "6894439706274654518", "payload": { "commands": [ { "ids": [ "123" ], "status": "PENDING", "states": { "online": true, "openState": [ { "openPercent": 40, "openDirection": "DOWN" }, { "openPercent": 50, "openDirection": "UP" } ] } } ] } }
RotateAbsolute
コマンド パラメータの詳細については、
action.devices.traits.Rotation リファレンスをご覧ください。
{ "requestId": "6894439706274654520", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.RotateAbsolute", "params": { "rotationPercent": 50 } } ] } ] } } ] }
{ "requestId": "6894439706274654520", "payload": { "commands": [ { "ids": [ "123" ], "status": "PENDING", "states": { "online": true, "rotationPercent": 50 } } ] } }