Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multi device KP200 #88

Open
jbuehl opened this issue Feb 19, 2021 · 0 comments
Open

Support for multi device KP200 #88

jbuehl opened this issue Feb 19, 2021 · 0 comments

Comments

@jbuehl
Copy link

jbuehl commented Feb 19, 2021

I just acquired a KP200 wall outlet which has two sockets that can be controlled independently. The TP-Link protocol has been extended to support this device and I was able to discover how it works and share it here.

After configuring the device with the Kasa app on my phone I sent the message {"system":{"get_sysinfo":{}} to get the system information which returned

 {"system":{"get_sysinfo":{   
    "child_num": 2,
    "deviceId": "8006260281786589DEAD9EB7BEEF387B1DCFE19C",
    "alias": "TP-LINK_Smart Plug_2155",
    "children": [
        {   "next_action": {"type": -1},
            "state": 0,
            "on_time": 0,
            "alias": "Barbecue lights",
            "id": "8006260281786589DEAD9EB7BEEF387B1DCFE19C00"},
        {   "next_action": {"type": -1},
            "state": 0,
            "on_time": 0,
            "alias": "Patio lights",
            "id": "8006260281786589DEAD9EB7BEEF387B1DCFE19C01"}],
    "longitude_i": -1194024,
    "latitude_i": 331491,
    "hw_ver": "1.0",
    "mac": "40:3F:8C:E8:21:55",
    "ntc_state": 0,
    "model": "KP200(US)",
    "led_off": 0,
    "oemId": "04F52C33845539AA35826EBC43BF5EDE",
    "sw_ver": "1.0.7 Build 190309 Rel.180427",
    "updating": 0,
    "feature": "TIM",
    "err_code": 0,
    "rssi": -60,
    "hwId": "8BE782A7B45D9C9F19EB2F39A361820E",
    "mic_type": "IOT.SMARTPLUGSWITCH"}
}}

The two sockets are described in the children item. Each one contains an id item that consists of the main deviceId with a 2 digit number appended, as well as an alias and a state. The alias and relay_state items are not present in the main block.

To control an individual socket, the set_relay_state message contains an additional item context which contains the id of the socket to turn on or off.

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

child_ids specifies a list, so it is possible to control more that one socket at a time.

I hope this is useful. My implementation of this can be found at https://github.com/jbuehl/ha/ha/interfaces/tplinkInterface.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant