Przewodnik po inteligentnych wannach
action.devices.types.BATHTUB – wanny można napełniać i opróżniać, być może do określonego poziomu, jeśli wanna to umożliwia.
Ten typ oznacza, że urządzenie otrzymuje ikonę wanny oraz powiązane synonimy i aliasy.
Funkcje urządzenia
Szczegóły implementacji, takie jak atrybuty i stany, które powinna obsługiwać Twoja usługa, oraz sposób tworzenia odpowiedzi EXECUTE i QUERY, znajdziesz w dokumentacji odpowiedniego cechy.
Zalecane cechy
Te cechy są zalecane, jeśli mają zastosowanie do Twojego urządzenia. Możesz jednak dowolnie łączyć wszystkie dostępne atrybuty, aby jak najlepiej dopasować je do istniejących funkcji produktu.
Przykładowe urządzenie: prosta wanna
Ta sekcja zawiera przykładowe ładunki intencji reprezentujące typowy „Bathtub” na podstawie typu urządzenia i cech wymienionych powyżej. Jeśli dodasz lub usuniesz cechy w swojej implementacji, odpowiednio zmodyfikuj odpowiedzi, aby odzwierciedlały te zmiany.
Przykładowa odpowiedź SYNC
{
"requestId": "6894439706274654512",
"inputs": [
{
"intent": "action.devices.SYNC"
}
]
}{ "requestId": "6894439706274654512", "payload": { "agentUserId": "user123", "devices": [ { "id": "123", "type": "action.devices.types.BATHTUB", "traits": [ "action.devices.traits.Fill", "action.devices.traits.TemperatureControl", "action.devices.traits.OnOff", "action.devices.traits.StartStop" ], "name": { "name": "Simple bathtub" }, "willReportState": true, "attributes": { "availableFillLevels": { "levels": [ { "level_name": "half_key", "level_values": [ { "level_synonym": [ "Half", "Halfway", "One half" ], "lang": "en" } ] } ], "ordered": false }, "temperatureRange": { "minThresholdCelsius": 25, "maxThresholdCelsius": 100 }, "temperatureUnitForUX": "F" }, "deviceInfo": { "manufacturer": "smart-home-inc", "model": "hs1234", "hwVersion": "3.2", "swVersion": "11.4" } } ] } }
Przykładowa odpowiedź na zapytanie
{ "requestId": "6894439706274654514", "inputs": [ { "intent": "action.devices.QUERY", "payload": { "devices": [ { "id": "123" } ] } } ] }
{ "requestId": "6894439706274654514", "payload": { "devices": { "123": { "status": "SUCCESS", "online": true, "on": false, "currentFillLevel": "half_key", "isFilled": true, "temperatureSetpointCelsius": 30, "isRunning": true, "isPaused": false } } } }
Przykładowe polecenia EXECUTE
Wypełnienie
Więcej informacji o parametrach polecenia znajdziesz w
action.devices.traits.Fill.
{ "requestId": "6894439706274654516", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.Fill", "params": { "fill": true, "fillLevel": "half_key" } } ] } ] } } ] }
{ "requestId": "6894439706274654516", "payload": { "commands": [ { "ids": [ "123" ], "status": "PENDING", "states": { "online": true, "on": true, "currentFillLevel": "half_key" } } ] } }
SetTemperature
Więcej informacji o parametrach polecenia znajdziesz w
action.devices.traits.TemperatureControl.
{ "requestId": "6894439706274654520", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.SetTemperature", "params": { "temperature": 40 } } ] } ] } } ] }
{ "requestId": "6894439706274654520", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "temperatureSetpointCelsius": 40 } } ] } }
OnOff
Więcej informacji o parametrach polecenia znajdziesz w
action.devices.traits.OnOff.
{ "requestId": "6894439706274654518", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.OnOff", "params": { "on": true } } ] } ] } } ] }
{ "requestId": "6894439706274654518", "payload": { "commands": [ { "ids": [ "123" ], "status": "SUCCESS", "states": { "online": true, "on": true } } ] } }
StartStop
Więcej informacji o parametrach polecenia znajdziesz w
action.devices.traits.StartStop.
{ "requestId": "6894439706274654522", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.StartStop", "params": { "start": true } } ] } ] } } ] }
{ "requestId": "6894439706274654522", "payload": { "commands": [ { "ids": [ "123" ], "status": "PENDING", "states": { "online": true, "isRunning": true, "isPaused": false } } ] } }
PauseUnpause
Więcej informacji o parametrach polecenia znajdziesz w
action.devices.traits.StartStop.
{ "requestId": "6894439706274654524", "inputs": [ { "intent": "action.devices.EXECUTE", "payload": { "commands": [ { "devices": [ { "id": "123" } ], "execution": [ { "command": "action.devices.commands.PauseUnpause", "params": { "pause": true } } ] } ] } } ] }
{ "requestId": "6894439706274654524", "payload": { "commands": [ { "ids": [ "123" ], "status": "PENDING", "states": { "online": true, "isRunning": false, "isPaused": true } } ] } }