$appId
$appId :
App-Id 在开放平台申请: https://open.home.mi.com.
properties( $pid, string $voice = '') : array|mixed
读取属性 读取一个属性 : GET /api/v1/properties?pid=AAAD.1.1 读取多个属性:GET /api/v1/properties?pid=AAAD.1.1,AAAD.2.3 语音控制需要增加voice字段:GET /api/v1/properties?pid=AAAD.1.1,AAAD.2.3&voice={"recognition":"灯开了吗","semantics":"xxx"}.
$pid | ||
string | $voice |
subscript( $properties, $receiverUrl) : array|boolean|mixed
订阅属性变化 开始订阅: POST /api/v1/subscriptions Content-Type: application/json Content-Length: 134 * { "topic": "properties-changed", "properties": [ "AAAB.1.1", "AAAC.1.1", "AAAD.1.1", "AAAD.1.2" ], "receiver-url": "xxx" }.
订阅成功,应答如下: HTTP/1.1 207 Multi-Status Content-Type: application/json Content-Length: 156 { "expired": 36000, // 超时时间,单位为秒。 "properties": [ { "pid": "AAAB.1.1", "status": 0 }, { "pid": "AAAC.1.1", "status": -704002023 }, { "pid": "AAAD.1.1", "status": 0 } { "pid": "AAAD.1.2", "status": 705202023 } ] }
$properties | ||
$receiverUrl |
unSubscript( $properties) : array|boolean|mixed
退订属性变化 POST /api/v1/subscriptions Content-Type: application/json Content-Length: 134 * { "topic": "properties-changed", "properties": [ "AAAB.1.1", "AAAC.1.1", "AAAD.1.1", "AAAD.1.2" ], "receiver-url": "xxx" }.
退订成功,应答如下: HTTP/1.1 207 Multi-Status Content-Type: application/json Content-Length: 156 { "expired": 36000, // 超时时间,单位为秒。 "properties": [ { "pid": "AAAB.1.1", "status": 0 }, { "pid": "AAAC.1.1", "status": -704002023 }, { "pid": "AAAD.1.1", "status": 0 } { "pid": "AAAD.1.2", "status": 705202023 } ] }
$properties |
httpClient() : \MiotApi\Util\Request
获取http Client.