FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support for Tapo P316M energy monitoring power strip · Issue #1558 · python-kasa/python-kasa · GitHub

Support for Tapo P316M energy monitoring power strip · Issue #1558 · python-kasa/python-kasa · GitHub
Skip to content

Navigation Menu

Repository navigation

Support for Tapo P316M energy monitoring power strip #1558

Closed as not planned
Closed as not planned

Description

Could you please add support for Tapo P316M?

I purchased one hardware revision v1.6 running latest firmware 1.0.5 Build 250306 Rel.151943 and it is not being discovered.

  • Tapo app has Third-party compatibility enabled.
  • Other tapo smartplugs P115 work just fine, not this newer one and it seems that TP/Tapo may have changed the protocol.

Activity

  1. TheLinuxGuy commented on Jul 21, 2025

    ContributorAuthor

    Adding some hopefully helpful debug info

    root@kasapi:~/python-kasa# uv run kasa --username xxx@gmail.com --password "xxxx" --host 192.168.66.240 --debug
    Discovering device 192.168.66.240 for 10 seconds
    DEBUG:kasa.discover:[DISCOVERY] 192.168.66.240 >> {'system': {'get_sysinfo': {}}}
    DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
    DEBUG:kasa.device_factory:Using SmartDevice for SMART.TAPOPLUG
    DEBUG:kasa.device_factory:Finding protocol for 192.168.66.240
    DEBUG:kasa.device_factory:Finding protocol for DeviceFamily.SmartTapoPlug
    DEBUG:kasa.device_factory:Finding transport for SMART.KLAP
    DEBUG:kasa.transports.klaptransport:Created KLAP transport for 192.168.66.240
    DEBUG:kasa.discover:[DISCOVERY] 192.168.66.240 << {'error_code': 0,
     'result': {'device_id': 'xxxxxx',
                'device_model': 'P316M(US)',
                'device_type': 'SMART.TAPOPLUG',
                'factory_default': False,
                'ip': '192.168.66.240',
                'is_support_iot_cloud': True,
                'mac': 'xxxxx',
                'mgt_encrypt_schm': {'encrypt_type': 'KLAP',
                                     'http_port': 80,
                                     'is_support_https': False,
                                     'lv': 2},
                'obd_src': 'tss',
                'owner': 'xxx',
                'protocol_version': 1}}
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartdevice.SmartDevice'>
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1753058722765,"terminal_uuid":"yyy==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}'
    DEBUG:kasa.transports.klaptransport:Starting handshake with 192.168.66.240
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/handshake1
    DEBUG:kasa.transports.klaptransport:Handshake1 posted at 2025-07-20 20:45:22.793551. Host is 192.168.66.240, Response status is 200, Request was xyz
    DEBUG:kasa.transports.klaptransport:Handshake1 success at 2025-07-20 20:45:22.793643. Host is 192.168.66.240, Server remote_seed is: xyz, server hash is: xyz
    DEBUG:kasa.transports.klaptransport:Device response did not match our challenge on ip 192.168.66.240, check that your e-mail and password (both case-sensitive) are correct. 
    DEBUG:kasa.protocols.smartprotocol:Unable to authenticate with 192.168.66.240, not retrying: Device response did not match our challenge on ip 192.168.66.240, check that your e-mail and password (both case-sensitive) are correct. 
    == Authentication failed for device ==
    	== Discovery Result ==
    	Device Type:        SMART.TAPOPLUG
    	Device Model:       P316M(US)
    	IP:                 192.168.66.240
    	MAC:                yyyy
    	Device Id (hash):   xx
    	Owner (hash):       xx
    	Supports IOT Cloud: True
    	OBD Src:            tss
    	Encrypt Type:       KLAP
    	HTTP Port:          80
    	Login version:      2
    
    
    DEBUG:kasa.smart.smartdevice:Querying 192.168.66.240 for modules: 
    Raised error: get_device_info not found in {} for device 192.168.66.240
    Traceback (most recent call last):
      File "/root/python-kasa/.venv/bin/kasa", line 10, in <module>
        sys.exit(cli())
                 ^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 282, in __call__
        asyncio.run(self.main(*args, **kwargs))
      File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
        return runner.run(main)
               ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
        return self._loop.run_until_complete(task)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1126, in main
        rv = await self.invoke(ctx)
             ^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 270, in invoke
        _handle_exception(self._debug, exc)
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 268, in invoke
        return await super().invoke(ctx)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1728, in invoke
        rv = await super().invoke(ctx)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1496, in invoke
        return await ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 829, in invoke
        rv = await rv
             ^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/main.py", line 370, in cli
        await dev.update()
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 277, in update
        resp = await self._modular_update(first_update, now)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 357, in _modular_update
        self._update_internal_info(info_resp)
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 259, in _update_internal_info
        self._info = self._try_get_response(info_resp, "get_device_info")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/smart/smartdevice.py", line 196, in _try_get_response
        raise KasaException(
    kasa.exceptions.KasaException: get_device_info not found in {} for device 192.168.66.240
    root@kasapi:~/python-kasa# 

    The username and password I used is correct, and the above test on a P115 work fine without complaint about "check password" so I speculate this device may use a different kind of API methods?

  2. TheLinuxGuy commented on Jul 23, 2025

    ContributorAuthor

    Actually @rytilahti helped me out in another bug and I have been able to get further with this new device (it was provisioned via tss so I had to disconnect all my tp-link devices, reset to factory then re-associate manually). Now I am getting further with the device BUT I get no power insights.

    Here is an error when using kasa usage on P316M

    root@kasapi:~/python-kasa# uv run kasa --username xx --password xx --host 192.168.66.240 --debug usage
    Discovering device 192.168.66.240 for 10 seconds
    DEBUG:kasa.discover:[DISCOVERY] 192.168.66.240 >> {'system': {'get_sysinfo': {}}}
    DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
    DEBUG:kasa.device_factory:Using SmartDevice for SMART.TAPOPLUG
    DEBUG:kasa.device_factory:Finding protocol for 192.168.66.240
    DEBUG:kasa.device_factory:Finding protocol for DeviceFamily.SmartTapoPlug
    DEBUG:kasa.device_factory:Finding transport for SMART.KLAP
    DEBUG:kasa.transports.klaptransport:Created KLAP transport for 192.168.66.240
    DEBUG:kasa.discover:[DISCOVERY] 192.168.66.240 << {'error_code': 0,
     'result': {'device_id': 'REDACTED_7660474ec87754b192de851',
                'device_model': 'P316M(US)',
                'device_type': 'SMART.TAPOPLUG',
                'factory_default': False,
                'ip': '192.168.66.240',
                'is_support_iot_cloud': True,
                'mac': 'A8-29-48-00-00-00',
                'mgt_encrypt_schm': {'encrypt_type': 'KLAP',
                                     'http_port': 80,
                                     'is_support_https': False,
                                     'lv': 2},
                'obd_src': 'tplink',
                'owner': 'REDACTED_9B39D2FAC3B5C9FCBA4CA81',
                'protocol_version': 1}}
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartdevice.SmartDevice'>
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1753308515223,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}'
    DEBUG:kasa.transports.klaptransport:Starting handshake with 192.168.66.240
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/handshake1
    DEBUG:kasa.transports.klaptransport:Handshake1 posted at 2025-07-23 18:08:35.251803. Host is 192.168.66.240, Response status is 200, Request was aae7d06f1dc681ca6ab52e93eb2eb854
    DEBUG:kasa.transports.klaptransport:Handshake1 success at 2025-07-23 18:08:35.251876. Host is 192.168.66.240, Server remote_seed is: 7b6f1f0bf5f11c096bb69e082c799f09, server hash is: 92018a9fc71c434c91902c768d724029c8b2726fc78152ea77e058b196f875ed
    DEBUG:kasa.transports.klaptransport:handshake1 hashes match with expected credentials
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/handshake2
    DEBUG:kasa.transports.klaptransport:Handshake2 posted 2025-07-23 18:08:35.271720. Host is 192.168.66.240, Response status is 200, Request was 5fca14c2234adfba64b6496787275d22681cdf2b3304ef50b05ed64d969e1ca2
    DEBUG:kasa.transports.klaptransport:Handshake with 192.168.66.240 complete
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646792, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1753308515223,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 << {'error_code': 0,
     'result': {'responses': [{'error_code': 0,
                               'method': 'component_nego',
                               'result': {'component_list': [{'id': 'device',
                                                              'ver_code': 2},
                                                             {'id': 'firmware',
                                                              'ver_code': 2},
                                                             {'id': 'quick_setup',
                                                              'ver_code': 3},
                                                             {'id': 'time',
                                                              'ver_code': 1},
                                                             {'id': 'wireless',
                                                              'ver_code': 1},
                                                             {'id': 'schedule',
                                                              'ver_code': 2},
                                                             {'id': 'countdown',
                                                              'ver_code': 2},
                                                             {'id': 'antitheft',
                                                              'ver_code': 1},
                                                             {'id': 'account',
                                                              'ver_code': 1},
                                                             {'id': 'synchronize',
                                                              'ver_code': 1},
                                                             {'id': 'sunrise_sunset',
                                                              'ver_code': 1},
                                                             {'id': 'led',
                                                              'ver_code': 1},
                                                             {'id': 'cloud_connect',
                                                              'ver_code': 1},
                                                             {'id': 'iot_cloud',
                                                              'ver_code': 1},
                                                             {'id': 'device_local_time',
                                                              'ver_code': 1},
                                                             {'id': 'default_states',
                                                              'ver_code': 1},
                                                             {'id': 'control_child',
                                                              'ver_code': 2},
                                                             {'id': 'child_device',
                                                              'ver_code': 2},
                                                             {'id': 'localSmart',
                                                              'ver_code': 1},
                                                             {'id': 'matter',
                                                              'ver_code': 3},
                                                             {'id': 'auto_off',
                                                              'ver_code': 2},
                                                             {'id': 'energy_monitoring',
                                                              'ver_code': 2},
                                                             {'id': 'current_protection',
                                                              'ver_code': 1},
                                                             {'id': 'power_protection',
                                                              'ver_code': 1},
                                                             {'id': 'charging_protection',
                                                              'ver_code': 2}]}},
                              {'error_code': 0,
                               'method': 'get_device_info',
                               'result': {'avatar': '',
                                          'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                          'fw_id': 'REDACTED_00000000000000000000000',
                                          'fw_ver': '1.0.5 Build 250306 Rel.151943',
                                          'has_set_location_info': False,
                                          'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                          'hw_ver': '1.6',
                                          'ip': '192.168.66.240',
                                          'lang': '',
                                          'latitude': 0,
                                          'longitude': 0,
                                          'mac': 'A8-29-48-00-00-00',
                                          'model': 'P316M',
                                          'nickname': '',
                                          'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                          'region': 'America/New_York',
                                          'rssi': -47,
                                          'signal_level': 3,
                                          'specs': 'US',
                                          'ssid': 'I01BU0tFRF9TU0lEIw==',
                                          'time_diff': -300,
                                          'type': 'SMART.TAPOPLUG'}},
                              {'error_code': 0,
                               'method': 'get_connect_cloud_state',
                               'result': {'status': 0}}]}}
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1753308515344,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"requests":[{"method":"get_child_device_component_list"},{"method":"get_child_device_list"}]}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646793, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1753308515344,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"requests":[{"method":"get_child_device_component_list"},{"method":"get_child_device_list"}]}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 << {'error_code': 0,
     'result': {'responses': [{'error_code': 0,
                               'method': 'get_child_device_component_list',
                               'result': {'child_component_list': [{'component_list': [{'id': 'device',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'quick_setup',
                                                                                        'ver_code': 3},
                                                                                       {'id': 'time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'device_local_time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'schedule',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'countdown',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'antitheft',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'account',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'synchronize',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'sunrise_sunset',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'cloud_connect',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'iot_cloud',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'firmware',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'default_states',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'localSmart',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'auto_off',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'energy_monitoring',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'current_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'power_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'charging_protection',
                                                                                        'ver_code': 2}],
                                                                    'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF900'},
                                                                   {'component_list': [{'id': 'device',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'quick_setup',
                                                                                        'ver_code': 3},
                                                                                       {'id': 'time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'device_local_time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'schedule',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'countdown',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'antitheft',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'account',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'synchronize',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'sunrise_sunset',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'cloud_connect',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'iot_cloud',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'firmware',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'default_states',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'localSmart',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'auto_off',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'energy_monitoring',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'current_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'power_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'charging_protection',
                                                                                        'ver_code': 2}],
                                                                    'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF901'},
                                                                   {'component_list': [{'id': 'device',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'quick_setup',
                                                                                        'ver_code': 3},
                                                                                       {'id': 'time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'device_local_time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'schedule',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'countdown',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'antitheft',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'account',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'synchronize',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'sunrise_sunset',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'cloud_connect',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'iot_cloud',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'firmware',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'default_states',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'localSmart',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'auto_off',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'energy_monitoring',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'current_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'power_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'charging_protection',
                                                                                        'ver_code': 2}],
                                                                    'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF902'},
                                                                   {'component_list': [{'id': 'device',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'quick_setup',
                                                                                        'ver_code': 3},
                                                                                       {'id': 'time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'device_local_time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'schedule',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'countdown',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'antitheft',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'account',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'synchronize',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'sunrise_sunset',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'cloud_connect',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'iot_cloud',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'firmware',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'default_states',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'localSmart',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'auto_off',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'energy_monitoring',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'current_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'power_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'charging_protection',
                                                                                        'ver_code': 2}],
                                                                    'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF903'},
                                                                   {'component_list': [{'id': 'device',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'quick_setup',
                                                                                        'ver_code': 3},
                                                                                       {'id': 'time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'device_local_time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'schedule',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'countdown',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'antitheft',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'account',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'synchronize',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'sunrise_sunset',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'cloud_connect',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'iot_cloud',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'firmware',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'default_states',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'localSmart',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'auto_off',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'energy_monitoring',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'current_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'power_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'charging_protection',
                                                                                        'ver_code': 2}],
                                                                    'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF904'},
                                                                   {'component_list': [{'id': 'device',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'quick_setup',
                                                                                        'ver_code': 3},
                                                                                       {'id': 'time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'device_local_time',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'schedule',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'countdown',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'antitheft',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'account',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'synchronize',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'sunrise_sunset',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'cloud_connect',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'iot_cloud',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'firmware',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'default_states',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'localSmart',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'auto_off',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'energy_monitoring',
                                                                                        'ver_code': 2},
                                                                                       {'id': 'current_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'power_protection',
                                                                                        'ver_code': 1},
                                                                                       {'id': 'charging_protection',
                                                                                        'ver_code': 2}],
                                                                    'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF905'}],
                                          'start_index': 0,
                                          'sum': 6}},
                              {'error_code': 0,
                               'method': 'get_child_device_list',
                               'result': {'child_device_list': [{'auto_off_remain_time': 0,
                                                                 'auto_off_status': 'off',
                                                                 'avatar': 'plug',
                                                                 'bind_count': 1,
                                                                 'category': 'plug.powerstrip.sub-plug',
                                                                 'charging_status': 'normal',
                                                                 'default_states': {'type': 'last_states'},
                                                                 'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF900',
                                                                 'device_on': True,
                                                                 'fw_id': 'REDACTED_00000000000000000000000',
                                                                 'fw_ver': '1.0.5 '
                                                                           'Build '
                                                                           '250306 '
                                                                           'Rel.151943',
                                                                 'has_set_location_info': False,
                                                                 'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                                                 'hw_ver': '1.6',
                                                                 'is_usb': False,
                                                                 'latitude': 0,
                                                                 'longitude': 0,
                                                                 'mac': 'A82948000000',
                                                                 'model': 'P316M',
                                                                 'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                                 'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                                                 'on_off': 1,
                                                                 'on_time': 1586,
                                                                 'original_device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                                                 'overcurrent_status': 'normal',
                                                                 'position': 1,
                                                                 'power_protection_status': 'normal',
                                                                 'region': 'America/New_York',
                                                                 'slot_number': 6,
                                                                 'status_follow_edge': True,
                                                                 'type': 'SMART.TAPOPLUG'},
                                                                {'auto_off_remain_time': 0,
                                                                 'auto_off_status': 'off',
                                                                 'avatar': 'plug',
                                                                 'bind_count': 1,
                                                                 'category': 'plug.powerstrip.sub-plug',
                                                                 'charging_status': 'normal',
                                                                 'default_states': {'type': 'last_states'},
                                                                 'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF901',
                                                                 'device_on': True,
                                                                 'fw_id': 'REDACTED_00000000000000000000000',
                                                                 'fw_ver': '1.0.5 '
                                                                           'Build '
                                                                           '250306 '
                                                                           'Rel.151943',
                                                                 'has_set_location_info': False,
                                                                 'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                                                 'hw_ver': '1.6',
                                                                 'is_usb': False,
                                                                 'latitude': 0,
                                                                 'longitude': 0,
                                                                 'mac': 'A82948000000',
                                                                 'model': 'P316M',
                                                                 'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                                 'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                                                 'on_off': 1,
                                                                 'on_time': 1586,
                                                                 'original_device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                                                 'overcurrent_status': 'normal',
                                                                 'position': 2,
                                                                 'power_protection_status': 'normal',
                                                                 'region': 'America/New_York',
                                                                 'slot_number': 6,
                                                                 'status_follow_edge': True,
                                                                 'type': 'SMART.TAPOPLUG'},
                                                                {'auto_off_remain_time': 0,
                                                                 'auto_off_status': 'off',
                                                                 'avatar': 'plug',
                                                                 'bind_count': 1,
                                                                 'category': 'plug.powerstrip.sub-plug',
                                                                 'charging_status': 'normal',
                                                                 'default_states': {'type': 'last_states'},
                                                                 'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF902',
                                                                 'device_on': True,
                                                                 'fw_id': 'REDACTED_00000000000000000000000',
                                                                 'fw_ver': '1.0.5 '
                                                                           'Build '
                                                                           '250306 '
                                                                           'Rel.151943',
                                                                 'has_set_location_info': False,
                                                                 'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                                                 'hw_ver': '1.6',
                                                                 'is_usb': False,
                                                                 'latitude': 0,
                                                                 'longitude': 0,
                                                                 'mac': 'A82948000000',
                                                                 'model': 'P316M',
                                                                 'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                                 'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                                                 'on_off': 1,
                                                                 'on_time': 1586,
                                                                 'original_device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                                                 'overcurrent_status': 'normal',
                                                                 'position': 3,
                                                                 'power_protection_status': 'normal',
                                                                 'region': 'America/New_York',
                                                                 'slot_number': 6,
                                                                 'status_follow_edge': True,
                                                                 'type': 'SMART.TAPOPLUG'},
                                                                {'auto_off_remain_time': 0,
                                                                 'auto_off_status': 'off',
                                                                 'avatar': 'plug',
                                                                 'bind_count': 1,
                                                                 'category': 'plug.powerstrip.sub-plug',
                                                                 'charging_status': 'normal',
                                                                 'default_states': {'type': 'last_states'},
                                                                 'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF903',
                                                                 'device_on': True,
                                                                 'fw_id': 'REDACTED_00000000000000000000000',
                                                                 'fw_ver': '1.0.5 '
                                                                           'Build '
                                                                           '250306 '
                                                                           'Rel.151943',
                                                                 'has_set_location_info': False,
                                                                 'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                                                 'hw_ver': '1.6',
                                                                 'is_usb': False,
                                                                 'latitude': 0,
                                                                 'longitude': 0,
                                                                 'mac': 'A82948000000',
                                                                 'model': 'P316M',
                                                                 'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                                 'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                                                 'on_off': 1,
                                                                 'on_time': 1586,
                                                                 'original_device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                                                 'overcurrent_status': 'normal',
                                                                 'position': 4,
                                                                 'power_protection_status': 'normal',
                                                                 'region': 'America/New_York',
                                                                 'slot_number': 6,
                                                                 'status_follow_edge': True,
                                                                 'type': 'SMART.TAPOPLUG'},
                                                                {'auto_off_remain_time': 0,
                                                                 'auto_off_status': 'off',
                                                                 'avatar': 'plug',
                                                                 'bind_count': 1,
                                                                 'category': 'plug.powerstrip.sub-plug',
                                                                 'charging_status': 'normal',
                                                                 'default_states': {'type': 'last_states'},
                                                                 'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF904',
                                                                 'device_on': True,
                                                                 'fw_id': 'REDACTED_00000000000000000000000',
                                                                 'fw_ver': '1.0.5 '
                                                                           'Build '
                                                                           '250306 '
                                                                           'Rel.151943',
                                                                 'has_set_location_info': False,
                                                                 'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                                                 'hw_ver': '1.6',
                                                                 'is_usb': False,
                                                                 'latitude': 0,
                                                                 'longitude': 0,
                                                                 'mac': 'A82948000000',
                                                                 'model': 'P316M',
                                                                 'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                                 'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                                                 'on_off': 1,
                                                                 'on_time': 1586,
                                                                 'original_device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                                                 'overcurrent_status': 'normal',
                                                                 'position': 5,
                                                                 'power_protection_status': 'normal',
                                                                 'region': 'America/New_York',
                                                                 'slot_number': 6,
                                                                 'status_follow_edge': True,
                                                                 'type': 'SMART.TAPOPLUG'},
                                                                {'auto_off_remain_time': 0,
                                                                 'auto_off_status': 'off',
                                                                 'avatar': 'plug',
                                                                 'bind_count': 1,
                                                                 'category': 'plug.powerstrip.sub-plug',
                                                                 'charging_status': 'normal',
                                                                 'default_states': {'type': 'last_states'},
                                                                 'device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF905',
                                                                 'device_on': True,
                                                                 'fw_id': 'REDACTED_00000000000000000000000',
                                                                 'fw_ver': '1.0.5 '
                                                                           'Build '
                                                                           '250306 '
                                                                           'Rel.151943',
                                                                 'has_set_location_info': False,
                                                                 'hw_id': 'REDACTED_20427DA56CDE7809167A79E',
                                                                 'hw_ver': '1.6',
                                                                 'is_usb': False,
                                                                 'latitude': 0,
                                                                 'longitude': 0,
                                                                 'mac': 'A82948000000',
                                                                 'model': 'P316M',
                                                                 'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                                 'oem_id': 'REDACTED_4CAEE8BE9E3E923D29DC8A0',
                                                                 'on_off': 1,
                                                                 'on_time': 1586,
                                                                 'original_device_id': 'REDACTED_DB6889D90BF8E7AAB04CD47242AAAF9',
                                                                 'overcurrent_status': 'normal',
                                                                 'position': 6,
                                                                 'power_protection_status': 'normal',
                                                                 'region': 'America/New_York',
                                                                 'slot_number': 6,
                                                                 'status_follow_edge': True,
                                                                 'type': 'SMART.TAPOPLUG'}],
                                          'start_index': 0,
                                          'sum': 6}}]}}
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required child_device, adding ChildDevice to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required cloud_connect, adding Cloud to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required device, adding DeviceModule to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required firmware, adding Firmware to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required led, adding Led to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required matter, adding Matter to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required time, adding Time to modules.
    DEBUG:kasa.smart.smartdevice:Querying 192.168.66.240 for modules: Time, Firmware, Led, Matter
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1753308515527,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"requests":[{"method":"get_device_time"},{"method":"get_auto_update_info"},{"method":"get_led_info"},{"method":"get_matter_setup_info"}]}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646794, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1753308515527,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"requests":[{"method":"get_device_time"},{"method":"get_auto_update_info"},{"method":"get_led_info"},{"method":"get_matter_setup_info"}]}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 multi-request-batch-1-of-1 << {'error_code': 0,
     'result': {'responses': [{'error_code': 0,
                               'method': 'get_device_time',
                               'result': {'region': 'America/New_York',
                                          'time_diff': -300,
                                          'timestamp': 1753308514}},
                              {'error_code': 0,
                               'method': 'get_auto_update_info',
                               'result': {'enable': True,
                                          'random_range': 120,
                                          'time': 180}},
                              {'error_code': 0,
                               'method': 'get_led_info',
                               'result': {'led_rule': 'always',
                                          'led_status': True,
                                          'night_mode': {'end_time': 420,
                                                         'night_mode_type': 'custom',
                                                         'start_time': 1320}}},
                              {'error_code': 0,
                               'method': 'get_matter_setup_info',
                               'result': {'setup_code': '00000000000',
                                          'setup_payload': '00:0000000000000000000'}}]}}
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartchilddevice.SmartChildDevice'>
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Created child device <DeviceType.Plug Smart Plug 1 (None) of <DeviceType.Strip at 192.168.66.240 - None (P316M)>> for 192.168.66.240
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartchilddevice.SmartChildDevice'>
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Created child device <DeviceType.Plug Smart Plug 2 (None) of <DeviceType.Strip at 192.168.66.240 - None (P316M)>> for 192.168.66.240
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartchilddevice.SmartChildDevice'>
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Created child device <DeviceType.Plug Smart Plug 3 (None) of <DeviceType.Strip at 192.168.66.240 - None (P316M)>> for 192.168.66.240
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartchilddevice.SmartChildDevice'>
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Created child device <DeviceType.Plug Smart Plug 4 (None) of <DeviceType.Strip at 192.168.66.240 - None (P316M)>> for 192.168.66.240
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartchilddevice.SmartChildDevice'>
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Created child device <DeviceType.Plug Smart Plug 5 (None) of <DeviceType.Strip at 192.168.66.240 - None (P316M)>> for 192.168.66.240
    DEBUG:kasa.device:Initializing 192.168.66.240 of type <class 'kasa.smart.smartchilddevice.SmartChildDevice'>
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 192.168.66.240, found required power_protection, adding PowerProtection to modules.
    DEBUG:kasa.smart.smartdevice:Created child device <DeviceType.Plug Smart Plug 6 (None) of <DeviceType.Strip at 192.168.66.240 - None (P316M)>> for 192.168.66.240
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 >> '{"method":"control_child","request_time_milis":1753308515553,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF900","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646795, Response status is 200, Request was {"method":"control_child","request_time_milis":1753308515553,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF900","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 << {'error_code': 0,
     'result': {'responseData': {'result': {'responses': [{'error_code': 0,
                                                           'method': 'get_auto_off_config',
                                                           'result': {'delay_min': 120,
                                                                      'enable': False}},
                                                          {'error_code': 0,
                                                           'method': 'get_energy_usage',
                                                           'result': {'electricity_charge': [0,
                                                                                             0,
                                                                                             0],
                                                                      'local_time': '2025-07-23 '
                                                                                    '18:08:34',
                                                                      'month_energy': 0,
                                                                      'month_runtime': 25,
                                                                      'today_energy': 0,
                                                                      'today_runtime': 25}},
                                                          {'error_code': 0,
                                                           'method': 'get_current_power',
                                                           'result': {'current_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_data',
                                                           'result': {'current_ma': 0,
                                                                      'energy_wh': 0,
                                                                      'power_mw': 0,
                                                                      'voltage_mv': 120760}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_vgain_igain',
                                                           'result': {'data': [{'igain': 3821,
                                                                                'slot_id': 0,
                                                                                'vgain': 30247},
                                                                               {'igain': 3821,
                                                                                'slot_id': 1,
                                                                                'vgain': 30224},
                                                                               {'igain': 3821,
                                                                                'slot_id': 2,
                                                                                'vgain': 29991},
                                                                               {'igain': 3803,
                                                                                'slot_id': 3,
                                                                                'vgain': 30096},
                                                                               {'igain': 3779,
                                                                                'slot_id': 4,
                                                                                'vgain': 30203},
                                                                               {'igain': 3852,
                                                                                'slot_id': 5,
                                                                                'vgain': 30158}]}},
                                                          {'error_code': 0,
                                                           'method': 'get_protection_power',
                                                           'result': {'protection_enabled': False,
                                                                      'protection_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_max_power',
                                                           'result': {'max_power': 1644}}]}}}}
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 >> '{"method":"control_child","request_time_milis":1753308515648,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF901","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646796, Response status is 200, Request was {"method":"control_child","request_time_milis":1753308515648,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF901","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 << {'error_code': 0,
     'result': {'responseData': {'result': {'responses': [{'error_code': 0,
                                                           'method': 'get_auto_off_config',
                                                           'result': {'delay_min': 120,
                                                                      'enable': False}},
                                                          {'error_code': 0,
                                                           'method': 'get_energy_usage',
                                                           'result': {'electricity_charge': [0,
                                                                                             0,
                                                                                             0],
                                                                      'local_time': '2025-07-23 '
                                                                                    '18:08:34',
                                                                      'month_energy': 0,
                                                                      'month_runtime': 25,
                                                                      'today_energy': 0,
                                                                      'today_runtime': 25}},
                                                          {'error_code': 0,
                                                           'method': 'get_current_power',
                                                           'result': {'current_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_data',
                                                           'result': {'current_ma': 0,
                                                                      'energy_wh': 0,
                                                                      'power_mw': 0,
                                                                      'voltage_mv': 120668}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_vgain_igain',
                                                           'result': {'data': [{'igain': 3821,
                                                                                'slot_id': 0,
                                                                                'vgain': 30247},
                                                                               {'igain': 3821,
                                                                                'slot_id': 1,
                                                                                'vgain': 30224},
                                                                               {'igain': 3821,
                                                                                'slot_id': 2,
                                                                                'vgain': 29991},
                                                                               {'igain': 3803,
                                                                                'slot_id': 3,
                                                                                'vgain': 30096},
                                                                               {'igain': 3779,
                                                                                'slot_id': 4,
                                                                                'vgain': 30203},
                                                                               {'igain': 3852,
                                                                                'slot_id': 5,
                                                                                'vgain': 30158}]}},
                                                          {'error_code': 0,
                                                           'method': 'get_protection_power',
                                                           'result': {'protection_enabled': False,
                                                                      'protection_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_max_power',
                                                           'result': {'max_power': 1643}}]}}}}
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 >> '{"method":"control_child","request_time_milis":1753308515733,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF902","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646797, Response status is 200, Request was {"method":"control_child","request_time_milis":1753308515733,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF902","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 << {'error_code': 0,
     'result': {'responseData': {'result': {'responses': [{'error_code': 0,
                                                           'method': 'get_auto_off_config',
                                                           'result': {'delay_min': 120,
                                                                      'enable': False}},
                                                          {'error_code': 0,
                                                           'method': 'get_energy_usage',
                                                           'result': {'electricity_charge': [0,
                                                                                             0,
                                                                                             0],
                                                                      'local_time': '2025-07-23 '
                                                                                    '18:08:34',
                                                                      'month_energy': 16,
                                                                      'month_runtime': 25,
                                                                      'today_energy': 16,
                                                                      'today_runtime': 25}},
                                                          {'error_code': 0,
                                                           'method': 'get_current_power',
                                                           'result': {'current_power': 37}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_data',
                                                           'result': {'current_ma': 325,
                                                                      'energy_wh': 16,
                                                                      'power_mw': 37643,
                                                                      'voltage_mv': 119958}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_vgain_igain',
                                                           'result': {'data': [{'igain': 3821,
                                                                                'slot_id': 0,
                                                                                'vgain': 30247},
                                                                               {'igain': 3821,
                                                                                'slot_id': 1,
                                                                                'vgain': 30224},
                                                                               {'igain': 3821,
                                                                                'slot_id': 2,
                                                                                'vgain': 29991},
                                                                               {'igain': 3803,
                                                                                'slot_id': 3,
                                                                                'vgain': 30096},
                                                                               {'igain': 3779,
                                                                                'slot_id': 4,
                                                                                'vgain': 30203},
                                                                               {'igain': 3852,
                                                                                'slot_id': 5,
                                                                                'vgain': 30158}]}},
                                                          {'error_code': 0,
                                                           'method': 'get_protection_power',
                                                           'result': {'protection_enabled': False,
                                                                      'protection_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_max_power',
                                                           'result': {'max_power': 1633}}]}}}}
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 >> '{"method":"control_child","request_time_milis":1753308515827,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF903","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646798, Response status is 200, Request was {"method":"control_child","request_time_milis":1753308515827,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF903","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 << {'error_code': 0,
     'result': {'responseData': {'result': {'responses': [{'error_code': 0,
                                                           'method': 'get_auto_off_config',
                                                           'result': {'delay_min': 120,
                                                                      'enable': False}},
                                                          {'error_code': 0,
                                                           'method': 'get_energy_usage',
                                                           'result': {'electricity_charge': [0,
                                                                                             0,
                                                                                             0],
                                                                      'local_time': '2025-07-23 '
                                                                                    '18:08:34',
                                                                      'month_energy': 0,
                                                                      'month_runtime': 25,
                                                                      'today_energy': 0,
                                                                      'today_runtime': 25}},
                                                          {'error_code': 0,
                                                           'method': 'get_current_power',
                                                           'result': {'current_power': 2}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_data',
                                                           'result': {'current_ma': 84,
                                                                      'energy_wh': 0,
                                                                      'power_mw': 2019,
                                                                      'voltage_mv': 120378}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_vgain_igain',
                                                           'result': {'data': [{'igain': 3821,
                                                                                'slot_id': 0,
                                                                                'vgain': 30247},
                                                                               {'igain': 3821,
                                                                                'slot_id': 1,
                                                                                'vgain': 30224},
                                                                               {'igain': 3821,
                                                                                'slot_id': 2,
                                                                                'vgain': 29991},
                                                                               {'igain': 3803,
                                                                                'slot_id': 3,
                                                                                'vgain': 30096},
                                                                               {'igain': 3779,
                                                                                'slot_id': 4,
                                                                                'vgain': 30203},
                                                                               {'igain': 3852,
                                                                                'slot_id': 5,
                                                                                'vgain': 30158}]}},
                                                          {'error_code': 0,
                                                           'method': 'get_protection_power',
                                                           'result': {'protection_enabled': False,
                                                                      'protection_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_max_power',
                                                           'result': {'max_power': 1638}}]}}}}
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 >> '{"method":"control_child","request_time_milis":1753308515962,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF904","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646799, Response status is 200, Request was {"method":"control_child","request_time_milis":1753308515962,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF904","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 << {'error_code': 0,
     'result': {'responseData': {'result': {'responses': [{'error_code': 0,
                                                           'method': 'get_auto_off_config',
                                                           'result': {'delay_min': 120,
                                                                      'enable': False}},
                                                          {'error_code': 0,
                                                           'method': 'get_energy_usage',
                                                           'result': {'electricity_charge': [0,
                                                                                             0,
                                                                                             0],
                                                                      'local_time': '2025-07-23 '
                                                                                    '18:08:35',
                                                                      'month_energy': 0,
                                                                      'month_runtime': 25,
                                                                      'today_energy': 0,
                                                                      'today_runtime': 25}},
                                                          {'error_code': 0,
                                                           'method': 'get_current_power',
                                                           'result': {'current_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_data',
                                                           'result': {'current_ma': 0,
                                                                      'energy_wh': 0,
                                                                      'power_mw': 0,
                                                                      'voltage_mv': 120635}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_vgain_igain',
                                                           'result': {'data': [{'igain': 3821,
                                                                                'slot_id': 0,
                                                                                'vgain': 30247},
                                                                               {'igain': 3821,
                                                                                'slot_id': 1,
                                                                                'vgain': 30224},
                                                                               {'igain': 3821,
                                                                                'slot_id': 2,
                                                                                'vgain': 29991},
                                                                               {'igain': 3803,
                                                                                'slot_id': 3,
                                                                                'vgain': 30096},
                                                                               {'igain': 3779,
                                                                                'slot_id': 4,
                                                                                'vgain': 30203},
                                                                               {'igain': 3852,
                                                                                'slot_id': 5,
                                                                                'vgain': 30158}]}},
                                                          {'error_code': 0,
                                                           'method': 'get_protection_power',
                                                           'result': {'protection_enabled': False,
                                                                      'protection_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_max_power',
                                                           'result': {'max_power': 1642}}]}}}}
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 >> '{"method":"control_child","request_time_milis":1753308516054,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF905","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}'
    DEBUG:kasa.httpclient:Posting to http://192.168.66.240/app/request
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query posted Host is 192.168.66.240, Sequence is 1208646800, Response status is 200, Request was {"method":"control_child","request_time_milis":1753308516054,"terminal_uuid":"SvrJz1XnGiv706l7S92qhA==","params":{"device_id":"8022F9F21DB6889D90BF8E7AAB04CD47242AAAF905","requestData":{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_emeter_data"},{"method":"get_emeter_vgain_igain"},{"method":"get_protection_power"},{"method":"get_max_power"}]}}}}
    DEBUG:kasa.transports.klaptransport:Device 192.168.66.240 query response received
    DEBUG:kasa.protocols.smartprotocol:192.168.66.240 << {'error_code': 0,
     'result': {'responseData': {'result': {'responses': [{'error_code': 0,
                                                           'method': 'get_auto_off_config',
                                                           'result': {'delay_min': 120,
                                                                      'enable': False}},
                                                          {'error_code': 0,
                                                           'method': 'get_energy_usage',
                                                           'result': {'electricity_charge': [0,
                                                                                             0,
                                                                                             0],
                                                                      'local_time': '2025-07-23 '
                                                                                    '18:08:35',
                                                                      'month_energy': 0,
                                                                      'month_runtime': 25,
                                                                      'today_energy': 0,
                                                                      'today_runtime': 25}},
                                                          {'error_code': 0,
                                                           'method': 'get_current_power',
                                                           'result': {'current_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_data',
                                                           'result': {'current_ma': 0,
                                                                      'energy_wh': 0,
                                                                      'power_mw': 0,
                                                                      'voltage_mv': 120456}},
                                                          {'error_code': 0,
                                                           'method': 'get_emeter_vgain_igain',
                                                           'result': {'data': [{'igain': 3821,
                                                                                'slot_id': 0,
                                                                                'vgain': 30247},
                                                                               {'igain': 3821,
                                                                                'slot_id': 1,
                                                                                'vgain': 30224},
                                                                               {'igain': 3821,
                                                                                'slot_id': 2,
                                                                                'vgain': 29991},
                                                                               {'igain': 3803,
                                                                                'slot_id': 3,
                                                                                'vgain': 30096},
                                                                               {'igain': 3779,
                                                                                'slot_id': 4,
                                                                                'vgain': 30203},
                                                                               {'igain': 3852,
                                                                                'slot_id': 5,
                                                                                'vgain': 30158}]}},
                                                          {'error_code': 0,
                                                           'method': 'get_protection_power',
                                                           'result': {'protection_enabled': False,
                                                                      'protection_power': 0}},
                                                          {'error_code': 0,
                                                           'method': 'get_max_power',
                                                           'result': {'max_power': 1639}}]}}}}
    DEBUG:kasa.smart.smartdevice:Update completed 192.168.66.240: ['component_nego', 'get_device_info', 'get_connect_cloud_state', 'get_child_device_component_list', 'get_child_device_list', 'get_device_time', 'get_auto_update_info', 'get_led_info', 'get_matter_setup_info']
    == Usage ==
    Raised error: 'usage'
    Traceback (most recent call last):
      File "/root/python-kasa/.venv/bin/kasa", line 10, in <module>
        sys.exit(cli())
                 ^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 282, in __call__
        asyncio.run(self.main(*args, **kwargs))
      File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
        return runner.run(main)
               ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
        return self._loop.run_until_complete(task)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1126, in main
        rv = await self.invoke(ctx)
             ^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 270, in invoke
        _handle_exception(self._debug, exc)
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 268, in invoke
        return await super().invoke(ctx)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1750, in invoke
        return await _process_result(await sub_ctx.command.invoke(sub_ctx))
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 1496, in invoke
        return await ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 829, in invoke
        rv = await rv
             ^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/common.py", line 161, in wrapper
        return await ctx.invoke(wrapped_function, dev, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/asyncclick/core.py", line 829, in invoke
        rv = await rv
             ^^^^^^^^
      File "/root/python-kasa/.venv/lib/python3.11/site-packages/kasa/cli/usage.py", line 88, in usage
        usage = cast(Usage, dev.modules["usage"])
                            ~~~~~~~~~~~^^^^^^^^^
    KeyError: 'usage'
  3. TheLinuxGuy commented on Jul 23, 2025

    ContributorAuthor

    Followed the instructions and created a PR to add this but its failing some tests, I think because of some unexpected power features this device adds that isn't supported yet?

    #1561

  4. github-actions commented on Oct 22, 2025

    There hasn't been any activity on this issue recently. This issue has been automatically marked as stale because of that. It will be closed if no further activity occurs.
    Please make sure to update to the latest python-kasa version and check if that solves the issue.
    Thank you for your contributions.

  5. HairNutz commented on Jul 7, 2026

    SUCCESS - P316M(US) Working with python-kasa 0.10.2

    Environment

    Ubuntu 24.04 LXC
    python-kasa 0.10.2
    Tapo P316M(US)
    Firmware: 1.4.1 Build 260420 Rel.012620

    Important

    The device DID NOT work initially.

    Before enabling "Third-Party Device" support in the Tapo app, I received:

    == Unsupported device ==

    Device Type: SMART.TAPOPLUG
    Device Model: P316M(US)
    Encrypt Type: TPAP
    Login version: 2

    Unable to create device

    The device was discoverable but could not be queried.

    What Fixed It

    1. Open Tapo app

    2. Enable:

      Third-Party Device Support

    3. After enabling Third-Party Device Support the device switched to using KLAP authentication instead of appearing as unsupported.

    4. Reset TP-Link account password.

    5. Use the TP-Link account EMAIL address and password with python-kasa.

    Before resetting my password I consistently received:

    AuthenticationError:
    Device response did not match our challenge on ip x.x.x.x

    The password stored in my Tapo app appeared valid for app login but would not authenticate from python-kasa.

    After resetting the TP-Link account password and using the newly reset password, authentication succeeded.

    Working Command

    kasa
    --host 192.168.1.xxx
    --type smart
    --username your_email@example.com \ #Case Sensitive
    --password 'YourPassword'
    state

    Useful Command

    kasa
    --host 192.168.1.xxx
    --type smart
    --username your_email@example.com
    --password 'YourPassword'
    feature

    This displays per-outlet:

    • Current consumption (W)
    • Voltage
    • Current
    • Daily consumption
    • Monthly consumption

    No Home Assistant required.

    Example Python Collection Script

    p316m_collect.py

    import subprocess
    import re
    from datetime import datetime

    result = subprocess.run(
    [
    "kasa",
    "--host", "192.168.1.x",
    "--type", "smart",
    "--username", "Your_Email@example.com",
    "--password", "YourPassword",
    "feature"
    ],
    capture_output=True,
    text=True
    )

    current_child = None

    for line in result.stdout.splitlines():

    m = re.search(r"== Child (.+) ==", line)
    if m:
        current_child = m.group(1)
        continue
    
    m = re.search(r"Current consumption .*: ([0-9.]+) W", line)
    if m and current_child:
        print(
            f"{datetime.now().isoformat()} "
            f"{current_child} "
            f"{m.group(1)}"
        )
    

    Example output:
    2026-07-07T17:10:27 Modem 8.3
    2026-07-07T17:10:27 UDMP 18.6
    2026-07-07T17:10:27 ProMax 16 35.6
    2026-07-07T17:10:27 LabPVE01 52.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Footer

      © 2026 GitHub, Inc.

      Back | FazBrowse Home | New Git URL