smarthome - blockdate/ios-rn-sdk GitHub Wiki

miot/service/smarthome

智能家庭 API

Export:

miot/service/smarthome.getUserInfo(uid) ⇒ Promise.<json>

获取用户的昵称和头像信息

Kind: static method of miot/service/smarthome

Param Type Description
uid * 获取用户信息的uid

miot/service/smarthome.reportGPSInfo(deviceID, gpsInfo) ⇒ Promise.<json>

上报gps信息 /location/set

Kind: static method of miot/service/smarthome

Param Type
deviceID string
gpsInfo GPSInfo

miot/service/smarthome.getWeatherInfo(deviceID) ⇒ Promise.<WeatherInfo>

获取天气 /location/weather

Kind: static method of miot/service/smarthome

Param Type
deviceID string

miot/service/smarthome.checkDeviceVersion(did, pid) ⇒ Promise.<DeviceVersion>

检查硬件版本信息 /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))

miot/service/smarthome.getAreaPropInfo(params) ⇒ Promise

获取某指定地区天气环境等信息 /location/area_prop_info

Kind: static method of miot/service/smarthome

Param Type Description
params json {latitude:xx,longitude:xx,cityId:['pm2.5','realtime']}

miot/service/smarthome.getAvailableFirmwareForDids(deviceIDs) ⇒ Promise.<json>

检查到有可用更新时,可以主动更新固件。 /home/multi_checkversion

Kind: static method of miot/service/smarthome

Param Type
deviceIDs array.<string>

miot/service/smarthome.reportLog(model, log) ⇒ void

添加一条日志打点。
开发者应该在拓展程序内合适时机调用该接口,打点信息会自动写入文件,按 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(`...`)

miot/service/smarthome.reportRecords(deviceID, records)

上报设备数据 /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"}])

miot/service/smarthome.getDevicesConfig(params) ⇒ Promise.<json>

  • /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}

miot/service/smarthome.getDeviceTimeZone(did)

获取设备时区

Kind: static method of miot/service/smarthome

Param Type
did string

miot/service/smarthome.getVoiceVtrlDevices(deviceID) ⇒ Promise

获取支持语音的设备 可以控制的设备列表。 /voicectrl/ai_devs

Kind: static method of miot/service/smarthome

Param Description
deviceID 语音设备的 did

miot/service/smarthome.getAiServiceProxy(params) ⇒ Promise

获取小爱接口数据,内部调用米家代理接口/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()

miot/service/smarthome.getDeviceSetting(params) ⇒ Promise

获取服务器中 device 对应的数据,内部调用米家代理接口 /device/getsetting

Kind: static method of miot/service/smarthome

Param Type Description
params json 请求参数 {did:string,settings:array}

miot/service/smarthome.setDeviceSetting(params) ⇒ Promise

设置服务器中 device 对应的数据,内部调用米家代理接口/device/setsetting

Kind: static method of miot/service/smarthome

Param Type Description
params json 请求参数 {did:string,settings:map<key,value>}

miot/service/smarthome.delDeviceSetting(params) ⇒ Promise

删除服务器中 device 对应的数据,内部调用米家代理接口/device/delsetting

Kind: static method of miot/service/smarthome

Param Type Description
params json 请求参数 {did:设备 id,settings:要删除的设置角标的数组}

miot/service/smarthome.getLatestVersion(model) ⇒ Promise

获取服务器中 最新的版本信息,内部调用米家代理接口/home/latest_version

Kind: static method of miot/service/smarthome

Param Type Description
model string 设备的 model

miot/service/smarthome.getDeviceData(params) ⇒ Promise

获取设备属性和事件历史记录,订阅消息直接写入到服务器,不需要插件添加. /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前缀,起始时间单位为秒,结束事件单位为秒,请求的条数限制

miot/service/smarthome.setDeviceData(params) ⇒ Promise

添加设备属性和事件历史记录,/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前缀,触发时间,要保存的数据

miot/service/smarthome.getUserColl(params) ⇒ Promise

获取用户收藏 /user/get_user_coll

Kind: static method of miot/service/smarthome

Param Type Description
params * {did:string}

miot/service/smarthome.setUserColl(params) ⇒ Promise

设置用户收藏 /user/get_user_coll

Kind: static method of miot/service/smarthome

Param Type Description
params * {did:string, name: string, content: string}

miot/service/smarthome.delUserColl(params) ⇒ Promise

删除用户收藏 /user/get_user_coll

Kind: static method of miot/service/smarthome

Param Type Description
params * {coll_id: string, did: string}

miot/service/smarthome.getMapfileUrl(params) ⇒ Promise

添加设备属性和事件历史记录,/home/getmapfileurl

Kind: static method of miot/service/smarthome

Param Type
params json

miot/service/smarthome.getHomeDevice(params) ⇒ Promise

添加设备属性和事件历史记录,/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}

miot/service/smarthome.getAppConfigV2(params)

用于获取插件所需的一些默认配置信息

Kind: static method of miot/service/smarthome

Param Type Description
params json {'name':'自定义值','lang':'自定义值','version':'自定义值','model':'modelId'} /service/getappconfigv2

miot/service/smarthome.delUsermap(params) ⇒ Promise

/user/del_user_map

Kind: static method of miot/service/smarthome

Param Type
params json

miot/service/smarthome.getRobomapUrl(arams) ⇒ Promise

/home/getrobomapurl

Kind: static method of miot/service/smarthome

Param Type
arams *

miot/service/smarthome.getCountry(params) ⇒ Promise

获取设备所在网络的IP地址所属国家 /home/getcountry

Kind: static method of miot/service/smarthome

Param Type Description
params json {"dids": ["xx"]}

miot/service/smarthome.getBleLockBindInfo(params) ⇒ Promise

获取蓝牙锁绑定的时间,/device/blelockbindinfo

Kind: static method of miot/service/smarthome

Param Type Description
params json 参数{did}

miot/service/smarthome.batchGetDeviceProps(params) ⇒ Promise

从服务器批量获取设备属性,/device/batchdevicedatas

Kind: static method of miot/service/smarthome

Param Type Description
params json 参数 [{did:"",props:["prop.aaa","prop.bbb"]}]

miot/service/smarthome.getThirdConfig(params) ⇒ Promise

从服务器获取配置文件,/device/getThirdConfig

Kind: static method of miot/service/smarthome

Param Type Description
params json 参数 {"name":"config_version","version":1,"lang":"en","app_id":"XXX"}

miot/service/smarthome.callThirdPartyAPI(params) ⇒ Promise

异步调用第三方云接口 /third/api

Kind: static method of miot/service/smarthome

Param Type Description
params json 参数 {"app_id":"123","dids":["1","2"],"params":json}

miot/service/smarthome.getMiWatchConfig() ⇒ Promise

华米watch配置使用 Android not support yet

Kind: static method of miot/service/smarthome

miot/service/smarthome.getUserDeviceAuth(string}) ⇒ Promise

获取authCode来做鉴权

Kind: static method of miot/service/smarthome

Param Description
string} did 设备的 did

miot/service/smarthome~GPSInfo

Kind: inner typedef of miot/service/smarthome
Properties

Name Description
lng
lat
adminArea
countryCode
locality
thoroughfare
language zh_CN
subLocality

miot/service/smarthome~WeatherInfo

Kind: inner typedef of miot/service/smarthome
Properties

Name
city
city_id
pub_time
aqi
pm25
pm10
so2
no2
src
spot

miot/service/smarthome~DeviceVersion

设备固件版本信息

Kind: inner typedef of miot/service/smarthome
Properties

Name Type
isUpdating boolean
isLatest boolean
isForce boolean
hasNewFirmware boolean
curVersion string
newVersion string
description string
⚠️ **GitHub.com Fallback** ⚠️