Skip to content

Latest commit

 

History

History
475 lines (373 loc) · 10.2 KB

ESPMeshAliyunApi_en.md

File metadata and controls

475 lines (373 loc) · 10.2 KB

[简体中文]

ESP-Mesh Aliyun Api

One: interface directory

  1. User login
  2. User logout
  3. Whether the user is logged in
  4. User login information
  5. Get aliyun binding device list
  6. Discovery a list of local config network devices
  7. Stop discovery local device
  8. Device binding
  9. Device unbind
  10. Get device status
  11. Get device properties
  12. Set device properties
  13. Query upgrade device information list
  14. Upgrade wi-fi device
  15. Device upgrade progress query
  16. Query the list of device information being upgraded
  17. Users bind taobao Id
  18. Query the user binding taobao Id
  19. User unbind taobao Id

Two: details of the interface

- (void)aliUserLogin;

Return method name: onAliUserLogin, Parameter format:

{"mobileLocationCode":"86","mobile":"13661215411","accountId":707374,"oauthInfoDict":{"SidExpiredTime":1650874674},"hasPassword":true,"openaccountInfoDict":{"mobile":"13661617154","enableDevice":"true","pwdVersion":0,"id":707374,"mobileLocationCode":"86","status":1,"domainId":8191367,"mobileConflictAccount":"false","subAccount":"false","hasPassword":"true"}}
- (void)aliUserLogout;

No return parameter

- (void)isAliUserLogin;

Return method name: onIsAliUserLogin, Parameter format:

{"isLogin":true}
- (void)getAliUserInfo;

Return method name: onGetAliUserInfo, Parameter format:

{"mobileLocationCode":"86","mobile":"13661215411","accountId":707374,"oauthInfoDict":{"SidExpiredTime":1650874674},"hasPassword":true,"openaccountInfoDict":{"mobile":"13661617154","enableDevice":"true","pwdVersion":0,"id":707374,"mobileLocationCode":"86","status":1,"domainId":8191367,"mobileConflictAccount":"false","subAccount":"false","hasPassword":"true"}}
- (void)getAliDeviceList;

Return method name: onGetAliyunDeviceList, Parameter format:

{
"data":[{
	"isEdgeGateway": false,
	"thingType": "DEVICE",
	"categoryImage": "http:\/\/iotx-paas-admin.oss-cn-shanghai.aliyuncs.com\/publish\/image\/1559630650729.png",
	"netType": "NET_WIFI",
	"nodeType": "GATEWAY",
	"gmtModified": 1565332471000,
	"productName": "乐鑫mesh_light001",
	"owned": 1,
	"productImage": "http:\/\/iotx-paas-admin.oss-cn-shanghai.aliyuncs.com\/publish\/image\/1526474600174.png",
	"identityId": "5051op63326c1491234567876ff4c90d303e284376089",
	"productModel": "001",
	"productKey": "a10BnLLzGv4",
	"deviceName": "test5",
	"identityAlias": "13661617154",
	"iotId": "SrFIr31Ou41234rtyjhUzw6000100",
	"status": 1
}]
"code":"200/401"
}

- (void)aliStartDiscovery;

Return method name: onAliStartDiscovery, Parameter format:

{
[]
}
- (void)aliStopDiscovery;

No return parameter

// message is the information waiting for the binding device to get,Format for {"productKey":"","deviceName":"","token":""}
- (void)aliDeviceBinding:(NSString *)message;

Return method name: onAliDeviceBind, Parameter format:

// Successful format onAliDeviceBind
{
"code":"8000",//8010:There are failure tips and reasons for failure,8011:There are failure tips and reasons for no failure
"iotId":""
"deviceInfo":{
	"productKey":"",
	"deviceName":"",
	"token":""
	}
}
// message is the iotId unbinding device,Format for ["iotId1","iotId2","iotId3".....]
- (void)aliDeviceUnbindRequest:(NSString *)message;

No return parameter

// message is the iotId of the device,Format for ["iotId1","iotId2","iotId3".....]
- (void)getAliDeviceStatus:(NSString *)message;

Return method name: onGetAliDeviceStatus, Parameter format:

[
	{ 	"status":1 ,
  		"time":1232341455,
  		"iotId": ""
	},
	{ 	"status":2 ,
  		"time":1232341466,
  		"iotId": ""
	},
	...
]

Explain: status represents the device life cycle, There are several status, 0:inactive; 1:online; 3:offline; 8:disable; time represents the start time of the current state.

// message is the iotId of the device, Format for ["iotId1","iotId2","iotId3".....]
- (void)getAliDeviceProperties:(NSString *)message;

Return method name: onGetAliDeviceProperties, Parameter format:

[
	{
      "_sys_device_mid": {
             "time": 1516356290173,
             "value": "example.demo.module-id"
             },
      "WorkMode": {
             "time": 1516347450295,
             "value": 0
             },
      "_sys_device_pid": {
             "time": 1516356290173,
             "value": "example.demo.partner-id"
             }
    },
	{
      "_sys_device_mid": {
             "time": 1516356290173,
             "value": "example.demo.module-id"
             },
      "WorkMode": {
             "time": 1516347450295,
             "value": 0
             },
      "_sys_device_pid": {
             "time": 1516356290173,
             "value": "example.demo.partner-id"
             },
      "iotId": ""
    },
	...
]
// message is the iotId of the device, Format for {"iotId":["iotId1","iotId2","iotId3".....],"properties":{"Brightness":90}}
- (void)setAliDeviceProperties:(NSString *)message;

Modify the color properties data format for:

{
"HSVColor":{"Hue":0,
             "Saturation":0,
             "Value":0
             }
}                             

Modify switch properties data format for:

//Shutdown
{"LightSwitch":0}
//open
{"LightSwitch":1}

Return method name: onSetAliDeviceProperties, Parameter format:

[
	{
      "_sys_device_mid": {
             "time": 1516356290173,
             "value": "example.demo.module-id"
             },
      "WorkMode": {
             "time": 1516347450295,
             "value": 0
             },
      "_sys_device_pid": {
             "time": 1516356290173,
             "value": "example.demo.partner-id"
             },
             "iotId": ""
    },
	{
      "_sys_device_mid": {
             "time": 1516356290173,
             "value": "example.demo.module-id"
             },
      "WorkMode": {
             "time": 1516347450295,
             "value": 0
             },
      "_sys_device_pid": {
             "time": 1516356290173,
             "value": "example.demo.partner-id"
             },
             "iotId": ""
    },
	...
]
- (void)getAliOTAUpgradeDeviceList;

Return method name: onGetAliOTAUpgradeDeviceList, Parameter format:

{
	"data": [{
		"status": 1,
		"netType": "NET_WIFI",
		"image": "http:\/\/iotx-paas-admin.oss-cn-shanghai.aliyuncs.com\/publish\/image\/1526474600174.png",
		"iotId": "SrFIr31Ou4123456345000100",
		"deviceName": "mesh_light"
	}],
	"code": "200"
}
// message is the iotId of the device, Format for ["iotId1","iotId2","iotId3".....]
- (void)aliUpgradeWifiDevice:(NSString *)message;

Return method name: onAliUpgradeWifiDevice, Parameter format:

{
	"data": "",
	"code": "200"
}
// message is the iotId of a device, Format for "iotId1"
- (void)aliQueryDeviceUpgradeStatus:(NSString *)message;

Return method name: onAliQueryDeviceUpgradeStatus, Parameter format:

{
	"data": {
		"otaFirmwareDTO": {
			"desc": "",
			"md5": "c632cb3b2db912345567493fec96f628e",
			"currentVersion": "1.1.0",
			"size": "1544032",
			"currentTimestamp": 1567689273000,
			"version": "0.1.1",
			"timestamp": 1568102959000,
			"name": "test2",
			"url": "https:\/\/iotx-ota.oss-cn-shanghai.aliyuncs.com\/ota\/5ee5b4366534b9f490ad0970e2d59e0f\/ck0dk0h6q0000246uc6mxq0mv.bin?Expires=1568709521&OSSAccessKeyId=cS8uRRy54RszYWna&Signature=qiN0qhy4SpG4BepqlRGUwxY4dRs%3D"
		},
		"otaUpgradeDTO": {
			"iotId": "SrFIr31234565678Uzw6000100",
			"success": false,
			"needConfirm": false,
			"upgradeStatus": 0,
			"startTime": 1568623115000,
			"step": 0,
			"desc": "waiting"
		}
	},
	"code": "200"
}
- (void)getAliOTAIsUpgradingDeviceList;

Return method name: onGetAliOTAIsUpgradingDeviceList, Parameter format:

{
	"data": [{
            "iotId": "xxxx",
            "step": 10,
            "desc": "xxxxxx",
            "success": false,
            "needConfirm": true,
            "upgradeStatus": 0
        },
        {
            "iotId": "xxxx",
            "step": 10,
            "desc": "xxxxxx",
            "success": false,
            "needConfirm": true,
            "upgradeStatus": 0
        }],
	"code": "200"
}
- (void)aliUserBindTaobaoId;

Return method name: onAliUserBindTaobaoId, Parameter format:

{
	"data": {
		"accountId": "2518246212",
		"accountType": "TAOBAO",
		"linkIdentityIds": [
			"50cbop901db40de4a**********f89728bf80584"
			]
	},
	"code": "200"
}
// Parameter message = {"accountType":"TAOBAO"}
- (void)getAliUserId:(NSString *)message;

Return method name: onGetAliUserId, Parameter format:

{
	"data": {
		"accountId": "795255212",
		"accountType": "TAOBAO",
		"linkIdentityIds": "50cbop901db40de4a**********f89728bf80584"
	},
	"accountType": "TAOBAO",
	"code": "200"
}
// Parameter message = {"accountType":"TAOBAO"}
- (void)aliUserUnbindId:(NSString *)message;

Return method name: onAliUserUnbindId,Parameter format:

{
	"data": {
		"message": "remove account link success!"
	},
	"accountType": "TAOBAO",
	"code": "200"
}