softScheck / tplink-smartplug

TP-Link WiFi SmartPlug Client and Wireshark Dissector
Apache License 2.0
1.13k stars 296 forks source link

KS220M(US) Dump - WIP #94

Open natemacinnes opened 2 years ago

natemacinnes commented 2 years ago

Working on collecting commands for the new KS220M(US). Request:

{
    "system": {
        "get_sysinfo":{}
    },
    "context":{
        "source":"xxx-xxx-xxx-xxx-xxx"
    }
}

Response:

{
    "system": {
        "get_sysinfo": {
            "sw_ver": "1.0.4 Build 210616 Rel.193517",
            "hw_ver": "1.0",
            "model": "KS220M(US)",
            "deviceId": "xxxx",
            "oemId": "xxx",
            "hwId": "xxx",
            "rssi": -45,
            "latitude_i": 459522,
            "longitude_i": -741095,
            "alias": "xxx",
            "status": "new",
            "mic_type": "IOT.SMARTPLUGSWITCH",
            "feature": "TIM",
            "mac": "xxx",
            "updating": 0,
            "led_off": 1,
            "relay_state": 1,
            "brightness": 44,
            "on_time": 19,
            "icon_hash": "",
            "dev_name": "Wi-Fi Smart Dimmer with sensor",
            "active_mode": "none",
            "next_action": {
                "type": -1
            },
            "preferred_state": [
                {
                    "index": 0,
                    "brightness": 100
                },
                {
                    "index": 1,
                    "brightness": 75
                },
                {
                    "index": 2,
                    "brightness": 50
                },
                {
                    "index": 3,
                    "brightness": 25
                }
            ],
            "err_code": 0
        }
    }
}

Request

{
    "smartlife.iot.sensor_trigger": {
        "get_weekday_routine": {}
    },
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    }
}

Response

{
    "smartlife.iot.sensor_trigger": {
        "get_weekday_routine": {
            "array": [
                {
                    "en": 1,
                    "name": "xxx",
                    "id": "0",
                    "wday": [
                        1,
                        1,
                        1,
                        1,
                        1,
                        1,
                        1
                    ],
                    "array": [
                        {
                            "sT": 960,
                            "eT": 1860,
                            "clr": 0,
                            "onTT": 2,
                            "offTT": 2,
                            "offWT": 120,
                            "onST": 1,
                            "onFT": 0,
                            "offFT": 0,
                            "onBrt": 1
                        }
                    ]
                }
            ],
            "err_code": 0
        }
    }
}

Request

{
    "smartlife.iot.sensor_trigger": {
        "edit_weekday_routine": {
            "wday": [
                1,
                1,
                1,
                1,
                1,
                1,
                1
            ],
            "array": [
                {
                    "offWT": 120,
                    "onBrt": 1,
                    "onTT": 2,
                    "eT": 1865,
                    "onST": 1,
                    "sT": 960,
                    "offTT": 2,
                    "clr": 0
                }
            ],
            "en": true,
            "id": "0",
            "name": "xxx"
        }
    },
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    }
}

Response

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

Request

{
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    },
    "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": 5,
            "onST": 0,
            "onBrt": 0,
            "onFT": 0,
            "offFT": 0,
            "err_code": 0
        }
    }
}

Request

{
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    },
    "smartlife.iot.sensor_trigger": {
        "set_default_manual_action": {
            "offToT": 0,
            "offToM": 0,
            "offToS": 10
        }
    }
}

Response

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

Request

{
    "smartlife.iot.PIR": {
        "get_config": {}
    },
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    }
}

Response

{
    "smartlife.iot.PIR": {
        "get_config": {
            "enable": 1,
            "version": "1.0",
            "trigger_index": 1,
            "cold_time": 120000,
            "min_adc": 0,
            "max_adc": 4095,
            "array": [
                80,
                50,
                20,
                0
            ],
            "err_code": 0
        }
    }
}

Request

{
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    },
    "smartlife.iot.PIR": {
        "set_trigger_sens": {
            "value": 80,
            "index": 0
        }
    }
}

Response

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

Request

{
    "smartlife.iot.LAS": {
        "get_config": {}
    },
    "context": {
        "source": "xxx-xxx-xxx-xxx-xxx"
    }
}

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
                        },
                        {
                            "name": "overcast",
                            "adc": 300,
                            "value": 12
                        },
                        {
                            "name": "dawn",
                            "adc": 222,
                            "value": 9
                        },
                        {
                            "name": "twilight",
                            "adc": 222,
                            "value": 9
                        },
                        {
                            "name": "total darkness",
                            "adc": 111,
                            "value": 4
                        },
                        {
                            "name": "custom",
                            "adc": 2400,
                            "value": 97
                        }
                    ]
                }
            ],
            "ver": "1.0",
            "err_code": 0
        }
    }
}
natemacinnes commented 2 years ago

I really want to figure out how we can capture PIR data in realtime. I wonder if it will be added as an enhancement to the app... 🤔

~Have the smart camera's (I think they have PIR) data been captured? The cameras have the ability to detect and trigger events based on motion.~ Looks like Tapo Smart camera's do not support PIR.

mrbetta commented 2 years ago

I also really want realtime PIR data for use in a alarm system situation. Making a bit of progress here: https://github.com/python-kasa/python-kasa/issues/268