Skip to content

Device Commands Reference

piekstra edited this page Feb 7, 2026 · 1 revision

Device Commands Reference

All device commands are sent via the passthrough method as JSON strings in the requestData field. This reference documents the raw commands for each device type.

Smart Plugs (IOT.SMARTPLUGSWITCH)

System Commands

Get System Info:

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

Set Relay State (On/Off):

{"system": {"set_relay_state": {"state": 1}}}
  • state: 1 = ON
  • state: 0 = OFF

Reboot:

{"system": {"reboot": {"delay": 1}}}

Set Device Alias:

{"system": {"set_dev_alias": {"alias": "My Device Name"}}}

Set LED Off:

{"system": {"set_led_off": {"off": 1}}}

Schedule Commands

Get Schedule Rules:

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

Add Schedule Rule:

{
  "schedule": {
    "add_rule": {
      "sact": 1,
      "name": "Rule Name",
      "enable": 1,
      "wday": [1, 0, 0, 0, 0, 0, 0],
      "stime_opt": 0,
      "smin": 480,
      "soffset": 0,
      "repeat": 1
    }
  }
}
  • sact: 1 = turn on, 0 = turn off
  • wday: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - 1 = active
  • smin: Minutes from midnight (480 = 8:00 AM)
  • stime_opt: 0 = specific time, 1 = sunrise, 2 = sunset

Edit Schedule Rule:

{"schedule": {"edit_rule": {"id": "RULE_ID", ...same fields as add_rule...}}}

Delete Schedule Rule:

{"schedule": {"delete_rule": {"id": "RULE_ID"}}}

Energy Monitoring (HS110, HS300 children, KP115, KP125)

Get Realtime Power Usage:

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

Response includes: voltage_mv, current_ma, power_mw, total_wh

Get Daily Power Stats:

{"emeter": {"get_daystat": {"month": 2, "year": 2026}}}

Get Monthly Power Stats:

{"emeter": {"get_monthstat": {"year": 2026}}}

Multi-Outlet Devices (HS300, KP303, EP40)

For devices with multiple outlets, commands target specific children using the context field:

Get System Info (specific child):

{"context": {"child_ids": ["DEVICE_ID_CHILD_01"]}, "system": {"get_sysinfo": {}}}

Toggle specific outlet:

{"context": {"child_ids": ["DEVICE_ID_CHILD_03"]}, "system": {"set_relay_state": {"state": 1}}}

Child IDs follow the pattern: {parent_device_id}{child_index:02d} (e.g., ...1E7ACEF500, ...1E7ACEF501, etc.)

Smart Bulbs / Light Strips (IOT.SMARTBULB)

Lighting Commands

Commands use the smartlife.iot.smartbulb.lightingservice namespace.

Get Light State:

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

Response:

{
  "on_off": 1,
  "mode": "normal",
  "hue": 240,
  "saturation": 100,
  "color_temp": 0,
  "brightness": 75
}

Set Light State (transition):

{
  "smartlife.iot.smartbulb.lightingservice": {
    "transition_light_state": {
      "on_off": 1,
      "brightness": 75,
      "hue": 240,
      "saturation": 100,
      "color_temp": 0,
      "transition_period": 1000
    }
  }
}
  • on_off: 1 = on, 0 = off
  • brightness: 0-100
  • hue: 0-360 (color wheel degrees)
  • saturation: 0-100
  • color_temp: 2500-9000 (Kelvin, 0 = use HSV instead)
  • transition_period: milliseconds for the transition

Turn On/Off:

{"smartlife.iot.smartbulb.lightingservice": {"transition_light_state": {"on_off": 1}}}

Light Effects (KL420L5, KL430)

Get Light Effect:

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

Set Preferred State:

{
  "smartlife.iot.smartbulb.lightingservice": {
    "set_preferred_state": {
      "index": 0,
      "hue": 0,
      "saturation": 0,
      "color_temp": 2700,
      "brightness": 50
    }
  }
}

Smart Switches (HS200, HS210, HS220)

Smart switches use the same commands as smart plugs (IOT.SMARTPLUGSWITCH). The HS220 dimmer switch additionally supports:

Set Brightness (Dimmer):

{"smartlife.iot.dimmer": {"set_brightness": {"brightness": 75}}}

Common Commands (All Devices)

Get Cloud Info:

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

Get Time:

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

Get Timezone:

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

Get Device Runtime:

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

The on_time field in sysinfo shows seconds since last power on.

Source in Decompiled APK

  • Plug Commands: sources/com/tplinkra/smartplug/hsall/api/TPSmartPlugCommand.java
  • Bulb Commands: sources/com/tplinkra/light/lball/api/TPSmartBulbCommand.java
  • Dimmer Commands: sources/com/tplinkra/dimmer/hsall/api/TPSmartDimmerCommand.java

Clone this wiki locally