smarthome - blockdate/ios-rn-sdk GitHub Wiki
智能家庭 API
Export:
-
miot/service/smarthome
-
static
-
.getUserInfo(uid) ⇒
Promise.<json> -
.reportGPSInfo(deviceID, gpsInfo) ⇒
Promise.<json> -
.getWeatherInfo(deviceID) ⇒
Promise.<WeatherInfo> -
.checkDeviceVersion(did, pid) ⇒
Promise.<DeviceVersion> -
.getAreaPropInfo(params) ⇒
Promise -
.getAvailableFirmwareForDids(deviceIDs) ⇒
Promise.<json> -
.reportLog(model, log) ⇒
void - .reportRecords(deviceID, records)
-
.getDevicesConfig(params) ⇒
Promise.<json> - .getDeviceTimeZone(did)
-
.getVoiceVtrlDevices(deviceID) ⇒
Promise -
.getAiServiceProxy(params) ⇒
Promise -
.getDeviceSetting(params) ⇒
Promise -
.setDeviceSetting(params) ⇒
Promise -
.delDeviceSetting(params) ⇒
Promise -
.getLatestVersion(model) ⇒
Promise -
.getDeviceData(params) ⇒
Promise -
.setDeviceData(params) ⇒
Promise -
.getUserColl(params) ⇒
Promise -
.setUserColl(params) ⇒
Promise -
.delUserColl(params) ⇒
Promise -
.getMapfileUrl(params) ⇒
Promise -
.getHomeDevice(params) ⇒
Promise - .getAppConfigV2(params)
-
.delUsermap(params) ⇒
Promise -
.getRobomapUrl(arams) ⇒
Promise -
.getCountry(params) ⇒
Promise -
.getBleLockBindInfo(params) ⇒
Promise -
.batchGetDeviceProps(params) ⇒
Promise -
.getThirdConfig(params) ⇒
Promise -
.callThirdPartyAPI(params) ⇒
Promise -
.getMiWatchConfig() ⇒
Promise -
.getUserDeviceAuth(string}) ⇒
Promise
-
.getUserInfo(uid) ⇒
- inner
-
static
获取用户的昵称和头像信息
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| uid | * |
获取用户信息的uid |
上报gps信息 /location/set
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| deviceID | string |
| gpsInfo | GPSInfo |
获取天气 /location/weather
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| deviceID | string |
检查硬件版本信息 /home/checkversion
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| did | string |
| pid | * |
Example
Device.getDeviceWifi().checkVersion()
.then(res => console.log('success:', res))
.catch(err => console.log('failed:', err))获取某指定地区天气环境等信息 /location/area_prop_info
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
{latitude:xx,longitude:xx,cityId:['pm2.5','realtime']} |
检查到有可用更新时,可以主动更新固件。 /home/multi_checkversion
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| deviceIDs | array.<string> |
添加一条日志打点。
开发者应该在拓展程序内合适时机调用该接口,打点信息会自动写入文件,按 Model 归类,即一个 Model 生成一个日志文件。
当用户反馈问题时,勾选 “同时上传日志”,则该 Model 的日志会跟随用户反馈上传,
开发者可在 IoT 平台查看用户反馈及下载对应日志文件。用户反馈查看入口:数据中心—用户反馈,如果看不到数据中心入口,联系自己所属企业管理员修改账号权限。
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| model | string |
要打 log 到哪个 model 下 |
| log | string |
具体的 log 数据 |
Example
Service.smarthome.reportLog("a.b.c", "hello");
Service.smarthome.reportLog(Device.model, `[info]test value is :${v1},${v2},${v3}`)
Package.isDebug&&Service.smarthome.reportLog(...)
Device.reportLog(`...`)上报设备数据 /device/event
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| deviceID | string |
|
| records | array.<map> |
[{type:string value of 'prop'、'event',key:string,value:string}] |
Example
Service.smarthome.reportRecords("deviceID", [{type:"prop",key:"b",value:"c"}])- /v2/device/range_get_extra_data
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
{did:string,prefix:string,limit:int,offset:int} |
获取设备时区
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| did | string |
获取支持语音的设备 可以控制的设备列表。 /voicectrl/ai_devs
Kind: static method of miot/service/smarthome
| Param | Description |
|---|---|
| deviceID | 语音设备的 did |
获取小爱接口数据,内部调用米家代理接口/v2/api/aivs
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
请求参数 {path:string,params:map,header:map,payload:map,env:int,req_method:string,req_header:map} |
Example
Service.smarthome.getAiServiceProxy({
path: "/api/aivs/xxx",
params: { did : "xx", client_id: "xx"},
header: { name : "xx"},
env: 1,
req_method: "POST",
req_header: {"Content-Type":"xx"}
}).then()获取服务器中 device 对应的数据,内部调用米家代理接口 /device/getsetting
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
请求参数 {did:string,settings:array} |
设置服务器中 device 对应的数据,内部调用米家代理接口/device/setsetting
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
请求参数 {did:string,settings:map<key,value>} |
删除服务器中 device 对应的数据,内部调用米家代理接口/device/delsetting
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
请求参数 {did:设备 id,settings:要删除的设置角标的数组} |
获取服务器中 最新的版本信息,内部调用米家代理接口/home/latest_version
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| model | string |
设备的 model |
获取设备属性和事件历史记录,订阅消息直接写入到服务器,不需要插件添加. /user/get_user_device_data
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
参数{did,type,key,time_start,time_end,limit}含义如下:设备did,属性为prop事件为event,属性名不需要prop或者event前缀,起始时间单位为秒,结束事件单位为秒,请求的条数限制 |
添加设备属性和事件历史记录,/user/set_user_device_data
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
参数{did,uid,type,key,time,value}含义如下:设备did,添加到哪个用户下,一般为 Device.ownerId,属性为prop事件为event,属性名不需要prop或者event前缀,触发时间,要保存的数据 |
获取用户收藏 /user/get_user_coll
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | * |
{did:string} |
设置用户收藏 /user/get_user_coll
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | * |
{did:string, name: string, content: string} |
删除用户收藏 /user/get_user_coll
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | * |
{coll_id: string, did: string} |
添加设备属性和事件历史记录,/home/getmapfileurl
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| params | json |
添加设备属性和事件历史记录,/home/device_list 当ssid和bssid均不为空时,表示同时搜索这个局域网内所有未被绑定过的设备
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
{pid:string ,ssid:string ,bssid:string ,localDidList:array,checkMoreWifi:bool,dids:array} |
用于获取插件所需的一些默认配置信息
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
{'name':'自定义值','lang':'自定义值','version':'自定义值','model':'modelId'} /service/getappconfigv2 |
/user/del_user_map
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| params | json |
/home/getrobomapurl
Kind: static method of miot/service/smarthome
| Param | Type |
|---|---|
| arams | * |
获取设备所在网络的IP地址所属国家 /home/getcountry
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
{"dids": ["xx"]} |
获取蓝牙锁绑定的时间,/device/blelockbindinfo
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
参数{did} |
从服务器批量获取设备属性,/device/batchdevicedatas
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
参数 [{did:"",props:["prop.aaa","prop.bbb"]}] |
从服务器获取配置文件,/device/getThirdConfig
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
参数 {"name":"config_version","version":1,"lang":"en","app_id":"XXX"} |
异步调用第三方云接口 /third/api
Kind: static method of miot/service/smarthome
| Param | Type | Description |
|---|---|---|
| params | json |
参数 {"app_id":"123","dids":["1","2"],"params":json} |
华米watch配置使用 Android not support yet
Kind: static method of miot/service/smarthome
获取authCode来做鉴权
Kind: static method of miot/service/smarthome
| Param | Description |
|---|---|
| string} | did 设备的 did |
Kind: inner typedef of miot/service/smarthome
Properties
| Name | Description |
|---|---|
| lng | |
| lat | |
| adminArea | |
| countryCode | |
| locality | |
| thoroughfare | |
| language | zh_CN |
| subLocality |
Kind: inner typedef of miot/service/smarthome
Properties
| Name |
|---|
| city |
| city_id |
| pub_time |
| aqi |
| pm25 |
| pm10 |
| so2 |
| no2 |
| src |
| spot |
设备固件版本信息
Kind: inner typedef of miot/service/smarthome
Properties
| Name | Type |
|---|---|
| isUpdating | boolean |
| isLatest | boolean |
| isForce | boolean |
| hasNewFirmware | boolean |
| curVersion | string |
| newVersion | string |
| description | string |