Switch
1.Switch.getState
Get Current State
| Param | Value | Desc | 
|---|---|---|
| method | Switch.getState | Get Current State | 
| targetDevice | <String,Necessary> | DeviceId of the Switch you use; | 
| token | <String,Necessary> | Net token of the Switch you use; | 
| Param | Value | Desc | 
|---|---|---|
| data.state | <String,Necessary> | State of device,["closed","open"]; | 
| data.delay.on | <Integer,Necessary> | The remain time of Delay ON;Unit of minute;0 is OFF | 
| data.delay.off | <Integer,Necessary> | The remain time of Delay OFF;Unit of minute;0 is OFF | 
| data.version | <String,Necessary> | Firmware Version of device | 
| data.tz | <Integer,Necessary> | Timezone of device. -12 ~ 12 | 
2.Switch.setState
Set Switch's State
| Param | Value | Desc | 
|---|---|---|
| method | Switch.setState | Set Switch's State | 
| targetDevice | <String,Necessary> | DeviceId of the Switch you use; | 
| token | <String,Necessary> | Net token of the Switch you use; | 
| params.state | <String,Necessary> | Set state of device.["close","open"]; | 
| Param | Value | Desc | 
|---|---|---|
| data.state | <String,Necessary> | State of device,["closed","open"]; | 
3.Switch.setDelay
Delay to turn on Switch.
| Param | Value | Desc | 
|---|---|---|
| method | Switch.setDelay | Delay to turn on Switch. | 
| targetDevice | <String,Necessary> | DeviceId of the Switch you use; | 
| token | <String,Necessary> | Net token of the Switch you use; | 
| params.delayOn | <Integer,Optional> | The time you want to Delay ON;Unit of minute;0 is cancel delay; | 
| params.delayOff | <Integer,Optional> | The time you want to Delay OFF;Unit of minute;0 is cancel delay; | 
| data.delay.on | <Integer,Necessary> |The remain time of Delay ON;Unit of minute;0 is OFF | | data.delay.off | <Integer,Necessary> |The remain time of Delay OFF;Unit of minute;0 is OFF |
4.Switch.getSchedules
Get Schedule List
| Param | Value | Desc | 
|---|---|---|
| method | Switch.getSchedules | Get Schedule List. | 
| targetDevice | <String,Necessary> | DeviceId of the Switch you use; | 
| token | <String,Necessary> | Net token of the Switch you use; | 
| Param | Value | Desc | 
|---|---|---|
| data[index].isValid | <Boolean,Necessary> | Enabled/Disabled ; | 
| data[index].index | <Integer,Necessary> | Index of this record ; | 
| data[index].on | <String,Optional> | Time to turn on; HH:mm | 
| data[index].off | <String,Optional> | Time to turn off; HH:mm | 
| data[index].week | <Integer,Necessary> | mask of effected days(Sunday to Saturday) | 
5.Switch.setSchedules
Set Schedule
| Param | Value | Desc | 
|---|---|---|
| method | Switch.setSchedules | Set Schedule. | 
| targetDevice | <String,Necessary> | DeviceId of the Switch you use; | 
| token | <String,Necessary> | Net token of the Switch you use; | 
| params.sches | <Array<Schedule> | Map<int,Schedule>,Necessary> | 
| params.sches[index].isValid | <Boolean,Necessary> | Enabled/Disabled ; | 
| params.sches[index].index | <Integer,Necessary> | Index of this record ; | 
| params.sches[index].on | <String,Necessary> | Time to turn on; HH:mm | 
| params.sches[index].off | <String,Necessary> | Time to turn off; HH:mm | 
| params.sches[index].week | <Integer,Necessary> | mask of effected days(Sunday to Saturday) | 
index from "0" to "5"
Same as Switch.getSchedules
6.Switch.getVersion
Get firmware info
| Param | Value | Desc | 
|---|---|---|
| method | Switch.getVersion | Get firmware info; | 
| targetDevice | <String,Necessary> | DeviceId of this device; | 
| token | <String,Necessary> | Net Token of this device; | 
| Param | Value | Desc | 
|---|---|---|
| data.version | <String,Necessary> | Current Version; | 
| data.newVersion.versionId | <String,Optional> | Id of the newest version; | 
| data.newVersion.versionCode | <String,Optional> | Code of the newest version; | 
| data.newVersion.fileSize | <String,Optional> | File Size of the newest version; | 
7.Switch.setDeviceAttributes
Set device's attributes
| Param | Value | Desc | 
|---|---|---|
| method | Switch.setDeviceAttributes | Set device's attributes | 
| targetDevice | <String,Necessary> | DeviceId of this device; | 
| token | <String,Necessary> | Net Token of this device; | 
| params.led.status | <String,Optional> | Status LED ["on","off"]; | 
| Param | Value | Desc | 
|---|---|---|
| data.led.status | <String,Necessary> | Status LED ["on","off"]; | 
8.Switch.startUpgrade
Start Upgrade
| Param | Value | Desc | 
|---|---|---|
| method | Switch.startUpgrade | Start Upgrade | 
| targetDevice | <String,Necessary> | DeviceId of this device; | 
| token | <String,Necessary> | Net Token of this device; | 
| params.versionId | <String,Necessary> | Version Id you want to upgrade; | 
| Param | Value | Desc | 
|---|---|---|
| data.isStarted | <Boolean,Necessary> | Is upgrading started; | 
9.Switch.getActivityLogs
Used to retrieve device activity records through search parameters or retrieval key.
caution
"DEVICE.HISTORICAL_DATA.READ" permission is required to access this interface
| Param | Value | Desc | 
|---|---|---|
| method | Switch.getActivityLogs | Get device's activity records | 
| targetDevice | <String,Necessary> | DeviceId of the device you use; | 
| token | <String,Necessary> | Net token of the device you use; You can get it here | 
| params.search | <Object,Optional> | Retrieve records through search parameters. | 
| params.search.startDate | <String,Necessary> | Specify the start date of the search scope, with "YYYY-MM-DD" formatted | 
| params.search.endDate | <String,Necessary> | Specify the end date of the search scope, with "YYYY-MM-DD" formatted | 
| params.retrievalKey | <string,Optional> | Retrieve records through retrieval key. | 
| Param | Value | Desc | 
|---|---|---|
| data.logs | <Array,Necessary> | Records of device activity logs | 
| data.logs[*].id | <Array,Necessary> | Id of record | 
| data.logs[*].time | <Date,Necessary> | Time of record | 
| data.logs[*].data | <Object,Necessary> | Data of record | 
| data.retrievalKeys | <Object,Optional> | When search results are not fully returned in this data packet, retrieval keys will be provided for retrieving other results. | 
| data.retrievalKeys.next | <Object,Necessary> | It indicates that there is more data available and can be retrieved through this key. | 
10.Callbacks
You can receive it with Http Callback API or MQTT report topic
<Same as 1.Switch.getState>