Skip to content

Latest commit

 

History

History
2828 lines (2247 loc) · 61.2 KB

API.md

File metadata and controls

2828 lines (2247 loc) · 61.2 KB

This is the document that I wish existed when I began tinkering with Kasa Smart devices.

anti_theft

Away Mode module.

add_rule / edit_rule

Adds/edits an Away Mode rule.

Request

{
	"anti_theft": {
		"edit_rule": {
			"id": "",
			"name": "",
			"enable": 1,
			"wday": [1, 1, 1, 1, 1, 1, 1],
			"stime_opt": 2,
			"soffset": 0,
			"smin": 0,
			"etime_opt": 0,
			"eoffset": 0,
			"emin": 0,
			"frequency": 5,
			"repeat": 1,
			"year": 2000,
			"month": 1,
			"day": 1,
			"force": 0,
			"duration": 2,
			"lastFor": 1
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the Away Mode rule to edit. Omitted in add_rule.
name string A user-specified name for the rule.
enable enum 0 = disable rule
1 = enable rule
wday array Weekdays on which the rule repeats. The first element corresponds to Sunday.
stime_opt enum 0 = rule begins at smin minutes past midnight
1 = rule begins at sunrise + soffset
2 = rule begins at sunset + soffset
smin integer The time of day at which the rule is to begin, in minutes past midnight. Omitted unless stime_opt is 0.
soffset integer The offset from sunrise/sunset at which the rule is to begin, in minutes. May be negative. Omitted if stime_opt is 0.
etime_opt enum 0 = rule ends at emin minutes past midnight
1 = rule ends at sunrise + eoffset
2 = rule ends at sunset + eoffset
emin integer The time of day at which the rule is to end, in minutes past midnight. Omitted unless etime_opt is 0.
eoffset integer The offset from sunrise/sunset at which the rule is to end, in minutes. May be negative. Omitted if etime_opt is 0.
frequency integer ??? Maybe the number of times to turn on the load during the rule interval?
repeat enum 0 = rule does not repeat
1 = rule repeats
year integer The four-digit year in which the rule is to begin. Omitted if repeat is 1.
month enum The month of the year in which the rule is to begin. Omitted if repeat is 1.
1 = January

12 = December
day integer The day of the month on which the rule is to begin, 1-31. Omitted if repeat is 1.
force enum ???
duration integer ??? Maybe the duration that the load is switched on, in minutes? Not returned from get_rules.
lastFor integer ??? Maybe the number of days that the rule runs for? Not returned from get_rules.

Response

{
	"anti_theft": {
		"add_rule": {
			"id": "",
			"err_code": 0
		}
	}
}
Parameter Type Description
id string A device-assigned identifier for the new rule. Omitted in the response to edit_rule.

delete_all_rules

Deletes all Away Mode rules.

Request

{
	"anti_theft": {
		"delete_all_rules": {}
	}
}

Response

{
	"anti_theft": {
		"delete_all_rules": {
			"err_code": 0
		}
	}
}

delete_rule

Deletes an Away Mode rule.

Request

{
	"anti_theft": {
		"delete_rule": {
			"id": ""
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the Away Mode rule to delete.

Response

{
	"anti_theft": {
		"delete_rule": {
			"err_code": 0
		}
	}
}

get_rules

Returns the configured Away Mode rules.

Request

{
	"anti_theft": {
		"get_rules": {}
	}
}

Response

{
	"anti_theft": {
		"get_rules": {
			"rule_list": [
				{
					"id": "",
					"name": "",
					"enable": 1,
					"wday": [1, 1, 1, 1, 1, 1, 1],
					"stime_opt": 2,
					"soffset": 0,
					"smin": 0,
					"etime_opt": 0,
					"eoffset": 0,
					"emin": 0,
					"frequency": 5,
					"repeat": 1,
					"year": 2000,
					"month": 1,
					"day": 1
				}
			],
			"version": 2,
			"enable": 1,
			"err_code": 0
		}
	}
}
Parameter Type Description
rule_list array A list of configured Away Mode rules.
id string The device-assigned identifier of an Away Mode rule.
name string The user-specified name of the rule.
enable enum 0 = rule is disabled
1 = rule is enabled
wday array Weekdays on which the rule repeats. The first element corresponds to Sunday.
stime_opt enum 0 = rule begins at smin minutes past midnight
1 = rule begins at sunrise + soffset
2 = rule begins at sunset + soffset
smin integer The time of day at which the rule begins, in minutes past midnight.
soffset integer The offset from sunrise/sunset at which the rule begins, in minutes. May be negative. Omitted if stime_opt is 0.
etime_opt enum 0 = rule ends at emin minutes past midnight
1 = rule ends at sunrise + eoffset
2 = rule ends at sunset + eoffset
emin integer The time of day at which the rule ends, in minutes past midnight.
eoffset integer The offset from sunrise/sunset at which the rule ends, in minutes. May be negative. Omitted if etime_opt is 0.
frequency integer ??? Maybe the number of times to turn on the load during the rule interval?
repeat enum 0 = rule does not repeat
1 = rule repeats
year integer The four-digit year in which the rule begins. Omitted if repeat is 1.
month enum The month of the year in which the rule begins. Omitted if repeat is 1.
1 = January

12 = December
day integer The day of the month on which the rule begins, 1-31. Omitted if repeat is 1.
version integer ???
enable enum 0 = Away Mode is disabled
1 = Away Mode is enabled

set_overall_enable

Enables or disables Away Mode.

Request

{
	"anti_theft": {
		"set_overall_enable": {
			"enable": 1
		}
	}
}
Parameter Type Description
enable enum 0 = disable Away Mode
1 = enable Away Mode

Response

{
	"anti_theft": {
		"set_overall_enable": {
			"err_code": 0
		}
	}
}

cnCloud

Cloud service module.

Note: This module is named smartlife.iot.common.cloud in some devices.

bind

Binds the device to the cloud service.

Request

{
	"cnCloud": {
		"bind": {
			"username": "",
			"password": ""
		}
	}
}
Parameter Type Description
username string The username of the TP-Link Kasa account to which to bind the device.
password string The password of the specified account.

Response

???

get_info

Returns the device's current cloud configuration.

Request

{
	"cnCloud": {
		"get_info": {}
	}
}

Response

{
	"cnCloud": {
		"get_info": {
			"username": "",
			"server": "n-devs.tplinkcloud.com",
			"binded": 0,
			"cld_connection": 0,
			"illegalType": 0,
			"stopConnect": 0,
			"tcspStatus": 0,
			"fwDlPage": "",
			"tcspInfo": "",
			"fwNotifyType": -1,
			"err_code": 0
		}
	}
}
Parameter Type Description
username string The username of the TP-Link Kasa account to which the device is bound.
server string The host name of the cloud service.
binded enum 0 = not bound
1 = bound
cld_connection enum ???
illegalType enum ???
stopConnect enum ???
tcspStatus enum ???
fwDlPage string ???
tcspInfo string ???
fwNotifyType enum ???

get_intl_fw_list

Returns a list of firmwares for the device from the cloud.

Request

{
	"cnCloud": {
		"get_intl_fw_list": {}
	}
}

Response

???

set_server_url

Specifies the URL of the cloud service.

Request

{
	"cnCloud": {
		"set_server_url": {
			"server": ""
		}
	}
}
Parameter Type Description
server string The URL of the cloud service.

Response

???

unbind

Unbinds the device from the cloud service.

Request

{
	"cnCloud": {
		"unbind": {}
	}
}

Response

???

count_down

Count-down timer module.

add_rule / edit_rule

Adds/edits a count-down timer rule.

Request

{
	"count_down": {
		"edit_rule": {
			"id": "",
			"name": "",
			"enable": 1,
			"delay": 60,
			"act": 1
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the count-down timer rule to edit. Omitted in add_rule.
name string A user-specified name for the rule.
enable enum 0 = disable rule
1 = enable rule
delay integer The initial count-down time, in seconds.
act enum Action to take when count-down timer lapses.
0 = turn off switch
1 = turn on switch

Response

{
	"count_down": {
		"add_rule": {
			"id": "",
			"err_code": 0
		}
	}
}
Parameter Type Description
id string A device-assigned identifier for the new rule. Omitted in the response to edit_rule.

delete_all_rules

Deletes all count-down timer rules.

Request

{
	"count_down": {
		"delete_all_rules": {}
	}
}

Response

{
	"count_down": {
		"delete_all_rules": {
			"err_code": 0
		}
	}
}

delete_rule

Deletes a count-down timer rule.

Request

{
	"count_down": {
		"delete_rule": {
			"id": ""
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the count-down timer rule to delete.

Response

{
	"count_down": {
		"delete_rule": {
			"err_code": 0
		}
	}
}

get_rules

Returns the configured count-down timer rules.

Request

{
	"count_down": {
		"get_rules": {}
	}
}

Response

{
	"count_down": {
		"get_rules": {
			"rule_list": [
				{
					"id": "",
					"name": "",
					"enable": 1,
					"delay": 60,
					"act": 1,
					"remain": 42
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
rule_list array A list of configured count-down timer rules.
id string The device-assigned identifier of a count-down timer rule.
name string The user-specified name of the rule.
enable enum 0 = rule is disabled
1 = rule is enabled
delay integer The initial count-down time, in seconds.
act enum Action to take when count-down timer lapses.
0 = turn off switch
1 = turn on switch
remain integer The count-down time remaining, in seconds.

emeter

Energy meter module.

Note: This module is named smartlife.iot.common.emeter in some devices.

erase_emeter_stat

Erases all historical energy consumption records.

Request

{
	"emeter": {
		"erase_emeter_stat": {}
	}
}

Response

{
	"emeter": {
		"erase_emeter_stat": {
			"err_code": 0
		}
	}
}

get_realtime

Returns instantaneous power consumption readings.

Request

{
	"emeter": {
		"get_realtime": {}
	}
}

Response

{
	"emeter": {
		"get_realtime": {
			"current_ma": 0,
			"voltage_mv": 120000,
			"power_mw": 0,
			"total_wh": 0,
			"err_code": 0
		}
	}
}
Parameter Type Description
current_ma integer The instantaneous current reading, in milliamps.
voltage_mv integer The instantaneous voltage reading, in millivolts.
power_mw integer The instantaneous power reading, in milliwatts.
total_wh integer The cumulative energy consumption, in watt-hours.

get_daystat

Returns historical energy consumption per day in a specified year and month.

Request

{
	"emeter": {
		"get_daystat": {
			"year": 2000,
			"month": 1
		}
	}
}
Parameter Type Description
year integer The four-digit year from which to return historical energy consumption.
month enum The month from which to return historical energy consumption.
1 = January

12 = December

Response

{
	"emeter": {
		"get_daystat": {
			"day_list": [
				{
					"year": 2000,
					"month": 1,
					"day": 1,
					"energy_wh": 42
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
day_list array A list of per-day historical energy consumption records.
year integer The four-digit year of an energy consumption record.
month enum The month of an energy consumption record.
1 = January

12 = December
day integer The day of the month of an energy consumption record, 1-31.
energy_wh integer The historical energy consumption recorded on the indicated day, in watt-hours.

get_monthstat

Returns historical energy consumption per month in a specified year.

Request

{
	"emeter": {
		"get_monthstat": {
			"year": 2000
		}
	}
}
Parameter Type Description
year integer The four-digit year from which to return historical energy consumption.

Response

{
	"emeter": {
		"get_monthstat": {
			"month_list": [
				{
					"year": 2000,
					"month": 1,
					"energy_wh": 4269
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
month_list array A list of per-month historical energy consumption records.
year integer The four-digit year of an energy consumption record.
month enum The month of an energy consumption record.
1 = January

12 = December
energy_wh integer The historical energy consumption recorded in the indicated month, in watt-hours.

netif

Network interface module.

Note: This module is named smartlife.iot.common.softaponboarding in some devices.

get_scaninfo

Returns a survey of Wi-Fi networks visible to the device.

Request

{
	"netif": {
		"get_scaninfo": {
			"refresh": 1
		}
	}
}
Parameter Type Description
refresh enum 0 = return previously cached results
1 = perform fresh scan

Response

{
	"netif": {
		"get_scaninfo": {
			"ap_list": [
				{
					"ssid": "",
					"key_type": 3,
					"rssi": -42
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
ap_list array A list of Wi-Fi networks visible to the device.
ssid string The SSID of a visible Wi-Fi network.
key_type enum 0 = open network
3 = WPA2 Personal
rssi integer Received signal strength of the Wi-Fi network, in dBm.
Not all devices report this.

get_stainfo

Returns the Wi-Fi station configuration.

Request

{
	"netif": {
		"get_stainfo": {}
	}
}

Response

{
	"netif": {
		"get_stainfo": {
			"ssid": "",
			"key_type": 3,
			"rssi": -42,
			"err_code": 0
		}
	}
}
Parameter Type Description
ssid string The SSID of the Wi-Fi network.
key_type enum 0 = open network
3 = WPA2 Personal
rssi integer Received signal strength of the Wi-Fi network, in dBm.

set_stainfo

Specifies the SSID and passphrase of the Wi-Fi network to which the device should connect.

Request

{
	"netif": {
		"set_stainfo": {
			"ssid": "",
			"password": "",
			"key_type": 3
		}
	}
}
Parameter Type Description
ssid string The SSID of the Wi-Fi network.
password string The passphrase of the Wi-Fi network.
key_type enum 0 = open network
3 = WPA2 Personal

Response

{
	"netif": {
		"set_stainfo": {
			"err_code": 0
		}
	}
}

schedule

Schedule module.

Note: This module is named smartlife.iot.common.schedule in some devices.

add_rule / edit_rule

Adds/edits a schedule rule.

Request

{
	"schedule": {
		"edit_rule": {
			"id": "",
			"name": "",
			"enable": 1,
			"wday": [1, 1, 1, 1, 1, 1, 1],
			"stime_opt": 1,
			"smin": 0,
			"soffset": 0,
			"sact": 1,
			"s_light": {
				"on_off": 1,
				"mode": "customize_preset",
				"hue": 0,
				"saturation": 0,
				"color_temp": 2700,
				"brightness": 25,
				"transition_period": 1000
			},
			"etime_opt": 2,
			"emin": 0,
			"eoffset": 0,
			"eact": 0,
			"e_light": {
				"on_off": 0,
				"mode": "customize_preset",
				"hue": 0,
				"saturation": 0,
				"color_temp": 2700,
				"brightness": 0,
				"transition_period": 1000
			},
			"repeat": 0,
			"year": 2000,
			"month": 1,
			"day": 1
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the schedule rule to edit. Omitted in add_rule.
name string A user-specified name for the rule.
enable enum 0 = disable rule
1 = enable rule
wday array Weekdays on which the rule is to repeat. The first element corresponds to Sunday.
stime_opt enum -1 = rule does not begin
0 = rule begins at smin minutes past midnight
1 = rule begins at sunrise + soffset
2 = rule begins at sunset + soffset
smin integer The time of day at which the rule is to begin, in minutes past midnight. Omitted unless stime_opt is 0.
soffset integer The offset from sunrise/sunset at which the rule is to begin, in minutes. May be negative. Omitted if stime_opt is -1 or 0.
sact enum The action to take when the rule begins.
-1 = no action
0 = turn switch off
1 = turn switch on
2 = (bulbs only) transition light state
s_light object (bulbs only) The light state to which to transition when the rule begins. See transition_light_state.
etime_opt enum -1 = rule does not end
0 = rule ends at emin minutes past midnight
1 = rule ends at sunrise + eoffset
2 = rule ends at sunset + eoffset
emin integer The time of day at which the rule is to end, in minutes past midnight. Omitted unless etime_opt is 0.
eoffset integer The offset from sunrise/sunset at which the rule is to end, in minutes. May be negative. Omitted if etime_opt is -1 or 0.
eact enum The action to take when the rule ends.
-1 = no action
0 = turn switch off
1 = turn switch on
2 = (bulbs only) transition light state
e_light object (bulbs only) The light state to which to transition when the rule ends. See transition_light_state.
repeat enum 0 = rule does not repeat
1 = rule repeats
year integer The four-digit year in which the rule is to begin. Omitted if repeat is 1.
month enum The month of the year in which the rule is to begin. Omitted if repeat is 1.
1 = January

12 = December
day integer The day of the month on which the rule is to begin, 1-31. Omitted if repeat is 1.

Response

{
	"schedule": {
		"add_rule": {
			"id": "",
			"err_code": 0
		}
	}
}
Parameter Type Description
id string A device-assigned identifier for the new rule. Omitted in the response to edit_rule.

delete_all_rules

Deletes all schedule rules.

Request

{
	"schedule": {
		"delete_all_rules": {}
	}
}

Response

{
	"schedule": {
		"delete_all_rules": {
			"err_code": 0
		}
	}
}

delete_rule

Deletes a schedule rule.

Request

{
	"schedule": {
		"delete_rule": {
			"id": ""
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the schedule rule to delete.

Response

{
	"schedule": {
		"delete_rule": {
			"err_code": 0
		}
	}
}

get_daystat

Returns historical usage per day in a specified year and month.

Request

{
	"schedule": {
		"get_daystat": {
			"year": 2000,
			"month": 1
		}
	}
}
Parameter Type Description
year integer The four-digit year from which to return historical usage.
month enum The month from which to return historical usage.
1 = January

12 = December

Response

{
	"schedule": {
		"get_daystat": {
			"day_list": [
				{
					"year": 2000,
					"month": 1,
					"day": 1,
					"time": 42
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
day_list array A list of per-day historical usage records.
year integer The four-digit year of a usage record.
month enum The month of a usage record.
1 = January

12 = December
day integer The day of the month of a usage record, 1-31.
time integer The historical usage recorded on the indicated day, in minutes.

get_monthstat

Returns historical usage per month in a specified year.

Request

{
	"schedule": {
		"get_monthstat": {
			"year": 2000
		}
	}
}
Parameter Type Description
year integer The four-digit year from which to return historical usage.

Response

{
	"schedule": {
		"get_monthstat": {
			"month_list": [
				{
					"year": 2000,
					"month": 1,
					"time": 4269
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
month_list array A list of per-month historical usage records.
year integer The four-digit year of a usage record.
month enum The month of a usage record.
1 = January

12 = December
time integer The historical usage recorded in the indicated month, in minutes.

get_rules

Returns the configured schedule rules.

Request

{
	"schedule": {
		"get_rules": {}
	}
}

Response

{
	"schedule": {
		"get_rules": {
			"rule_list": [
				{
					"id": "",
					"name": "",
					"enable": 1,
					"wday": [1, 1, 1, 1, 1, 1, 1],
					"stime_opt": 1,
					"smin": 0,
					"soffset": 0,
					"sact": 1,
					"s_light": {
						"on_off": 1,
						"mode": "customize_preset",
						"hue": 0,
						"saturation": 0,
						"color_temp": 2700,
						"brightness": 25,
						"transition_period": 1000
					},
					"etime_opt": 2,
					"emin": 0,
					"eoffset": 0,
					"eact": 0,
					"e_light": {
						"on_off": 0,
						"mode": "customize_preset",
						"hue": 0,
						"saturation": 0,
						"color_temp": 2700,
						"brightness": 0,
						"transition_period": 1000
					},
					"repeat": 0,
					"year": 2000,
					"month": 1,
					"day": 1
				}
			],
			"version": 2,
			"enable": 1,
			"err_code": 0
		}
	}
}
Parameter Type Description
rule_list array A list of configured schedule rules.
id string The device-assigned identifier of a schedule rule.
name string The user-specified name of the rule.
enable enum 0 = rule is disabled
1 = rule is enabled
wday array Weekdays on which the rule repeats. The first element corresponds to Sunday.
stime_opt enum -1 = rule does not begin
0 = rule begins at smin minutes past midnight
1 = rule begins at sunrise + soffset
2 = rule begins at sunset + soffset
smin integer The time of day at which the rule begins, in minutes past midnight.
soffset integer The offset from sunrise/sunset at which the rule begins, in minutes. May be negative. Omitted if stime_opt is -1 or 0.
sact enum The action to take when the rule begins.
-1 = no action
0 = turn switch off
1 = turn switch on
2 = (bulbs only) transition light state
s_light object (bulbs only) The light state to which to transition when the rule begins. See transition_light_state.
etime_opt enum -1 = rule does not end
0 = rule ends at emin minutes past midnight
1 = rule ends at sunrise + eoffset
2 = rule ends at sunset + eoffset
emin integer The time of day at which the rule ends, in minutes past midnight.
eoffset integer The offset from sunrise/sunset at which the rule ends, in minutes. May be negative. Omitted if etime_opt is -1 or 0.
eact enum The action to take when the rule ends.
-1 = no action
0 = turn switch off
1 = turn switch on
2 = (bulbs only) transition light state
e_light object (bulbs only) The light state to which to transition when the rule ends. See transition_light_state.
repeat enum 0 = rule does not repeat
1 = rule repeats
year integer The four-digit year in which the rule begins. Omitted if repeat is 1.
month enum The month of the year in which the rule begins. Omitted if repeat is 1.
1 = January

12 = December
day integer The day of the month on which the rule begins, 1-31. Omitted if repeat is 1.
version integer ???
enable enum 0 = schedule is disabled
1 = schedule is enabled

set_overall_enable

Enables or disables the schedule.

Request

{
	"schedule": {
		"set_overall_enable": {
			"enable": 1
		}
	}
}
Parameter Type Description
enable enum 0 = disable the schedule
1 = enable the schedule

Response

{
	"schedule": {
		"set_overall_enable": {
			"err_code": 0
		}
	}
}

smartlife.iot.LAS

Ambient light sensor module.

get_config

Returns the current configuration of the ambient light sensor.

Request

{
	"smartlife.iot.LAS": {
		"get_config": {}
	}
}

Response

{
	"smartlife.iot.LAS": {
		"get_config": {
			"devs": [
				{
					"hw_id": 0,
					"enable": 1,
					"dark_index": 0,
					"min_adc": 0,
					"max_adc": 2450,
					"level_array": [
						{
							"name": "cloudy",
							"adc": 390,
							"value": 15
						}
					]
				}
			],
			"ver": "1.0",
			"err_code": 0
		}
	}
}
Parameter Type Description
devs array A list of ambient light sensors.
hw_id integer The unique identifier of an ambient light sensor within the device.
enable enum 0 = ambient light sensor is disabled
1 = ambient light sensor is enabled
dark_index integer The zero-based index into level_array of the light level below which the sensor will report darkness.
min_adc integer The minimum possible reading from the light sensor's analog-to-digital converter.
max_adc integer The maximum possible reading from the light sensor's analog-to-digital converter.
level_array array A list of ambient light levels.
name string A loose description of an ambient light level.
adc integer The raw analog-to-digital converter value of an ambient light level.
value integer The normalized ambient light level as a percentage: (adcmin_adc) ÷ (max_adcmin_adc) × 100.
ver string ???

get_current_brt

Returns the current brightness seen by the ambient light sensor.

Request

{
	"smartlife.iot.LAS": {
		"get_current_brt": {}
	}
}

Response

{
	"smartlife.iot.LAS": {
		"get_current_brt": {
			"value": 0,
			"err_code": 0
		}
	}
}
Parameter Type Description
value integer The normalized ambient light level currently seen by the sensor.

set_brt_level

Modifies a predefined brightness level.

Request

{
	"smartlife.iot.LAS": {
		"set_brt_level": {
			"index": 5,
			"value": 42
		}
	}
}
Parameter Type Description
index integer A zero-based index into the level_array returned from get_config.
value integer The normalized ambient light level to associate with the specified index.

Response

{
	"smartlife.iot.LAS": {
		"set_brt_level": {
			"err_code": 0
		}
	}
}

set_dark_index

Sets the brightness level below which the ambient light sensor will report darkness.

Request

{
	"smartlife.iot.LAS": {
		"set_dark_index": {
			"dark_index": 0
		}
	}
}
Parameter Type Description
dark_index integer The zero-based index into level_array returned from get_config of the light level below which the sensor is to report darkness.

Response

{
	"smartlife.iot.LAS": {
		"set_dark_index": {
			"err_code": 0
		}
	}
}

set_enable

Sets whether the ambient light sensor is enabled.

Request

{
	"smartlife.iot.LAS": {
		"set_enable": {
			"enable": 1
		}
	}
}
Parameter Type Description
enable enum 0 = disable the ambient light sensor
1 = enable the ambient light sensor

Response

{
	"smartlife.iot.LAS": {
		"set_enable": {
			"err_code": 0
		}
	}
}

smartlife.iot.lighting_effect

Lighting effect module.

smartlife.iot.PIR

Passive infrared motion sensor module.

get_config

Returns the current configuration of the motion sensor.

Request

{
	"smartlife.iot.PIR": {
		"get_config": {}
	}
}

Response

{
	"smartlife.iot.PIR": {
		"get_config": {
			"enable": 1,
			"version": "1.0",
			"trigger_index": 1,
			"cold_time": 60000,
			"min_adc": 0,
			"max_adc": 4095,
			"array": [80, 50, 20, 0],
			"err_code": 0
		}
	}
}
Parameter Type Description
enable enum 0 = motion sensor is disabled
1 = motion sensor is enabled
version string ???
trigger_index integer The zero-based index into array of the current trigger sensitivity.
cold_time integer The duration of no motion events detected after which the sensor goes "cold," in milliseconds.
min_adc integer The minimum possible reading from the motion sensor's analog-to-digital converter.
max_adx integer The maximum possible reading from the motion sensor's analog-to-digital converter.
array array A list of motion sensor sensitivities, roughly in units of decimeters.

set_cold_time

Sets the duration of no motion events detected after which the motion sensor goes "cold."

Note: Smart Control rules will modify this setting.

Request

{
	"smartlife.iot.PIR": {
		"set_cold_time": {
			"cold_time": 60000
		}
	}
}
Parameter Type Description
cold_time integer The duration of no motion events detected after which the sensor is to go "cold," in milliseconds.

Response

{
	"smartlife.iot.PIR": {
		"set_cold_time": {
			"err_code": 0
		}
	}
}

set_enable

Sets whether the motion sensor is enabled.

Request

{
	"smartlife.iot.PIR": {
		"set_enable": {
			"enable": 1
		}
	}
}
Parameter Type Description
enable enum 0 = disable the motion sensor
1 = enable the motion sensor

Response

{
	"smartlife.iot.PIR": {
		"set_enable": {
			"err_code": 0
		}
	}
}

set_trigger_sens

Sets the motion sensor trigger sensitivity.

Request

{
	"smartlife.iot.PIR": {
		"set_trigger_sens": {
			"index": 3,
			"value": 42
		}
	}
}
Parameter Type Description
index integer A zero-based index into the array returned by get_config.
value integer The motion sensor sensitivity to associate with the specified index, roughly in units of decimeters.

Response

{
	"smartlife.iot.PIR": {
		"set_trigger_sens": {
			"err_code": 0
		}
	}
}

smartlife.iot.sensor_trigger

Smart Control module.

add_weekday_routine / edit_weekday_routine

Adds/edits a Smart Control rule.

Request

{
	"smartlife.iot.sensor_trigger": {
		"edit_weekday_routine": {
			"en": 1,
			"name": "",
			"id": "0",
			"wday": [1, 1, 1, 1, 1, 1, 1],
			"array": [
				{
					"sT": 0,
					"eT": 1440,
					"clr": 0,
					"onTT": 2,
					"offTT": 2,
					"offWT": 60
				}
			]
		}
	}
}
Parameter Type Description
en enum 0 = disable rule
1 = enable rule
name string A user-specified name for the rule.
id string The device-assigned identifier of the Smart Control rule to edit. Omitted in add_weekday_routine.
wday array ??? Maybe specifies on which weekdays the rule applies?
array array A list of rule segments.
sT integer Start time of the segment, in minutes past midnight.
eT integer End time of the segment, in minutes past midnight.
clr enum Color in which to display the segment in the UI.
onTT enum "On" trigger type.
0 = manual only
1 = motion detected
2 = dark and motion detected
offTT enum "Off" trigger type.
0 = manual only
2 = no motion detected for offWT seconds
offWT integer If offTT is 2, the time after which the switch will turn off if no motion is detected, in seconds.

Response

{
	"smartlife.iot.sensor_trigger": {
		"add_weekday_routine": {
			"id": "0",
			"err_code": 0
		}
	}
}
Parameter Type Description
id string A device-assigned identifier for the new rule. Omitted in the response to edit_weekday_routine.

delete_weekday_routine

Deletes a Smart Control rule.

Request

{
	"smartlife.iot.sensor_trigger": {
		"delete_weekday_routine": {
			"id": "0"
		}
	}
}
Parameter Type Description
id string The device-assigned identifier of the Smart Control rule to delete.

Response

{
	"smartlife.iot.sensor_trigger": {
		"delete_weekday_routine": {
			"err_code": 0
		}
	}
}

get_default_manual_action

Returns the configured default manual actions.

Request

{
	"smartlife.iot.sensor_trigger": {
		"get_default_manual_action": {}
	}
}

Response

{
	"smartlife.iot.sensor_trigger": {
		"get_default_manual_action": {
			"onToT": 0,
			"onToM": 0,
			"onToS": 10,
			"offToT": 0,
			"offToM": 0,
			"offToS": 60,
			"err_code": 0
		}
	}
}
Parameter Type Description
onToT integer ???
onToM integer ???
onToS integer ???
offToT integer ???
offToM integer ???
offToS integer The time after the switch is manually turned off until sensor triggers reactivate, in seconds.

get_weekday_routine

Returns the configured Smart Control rules.

Request

{
	"smartlife.iot.sensor_trigger": {
		"get_weekday_routine": {}
	}
}

Response

{
	"smartlife.iot.sensor_trigger": {
		"get_weekday_routine": {
			"array": [
				{
					"en": 1,
					"name": "",
					"id": "0",
					"wday": [1, 1, 1, 1, 1, 1, 1],
					"array": [
						{
							"sT": 0,
							"eT": 1440,
							"clr": 0,
							"onTT": 2,
							"offTT": 2,
							"offWT": 60
						}
					]
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
array array A list of configured Smart Control rules.
en enum 0 = rule is disabled
1 = rule is enabled
name string The user-specified name of the rule.
id string The device-assigned identifier of a Smart Control rule.
wday array ??? Maybe specifies on which weekdays the rule applies?
array array A list of rule segments.
sT integer Start time of the segment, in minutes past midnight.
eT integer End time of the segment, in minutes past midnight.
clr enum Color in which to display the segment in the UI.
onTT enum "On" trigger type.
0 = manual only
1 = motion detected
2 = dark and motion detected
offTT enum "Off" trigger type.
0 = manual only
2 = no motion detected for offWT seconds
offWT integer If offTT is 2, the time after which the switch will turn off if no motion is detected, in seconds.

set_default_manual_action

Configures the default manual actions.

Request

{
	"smartlife.iot.sensor_trigger": {
		"set_default_manual_action": {
			"offToS": 15
		}
	}
}
Parameter Type Description
offToS integer The time after the switch is manually turned off until sensor triggers reactivate, in seconds.

Response

{
	"smartlife.iot.sensor_trigger": {
		"set_default_manual_action": {
			"err_code": 0
		}
	}
}

smartlife.iot.smartbulb.lightingservice

Smart bulb module.

get_default_behavior

Returns the default behavior of the bulb when switching on.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_default_behavior": {}
	}
}

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_default_behavior": {
			"soft_on": {
				"mode": "last_status"
			},
			"hard_on": {
				"mode": "customize_preset",
				"index": 0,
				"hue": 0,
				"saturation": 0,
				"color_temp": 2700,
				"brightness": 50
			},
			"err_code": 0
		}
	}
}
Parameter Type Description
soft_on object The default behavior when the bulb is switched on by command.
hard_on object The default behavior when the bulb receives power.
mode string last_status = restore most recently used light state
customize_preset = load specified preset
circadian = set automatic white color temperature
index integer The zero-based index of a customizable light state preset. Omitted if mode is last_status.
hue integer A color hue, in degrees. Only used if color_temp is 0. Omitted if mode is last_status.
saturation integer Color saturation, in percent. Only used if color_temp is 0. Omitted if mode is last_status.
color_temp integer White color temperature, in kelvin, or 0 to use hue and saturation instead. Omitted if mode is last_status.
brightness integer Brightness, in percent. Omitted if mode is last_status.

get_light_details

Returns physical bulb specifications.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_light_details": {}
	}
}

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_light_details": {
			"lamp_beam_angle": 180,
			"min_voltage": 100,
			"max_voltage": 120,
			"wattage": 10,
			"incandescent_equivalent": 60,
			"max_lumens": 800,
			"color_rendering_index": 80,
			"err_code": 0
		}
	}
}
Parameter Type Description
lamp_beam_angle integer The lamp beam angle, in degrees.
min_voltage integer The minimum operating voltage, in volts.
max_voltage integer The maximum operating voltage, in volts.
wattage integer The maximum power consumption, in watts.
incandescent_equivalent integer The power consumption of an incandescent bulb of equivalent light output, in watts.
max_lumens integer The maximum light output, in lumens.
color_rendering_index integer Color rendering index, relative to incandescent light, in percent.

get_light_state

Returns the current light state.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_light_state": {}
	}
}

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_light_state": {
			"dft_on_state": {
				"hue": 0,
				"saturation": 0,
				"color_temp": 2700,
				"brightness": 50,
				"mode": "normal"
			},
			"on_off": 1,
			"hue": 0,
			"saturation": 0,
			"color_temp": 2700,
			"brightness": 50,
			"mode": "normal",
			"err_code": 0
		}
	}
}
Parameter Type Description
dft_on_state object The most recent "on" state. Omitted if on_off is 1.
on_off enum 0 = bulb is off
1 = bulb is on
hue integer A color hue, in degrees. Only used if color_temp is 0. Omitted if on_off is 0.
saturation integer Color saturation, in percent. Only used if color_temp is 0. Omitted if on_off is 0.
color_temp integer White color temperature, in kelvin, or 0 to use hue and saturation instead. Omitted if on_off is 0.
brightness integer Brightness, in percent. Omitted if on_off is 0.
mode string Omitted if on_off is 0.
normal = fixed color
circadian = automatic white color temperature

get_preferred_state

Returns the current configuration of customizable preset light states.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_preferred_state": {}
	}
}

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"get_preferred_state": {
			"states": [
				{
					"index": 0,
					"hue": 0,
					"saturation": 0,
					"color_temp": 2700,
					"brightness": 50
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
states array A list of customizable preset light states.
index integer The zero-based index of a preset.
hue integer A color hue, in degrees. Only used if color_temp is 0.
saturation integer Color saturation, in percent. Only used if color_temp is 0.
color_temp integer White color temperature, in kelvin, or 0 to use hue and saturation instead.
brightness integer Brightness, in percent.

set_default_behavior

Sets the default behavior of the bulb when switching on.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"set_default_behavior": {
			"soft_on": {
				"mode": "last_status"
			},
			"hard_on": {
				"mode": "customize_preset",
				"index": 0
			}
		}
	}
}
Parameter Type Description
soft_on object The default behavior when the bulb is switched on by command.
hard_on object The default behavior when the bulb receives power.
mode string last_status = restore most recently used light state
customize_preset = load specified preset
circadian = set automatic white color temperature
index integer The zero-based index of a customizable light state preset. Omitted if mode is last_status.

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"set_default_behavior": {
			"err_code": 0
		}
	}
}

set_preferred_state

Change the configuration of a customizable preset light state.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"set_preferred_state": {
			"index": 0,
			"hue": 0,
			"saturation": 0,
			"color_temp": 2700,
			"brightness": 50
		}
	}
}
Parameter Type Description
index integer The zero-based index of the preset to change.
hue integer A color hue, in degrees. Only used if color_temp is 0.
saturation integer Color saturation, in percent. Only used if color_temp is 0.
color_temp integer White color temperature, in kelvin, or 0 to use hue and saturation instead.
brightness integer Brightness, in percent.

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"set_preferred_state": {
			"err_code": 0
		}
	}
}

transition_light_state

Transition the bulb smoothly to a new light state.

Request

{
	"smartlife.iot.smartbulb.lightingservice": {
		"transition_light_state": {
			"on_off": 1,
			"mode": "normal",
			"hue": 0,
			"saturation": 0,
			"color_temp": 2700,
			"brightness": 50,
			"transition_period": 1000,
			"ignore_default": 1
		}
	}
}
Parameter Type Description
on_off enum 0 = switch bulb off
1 = switch bulb on
mode string normal = fixed color
circadian = automatic white color temperature
hue integer A color hue, in degrees. Only used if color_temp is 0.
saturation integer Color saturation, in percent. Only used if color_temp is 0.
color_temp integer White color temperature, in kelvin, or 0 to use hue and saturation instead.
brightness integer Brightness, in percent.
transition_period integer Duration over which to apply transition, in milliseconds.
ignore_default enum When transitioning from "off" to "on" state:
0 = default soft_on setting overrides method parameters
1 = method parameters override default soft_on setting

Response

{
	"smartlife.iot.smartbulb.lightingservice": {
		"transition_light_state": {
			"err_code": 0
		}
	}
}

smartlife.iot.smartpowerstrip.manage

Smart power strip module.

get_relationship

Returns the relationship of child devices to hardware slots.

Request

{
	"smartlife.iot.smartpowerstrip.manage": {
		"get_relationship": {}
	}
}

Response

{
	"smartlife.iot.smartpowerstrip.manage": {
		"get_relationship": {
			"data": [
				{
					"child_id": "",
					"hw_slot": 0
				}
			],
			"err_code": 0
		}
	}
}
Parameter Type Description
data array A list of child devices.
child_id string The unique identifier of a child device.
hw_slot integer The hardware slot number of a child device.

system

System module.

download_firmware

Initiates a download of new firmware to the device. If the download completes successfully, the device will automatically flash it.

Request

{
	"system": {
		"download_firmware": {
			"url": "http://download.tplinkcloud.com/firmware/…"
		}
	}
}
Parameter Type Description
url string An HTTP URL from which to download the new firmware image. It does not need to be on TP-Link's servers and in fact may be hosted on the local network.

Response

{
	"system": {
		"download_firmware": {
			"err_code": 0
		}
	}
}

get_download_state

Returns the current state of a firmware download.

Request

{
	"system": {
		"get_download_state": {}
	}
}

Response

{
	"system": {
		"get_download_state": {
			"status": 0,
			"ratio": 0,
			"reboot_time": 5,
			"flash_time": 5,
			"err_code": 0
		}
	}
}
Parameter Type Description
status enum 0 = idle
1 = downloading
2 = flashing
6 = error
ratio integer Percentage completed, 0-100.
reboot_time integer ???
flash_time integer ???

get_sysinfo

Returns system information.

Request

{
	"system": {
		"get_sysinfo": {}
	}
}

Response

{
	"system": {
		"get_sysinfo": {
			"sw_ver": "",
			"hw_ver": "",
			"model": "",
			"deviceId": "",
			"oemId": "",
			"hwId": "",
			"rssi": -42,
			"latitude_i": 0,
			"longitude_i": 0,
			"alias": "",
			"status": "new",
			"obd_src": "tplink",
			"mic_type": "",
			"feature": "",
			"mic_mac": "XXXXXXXXXXXX",
			"mac": "XX:XX:XX:XX:XX:XX",
			"dev_state": "normal",
			"is_factory": false,
			"disco_ver": "",
			"ctrl_protocols": {
				"name": "",
				"version": ""
			},
			"updating": 0,
			"led_off": 0,
			"is_dimmable": 1,
			"is_color": 1,
			"is_variable_color_temp": 1,
			"LEF": 0,
			"light_state": {
				"dft_on_state": {
					"hue": 0,
					"saturation": 0,
					"color_temp": 2700,
					"brightness": 50,
					"mode": "normal"
				},
				"on_off": 1,
				"hue": 0,
				"saturation": 0,
				"color_temp": 2700,
				"brightness": 50,
				"mode": "normal"
			},
			"preferred_state": [
				{
					"index": 0,
					"hue": 0,
					"saturation": 0,
					"color_temp": 2700,
					"brightness": 50
				}
			],
			"relay_state": 0,
			"on_time": 0,
			"icon_hash": "",
			"description": "",
			"dev_name": "",
			"active_mode": "none",
			"next_action": {
				"type": -1
			},
			"children": [
				{
					"id": "",
					"state": 0,
					"alias": "",
					"on_time": 0,
					"next_action": {
						"type": -1
					}
				}
			],
			"child_num": 1,
			"ntc_state": 0,
			"err_code": 0
		}
	}
}
Parameter Type Description
sw_ver string The firmware version.
hw_ver string The hardware version.
model string The device model number.
deviceId string A hex string uniquely identifying the device instance.
oemId string A hex string, purpose unknown.
hwId string A hex string uniquely identifying the hardware configuration.
rssi integer The current Wi-Fi signal strength, in dBm.
latitude_i integer The latitude of the device, in ten-thousandths of a degree.
longitude_i integer The longitude of the device, in ten-thousandths of a degree.
alias string A user-specified label for the device.
status string ???
obd_src string ???
mic_type string IOT.SMARTBULB
IOT.SMARTPLUGSWITCH
feature string A colon-separated list of features:
ENE = energy meter
TIM = countdown timer
mic_mac
mac
string The MAC address of the device.
dev_state string The device state.
is_factory boolean ???
disco_ver string Version of the discovery protocol supported.
ctrl_protocols object Control protocols supported.
updating enum ???
led_off enum 0 = LED functions normally
1 = LED function is suppressed
icon_hash string The hash of the icon to display in the UI.
description
dev_name
string An English description of the device.
active_mode string ???
next_action object ???

If mic_type is IOT.SMARTBULB:

Parameter Type Description
is_dimmable enum 0 = bulb is not dimmable
1 = bulb is dimmable
is_color enum 0 = bulb is white only
1 = bulb is multi-color
is_variable_color_temp enum 0 = bulb has fixed white color temperature
1 = bulb has variable white color temperature
LEF enum ??? Maybe bulb supports Lighting Effect Feature?
light_state object See smartlife.iot.smartbulb.lightingservice/get_light_state.
preferred_state array See smartlife.iot.smartbulb.lightingservice/get_preferred_state.

If mic_type is IOT.SMARTPLUGSWITCH:

Parameter Type Description
relay_state enum (plugs and switches only)
0 = relay is open (off)
1 = relay is closed (on)
on_time integer Elapsed time since the relay was closed, in seconds.
children array (plug strips only) A list of child devices.
id string A unique identifier for the child device.
state enum 0 = child device is switched off
1 = child device is switched on
child_num integer (plug strips only) The number of child devices.
ntc_state enum (plugs and plug strips only) The current state of the negative temperature coefficient sensor.
0 = normal

reboot

Reboots the device.

Request

{
	"system": {
		"reboot": {
			"delay": 1
		}
	}
}
Parameter Type Description
delay integer The time to delay before rebooting the device, in seconds. If 0, the device may reboot before it can send a response.

Response

{
	"system": {
		"reboot": {
			"err_code": 0
		}
	}
}

reset

Resets the device configuration to factory defaults and reboots the device.

Request

{
	"system": {
		"reset": {
			"delay": 1
		}
	}
}
Parameter Type Description
delay integer The time to delay before rebooting the device, in seconds. If 0, the device may reboot before it can send a response.

Response

{
	"system": {
		"reset": {
			"err_code": 0
		}
	}
}

set_dev_alias

Changes the device alias, which is a user-specified label for the device.

Request

{
	"context": {
		"child_ids": ["..."]
	},
	"system": {
		"set_dev_alias": {
			"alias": ""
		}
	}
}
Parameter Type Description
child_ids array (plug strips only) A list of the identifiers of the child devices whose alias is to be changed.
alias string A user-specified label for the device.

Response

{
	"system": {
		"set_dev_alias": {
			"err_code": 0
		}
	}
}

set_dev_location

Sets the geographical location of the device.

Request

{
	"system": {
		"set_dev_location": {
			"latitude_i": 0,
			"longitude_i": 0
		}
	}
}
Parameter Type Description
latitude_i integer The latitude of the device, in ten-thousandths of a degree.
longitude_i integer The longitude of the device, in ten-thousandths of a degree.

Response

{
	"system": {
		"set_dev_location": {
			"err_code": 0
		}
	}
}

set_mac_addr

Changes the MAC address of the device.

Request

{
	"system": {
		"set_mac_addr": {
			"mac": "00:00:5E:00:53:00"
		}
	}
}

Response

{
	"system": {
		"set_mac_addr": {
			"err_code": 0
		}
	}
}

set_led_off

Sets whether the function of the LED indicator on the device is suppressed.

Request

{
	"system": {
		"set_led_off": {
			"off": 1
		}
	}
}
Parameter Type Description
off enum 0 = configure LED to function normally
1 = suppress LED function

Response

{
	"system": {
		"set_led_off": {
			"err_code": 0
		}
	}
}

set_relay_state

(plugs, plug strips, and switches only)

Sets the state of the relay, controlling whether the load is connected to the line.

Request

{
	"context": {
		"child_ids": ["..."]
	},
	"system": {
		"set_relay_state": {
			"state": 0
		}
	}
}
Parameter Type Description
child_ids array (plug strips only) A list of the identifiers of the child devices whose relay state is to be set.
state enum 0 = set relay open (off)
1 = set relay closed (on)

Response

{
	"system": {
		"set_relay_state": {
			"err_code": 0
		}
	}
}

time

Real-time clock module.

Note: This module is named smartlife.iot.common.timesetting in some devices.

get_time

Returns the current time according to the device's real-time clock.

Request

{
	"time": {
		"get_time": {}
	}
}

Response

{
	"time": {
		"get_time": {
			"year": 2000,
			"month": 1,
			"mday": 1,
			"hour": 0,
			"min": 0,
			"sec": 0,
			"err_code": 0
		}
	}
}
Parameter Type Description
year integer The current four-digit year.
month enum The current month of the year.
1 = January

12 = December
mday integer The current day of the month, 1-31.
hour integer The current hour of the day, 0-23.
min integer The current minute of the hour, 0-59.
sec integer The current second of the minute, 0-59.

get_timezone

Returns the configured time zone of the device.

Request

{
	"time": {
		"get_timezone": {}
	}
}

Response

{
	"time": {
		"get_timezone": {
			"index": 38,
			"err_code": 0
		}
	}
}
Parameter Type Description
index enum The time zone index. See set_timezone for the possible values.

set_time

Note: Some devices always return {"err_code":-3,"err_msg":"invalid argument"} from this method. Set these device's clocks using the set_timezone method.

Request

{
	"time": {
		"set_time": {
			"year": 2000,
			"month": 1,
			"mday": 1,
			"hour": 0,
			"min": 0,
			"sec": 0
		}
	}
}
Parameter Type Description
year integer The current four-digit year.
month enum The current month of the year.
1 = January

12 = December
mday integer The current day of the month, 1-31.
hour integer The current hour of the day, 0-23.
min integer The current minute of the hour, 0-59.
sec integer The current second of the minute, 0-59.

Response

{
	"time": {
		"set_time": {
			"err_code": 0
		}
	}
}

set_timezone

Sets the device's time zone and real-time clock.

Note: Kasa devices automatically set their real-time clocks from the Internet, but if you have disallowed them Internet access, then you will need to set their clocks manually. There is no battery backing the clock, so the clock must be set whenever power has been interrupted.

Request

{
	"time": {
		"set_timezone": {
			"index": 38,
			"year": 2000,
			"month": 1,
			"mday": 1,
			"hour": 0,
			"min": 0,
			"sec": 0
		}
	}
}
Parameter Type Description
index enum The time zone index.
0 = UTC-12:00 – International Date Line West
1 = UTC-11:00 – Coordinated Universal Time
2 = UTC-10:00 – Hawaii
3 = UTC-09:00 – Alaska
4 = UTC-08:00 – Baji California
5 = UTC-08:00 – Pacific Standard Time
6 = UTC-08:00 – Pacific Daylight Time
7 = UTC-07:00 – Arizona
8 = UTC-07:00 – Chihuahua, La Paz, Mazatlan
9 = UTC-07:00 – Mountain Standard Time
10 = UTC-07:00 – Mountain Daylight Time
11 = UTC-06:00 – Central America
12 = UTC-06:00 – Central Standard Time
13 = UTC-06:00 – Central Daylight Time
14 = UTC-06:00 – Guadalajara, Mexico City
15 = UTC-06:00 – Saskatchewan
16 = UTC-05:00 – Bogota, Lima, Quito
17 = UTC-05:00 – Eastern Standard Time
18 = UTC-05:00 – Eastern Daylight Time
19 = UTC-05:00 – Indiana (East)
20 = UTC-04:30 – Caracas
21 = UTC-04:00 – Asunicion
22 = UTC-04:00 – Atlantic Standard Time
23 = UTC-04:00 – Atlantic Daylight Time
24 = UTC-04:00 – Cuiaba
25 = UTC-04:00 – Georgetown
26 = UTC-04:00 – Santiago
27 = UTC-03:30 – Newfoundland
28 = UTC-03:00 – Brasilia
29 = UTC-03:00 – Buenos Aires
30 = UTC-03:00 – Cayenne, Fortaleza
31 = UTC-03:00 – Greenland
32 = UTC-03:00 – Montevideo
33 = UTC-03:00 – Salvador
34 = UTC-02:00 – Coordindated Universal Time
35 = UTC-01:00 – Azores
36 = UTC-01:00 – Cabo Verde Is.
37 = UTC – Casablanca
38 = UTC – Coordindated Universal Time
39 = UTC – Dublin, Edinburgh, Lisbon, London
40 = UTC – Monrovia, Reykjavik
41 = UTC+01:00 – Amsterdam, Berlin, Bern
42 = UTC+01:00 – Belgrade, Bratislava
43 = UTC+01:00 – Brussels, Copenhagen
44 = UTC+01:00 – Sarajevo, Skopje, Warsaw
45 = UTC+01:00 – West Central Africa
46 = UTC+01:00 – Windkoek
47 = UTC+02:00 – Amman
48 = UTC+02:00 – Athens, Bucharest
49 = UTC+02:00 – Beirut
50 = UTC+02:00 – Cairo
51 = UTC+02:00 – Damascus
52 = UTC+02:00 – E. Europe
53 = UTC+02:00 – Harare, Pretoria
54 = UTC+02:00 – Helsinki, Kyiv, Riga, Sofia
55 = UTC+02:00 – Istanbul
56 = UTC+02:00 – Jerusalem
57 = UTC+02:00 – Kalinigrad (RTZ 1)
58 = UTC+02:00 – Tripoli
59 = UTC+02:00 – Baghdad
60 = UTC+03:00 – Kuwait, Riyadh
61 = UTC+03:00 – Minsk
62 = UTC+03:00 – Moscow, St. Petersburg
63 = UTC+03:00 – Nairobi
64 = UTC+03:30 – Tehran
65 = UTC+04:00 – Abu Dhabi, Muscat
66 = UTC+04:00 – Baku
67 = UTC+04:00 – Izhevsk, Samara (RTZ 3)
68 = UTC+04:00 – Port Louis
69 = UTC+04:00 – Tbilisi
70 = UTC+04:00 – Yerevan
71 = UTC+04:30 – Kabal
72 = UTC+05:00 – Ashgabat, Tashkent
73 = UTC+05:00 – Ekaterinburg (RTZ 4)
74 = UTC+05:00 – Islamabad, Karachi
75 = UTC+05:30 – Chennai, Kolkata, Mumbai
76 = UTC+05:30 – Sri Jayawardenepura
77 = UTC+05:45 – Kathmandu
78 = UTC+06:00 – Astana
79 = UTC+06:00 – Dhaka
80 = UTC+06:00 – Novosibirsk (RTZ 5)
81 = UTC+06:30 – Yangon (Rangoon)
82 = UTC+07:00 – Bankok, Hanoi, Jakarta
83 = UTC+07:00 – Kransnoyarsk (RTZ 6)
84 = UTC+08:00 – Beijing, Chongqing, Hong Kong
85 = UTC+08:00 – Irkutsk (RTZ 7)
86 = UTC+08:00 – Kuala Lumpur, Singapore
87 = UTC+08:00 – Perth
88 = UTC+08:00 – Taipei
89 = UTC+08:00 – Ulaanbaatar
90 = UTC+09:00 – Osaka, Sapporo, Tokyo
91 = UTC+09:00 – Seoul
92 = UTC+09:00 – Yakutsk (RTZ 8)
93 = UTC+09:30 – Adelaide
94 = UTC+09:30 – Darwin
95 = UTC+10:00 – Brisbane
96 = UTC+10:00 – Canberra, Melbourne, Sydney
97 = UTC+10:00 – Guam, Port Moresby
98 = UTC+10:00 – Hobart
99 = UTC+10:00 – Magadan
100 = UTC+10:00 – Vladivostok, Magadan (RTZ 9)
101 = UTC+11:00 – Chokurdakh (RTZ 10)
102 = UTC+11:00 – Solomon Is., New Caledonia
103 = UTC+12:00 – Anadyr, Petropavlovsk
104 = UTC+12:00 – Auckland, Wellington
105 = UTC+12:00 – Corrdinated Universal Time
106 = UTC+12:00 – Fiji
107 = UTC+13:00 – Nukuʻalofa
108 = UTC+13:00 – Samoa
109 = UTC+14:00 – Kiritimati Island
year integer The current four-digit year.
month enum The current month of the year.
1 = January

12 = December
mday integer The current day of the month, 1-31.
hour integer The current hour of the day, 0-23.
min integer The current minute of the hour, 0-59.
sec integer The current second of the minute, 0-59.

Thanks to Brian Dorey for the list of timezone indices.

Response

{
	"time": {
		"set_timezone": {
			"err_code": 0
		}
	}
}