Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error when trying to discover new Tapo P110 plug #818

@buzo-ffm

Description

@buzo-ffm

I'm using the latest git version (commit 7507837) and am getting this error message when trying to discover new Tapo P110 plug:

$ kasa --debug discover
Discovering devices on 255.255.255.255 for 5 seconds
DEBUG:kasa.discover:[DISCOVERY] 255.255.255.255 >> {'system': {'get_sysinfo': None}}
DEBUG:kasa.discover:Waiting 5 seconds for responses...
DEBUG:kasa.aestransport:Created AES transport for 192.168.0.1
DEBUG:kasa.discover:[DISCOVERY] 192.168.0.1 << {'result': {'device_id': '3e76c313b903372794a293c412ac6cb9', 'owner': '', 'device_type': 'SMART.TAPOPLUG', 'device_model': 'P110(EU)', 'ip': '192.168.0.1', 'mac': 'A8-42-A1-D4-6D-FF', 'is_support_iot_cloud': True, 'obd_src': 'tplink', 'factory_default': True, 'mgt_encrypt_schm': {'is_support_https': False, 'encrypt_type': 'AES', 'http_port': 80, 'lv': 2}}, 'error_code': 0}
DEBUG:kasa.device:Initializing 192.168.0.1 of type <class 'kasa.smart.smartdevice.SmartDevice'>
DEBUG:kasa.smartprotocol:192.168.0.1 >> '{"method":"component_nego","params":null,"requestID":1216957516567678976,"request_time_milis":1710186881927,"terminal_uuid":"7zc7SQf75Tz9eiHiYwnmDQ=="}'
DEBUG:kasa.aestransport:Will perform handshaking...
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app
DEBUG:kasa.aestransport:Generating keypair
DEBUG:kasa.aestransport:Handshake params: {'key': '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXjTPw1aRDtVYxztNrMzpXHN2MClpDz9nB+WsKLJs8ED10i0H4HQVDTY3eZlg4jtTwhxEY1PzDTpWa6RL9cqm52/L7Xsv2n91TxTgIjMtFtIQMJUwQGxh1P8Y3xXd/GEIEAyFrW9TDYNCcszx2hMw1p/YqCp7qoen86Ul+W2UsFQIDAQAB\n-----END PUBLIC KEY-----\n'}
DEBUG:kasa.aestransport:Request {'method': 'handshake', 'params': {'key': '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXjTPw1aRDtVYxztNrMzpXHN2MClpDz9nB+WsKLJs8ED10i0H4HQVDTY3eZlg4jtTwhxEY1PzDTpWa6RL9cqm52/L7Xsv2n91TxTgIjMtFtIQMJUwQGxh1P8Y3xXd/GEIEAyFrW9TDYNCcszx2hMw1p/YqCp7qoen86Ul+W2UsFQIDAQAB\n-----END PUBLIC KEY-----\n'}}
DEBUG:kasa.aestransport:Device responded with: {'error_code': 0, 'result': {'key': 'jZ/hRS++h2mH5+iuftjX5QJm7rqPZG9UZv8q2iOJFYHjkt9GzeL2lKzSp+p8tTnfpRMNMmlbh3o7W+goAL66DybDPBPA2qz0EtYbo8SF1yqx0Wf4OFgjQp7EBFMD8oK18Wsju8BQ3tsaLMyLEJLV4NLo+UBAnmKr2e/ndR6DJtM='}}
DEBUG:kasa.aestransport:Handshake with 192.168.0.1 complete
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app
DEBUG:kasa.aestransport:Will perform handshaking...
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app
DEBUG:kasa.aestransport:Generating keypair
DEBUG:kasa.aestransport:Handshake params: {'key': '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMofrBKtki29w2XLOwIiBWQr+sbwiwkyFoO7rh6BGEHdQBJzUL3VzRre3lxervBrOTAC458YDBCzbU6dA4byQtwTcEhczlgxo97GdyV7VOx2Hia5MLIygyK5+7e1F33of88TIxmWH6oDB4I1LmhHj2ItTG8YWsAnL7GunFGqSwqwIDAQAB\n-----END PUBLIC KEY-----\n'}
DEBUG:kasa.aestransport:Request {'method': 'handshake', 'params': {'key': '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMofrBKtki29w2XLOwIiBWQr+sbwiwkyFoO7rh6BGEHdQBJzUL3VzRre3lxervBrOTAC458YDBCzbU6dA4byQtwTcEhczlgxo97GdyV7VOx2Hia5MLIygyK5+7e1F33of88TIxmWH6oDB4I1LmhHj2ItTG8YWsAnL7GunFGqSwqwIDAQAB\n-----END PUBLIC KEY-----\n'}}
DEBUG:kasa.aestransport:Device responded with: {'error_code': 0, 'result': {'key': 'YtrYoqoyANmEyFep9ZsU3PniuJX2o3wjOhMFg8F/hKgyNl4QhInR1ydOu459zmFjXbVKpTIQoTI+ONGeuK8W1jOxDHsJs8LLKgPN0LEdNxLwso/Ri5JwBCCSrgkwQZVmt27VZMVeC18josaWO08tbkjBHh8JcRvBf10rURjG1cQ='}}
DEBUG:kasa.aestransport:Handshake with 192.168.0.1 complete
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app
DEBUG:kasa.aestransport:192.168.0.1: logged in with default credentials
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app?token=BDCD710F98DAF10D0F48F30D1D03F30C
DEBUG:kasa.smartprotocol:192.168.0.1 << {'error_code': 0,
 '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': 'auto_off', 'ver_code': 2},
                               {'id': 'energy_monitoring', 'ver_code': 2},
                               {'id': 'power_protection', 'ver_code': 1}]}}
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.alarmmodule.AlarmModule'> requires alarm
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.autooffmodule.AutoOffModule'> requires auto_off
DEBUG:kasa.smart.smartdevice:Found required auto_off, adding AutoOffModule to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.battery.BatterySensor'> requires battery_detect
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.brightness.Brightness'> requires brightness
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.childdevicemodule.ChildDeviceModule'> requires child_device
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.cloudmodule.CloudModule'> requires cloud_connect
DEBUG:kasa.smart.smartdevice:Found required cloud_connect, adding CloudModule to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.devicemodule.DeviceModule'> requires device
DEBUG:kasa.smart.smartdevice:Found required device, adding DeviceModule to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.energymodule.EnergyModule'> requires energy_monitoring
DEBUG:kasa.smart.smartdevice:Found required energy_monitoring, adding EnergyModule to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.firmware.Firmware'> requires firmware
DEBUG:kasa.smart.smartdevice:Found required firmware, adding Firmware to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.humidity.HumiditySensor'> requires humidity
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.ledmodule.LedModule'> requires led
DEBUG:kasa.smart.smartdevice:Found required led, adding LedModule to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.lighttransitionmodule.LightTransitionModule'> requires on_off_gradually
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.reportmodule.ReportModule'> requires report_mode
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.temperature.TemperatureSensor'> requires temperature
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.timemodule.TimeModule'> requires time
DEBUG:kasa.smart.smartdevice:Found required time, adding TimeModule to modules.
DEBUG:kasa.smartprotocol:192.168.0.1 multi-request-batch-1 >> '{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_connect_cloud_state","params":null},{"method":"get_device_info","params":null},{"method":"get_device_usage","params":null},{"method":"get_energy_usage","params":null}]},"requestID":1216957521483403264,"request_time_milis":1710186883099,"terminal_uuid":"7zc7SQf75Tz9eiHiYwnmDQ=="}'
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app?token=BDCD710F98DAF10D0F48F30D1D03F30C
DEBUG:kasa.smartprotocol:192.168.0.1 multi-request-batch-1 << {'error_code': 0,
 'result': {'responses': [{'error_code': 0,
                           'method': 'get_auto_off_config',
                           'result': {'delay_min': 120, 'enable': False}},
                          {'error_code': 0,
                           'method': 'get_connect_cloud_state',
                           'result': {'status': 1}},
                          {'error_code': 0,
                           'method': 'get_device_info',
                           'result': {'auto_off_remain_time': 0,
                                      'auto_off_status': 'off',
                                      'avatar': '',
                                      'default_states': {'state': {},
                                                         'type': 'last_states'},
                                      'device_id': '8022FDE322F00702F3A4512C1664717E220BEF5C',
                                      'device_on': False,
                                      'fw_id': '00000000000000000000000000000000',
                                      'fw_ver': '1.2.3 Build 230425 Rel.142542',
                                      'has_set_location_info': False,
                                      'hw_id': '2FB30EF5BF920C44099401D396C6B55B',
                                      'hw_ver': '1.0',
                                      'ip': '192.168.0.1',
                                      'lang': '',
                                      'latitude': 0,
                                      'longitude': 0,
                                      'mac': 'A8-42-A1-D4-6D-FF',
                                      'model': 'P110',
                                      'nickname': '',
                                      'oem_id': '18BDC6C734AF8407B3EF871EACFCECF5',
                                      'on_time': 0,
                                      'overheated': False,
                                      'power_protection_status': 'normal',
                                      'region': '',
                                      'rssi': -46,
                                      'signal_level': 3,
                                      'specs': '',
                                      'ssid': '',
                                      'time_diff': 0,
                                      'type': 'SMART.TAPOPLUG'}},
                          {'error_code': -1601, 'method': 'get_device_usage'},
                          {'error_code': -1003, 'method': 'get_energy_usage'}]}}
DEBUG:kasa.smartprotocol:192.168.0.1 multi-request-batch-6 >> '{"method":"multipleRequest","params":{"requests":[{"method":"get_current_power","params":null},{"method":"get_auto_update_info","params":null},{"method":"get_latest_fw","params":null},{"method":"get_led_info","params":{"led_rule":null}},{"method":"get_device_time","params":null}]},"requestID":1216957521777004544,"request_time_milis":1710186883169,"terminal_uuid":"7zc7SQf75Tz9eiHiYwnmDQ=="}'
DEBUG:kasa.httpclient:Posting to http://192.168.0.1:80/app?token=BDCD710F98DAF10D0F48F30D1D03F30C
DEBUG:kasa.smartprotocol:192.168.0.1 multi-request-batch-6 << {'error_code': 0,
 'result': {'responses': [{'error_code': 0,
                           'method': 'get_current_power',
                           'result': {'current_power': 0}},
                          {'error_code': 0,
                           'method': 'get_auto_update_info',
                           'result': {'enable': True,
                                      'random_range': 120,
                                      'time': 180}},
                          {'error_code': -1007, 'method': 'get_latest_fw'},
                          {'error_code': 0,
                           'method': 'get_led_info',
                           'result': {'led_rule': 'always',
                                      'led_status': False,
                                      'night_mode': {'end_time': 420,
                                                     'night_mode_type': 'sunrise_sunset',
                                                     'start_time': 1140,
                                                     'sunrise_offset': 0,
                                                     'sunset_offset': 0}}},
                          {'error_code': 0,
                           'method': 'get_device_time',
                           'result': {'region': '',
                                      'time_diff': 0,
                                      'timestamp': 946771833}}]}}
DEBUG:kasa.smart.smartdevice:Got an update: {'components': {'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': 'auto_off', 'ver_code': 2}, {'id': 'energy_monitoring', 'ver_code': 2}, {'id': 'power_protection', 'ver_code': 1}]}, 'get_auto_off_config': {'enable': False, 'delay_min': 120}, 'get_connect_cloud_state': {'status': 1}, 'get_device_info': {'device_id': '8022FDE322F00702F3A4512C1664717E220BEF5C', 'fw_ver': '1.2.3 Build 230425 Rel.142542', 'hw_ver': '1.0', 'type': 'SMART.TAPOPLUG', 'model': 'P110', 'mac': 'A8-42-A1-D4-6D-FF', 'hw_id': '2FB30EF5BF920C44099401D396C6B55B', 'fw_id': '00000000000000000000000000000000', 'oem_id': '18BDC6C734AF8407B3EF871EACFCECF5', 'ip': '192.168.0.1', 'time_diff': 0, 'ssid': '', 'rssi': -46, 'signal_level': 3, 'auto_off_status': 'off', 'auto_off_remain_time': 0, 'latitude': 0, 'longitude': 0, 'lang': '', 'avatar': '', 'region': '', 'specs': '', 'nickname': '', 'has_set_location_info': False, 'device_on': False, 'on_time': 0, 'default_states': {'type': 'last_states', 'state': {}}, 'overheated': False, 'power_protection_status': 'normal'}, 'get_device_usage': <SmartErrorCode.TIME_ERROR: -1601>, 'get_energy_usage': <SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>, 'get_current_power': {'current_power': 0}, 'get_auto_update_info': {'enable': True, 'time': 180, 'random_range': 120}, 'get_latest_fw': <SmartErrorCode.CLOUD_FAILED_ERROR: -1007>, 'get_led_info': {'night_mode': {'night_mode_type': 'sunrise_sunset', 'start_time': 1140, 'end_time': 420, 'sunrise_offset': 0, 'sunset_offset': 0}, 'led_status': False, 'led_rule': 'always'}, 'get_device_time': {'time_diff': 0, 'timestamp': 946771833, 'region': ''}, 'child_info': {}}
== None - P110 ==
	Host: 192.168.0.1
	Port: 80
	Device state: False
	== Generic information ==
	Time:         2000-01-02 00:10:33+00:00 (tz: {'timezone': 'UTC'}
	Hardware:     1.0
	Software:     1.2.3 Build 230425 Rel.142542
	MAC (rssi):   A8:42:A1:D4:6D:FF (-46)
	Location:     {'latitude': 0.0, 'longitude': 0.0}

	== Device specific information ==
	overheated: False
	signal_level: 3
	SSID: No SSID

	== Features == 
	Device ID (device_id): 8022FDE322F00702F3A4512C1664717E220BEF5C
	State (state): False
	Signal Level (signal_level): 3
	RSSI (rssi): -46
	SSID (ssid): No SSID
	Overheated (overheated): False
	On since (on_since): None
	Auto off enabled (auto_off_enabled): False
	Auto off minutes (auto_off_minutes): 120
	Auto off at (auto_off_at): None
	Cloud connection (cloud_connection): False
Raised error: 'SmartErrorCode' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/bin/kasa", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 1205, in __call__
    return anyio.run(self._main, main, args, kwargs, **opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 73, in run
    return async_backend.run(func, args, {}, backend_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2001, in run
    return runner.run(wrapper())
           ^^^^^^^^^^^^^^^^^^^^^
  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 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1989, in wrapper
    return await func(*args)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 1208, in _main
    return await main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 1120, in main
    rv = await self.invoke(ctx)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/cli.py", line 137, in invoke
    _handle_exception(self._debug, exc)
  File "/usr/lib/python3.11/site-packages/kasa/cli.py", line 135, in invoke
    return await super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 1739, in invoke
    return await _process_result(await sub_ctx.command.invoke(sub_ctx))
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 1485, in invoke
    return await ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 824, in invoke
    rv = await rv
         ^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/cli.py", line 500, in discover
    discovered_devices = await Discover.discover(
                         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/discover.py", line 313, in discover
    await protocol.wait_for_discovery_to_complete()
  File "/usr/lib/python3.11/site-packages/kasa/discover.py", line 108, in wait_for_discovery_to_complete
    await asyncio.gather(*self.callback_tasks)
  File "/usr/lib/python3.11/site-packages/kasa/cli.py", line 496, in print_discovered
    await ctx.parent.invoke(state)
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 824, in invoke
    rv = await rv
         ^^^^^^^^
  File "/usr/lib/python3.11/site-packages/asyncclick/core.py", line 824, in invoke
    rv = await rv
         ^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/cli.py", line 623, in state
    echo(f"\t{feature.name} ({id_}): {feature.value}")
                                      ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/feature.py", line 51, in value
    return getattr(container, self.attribute_getter)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/smart/modules/energymodule.py", line 56, in current_power
    return self.emeter_realtime.power
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/kasa/smart/modules/energymodule.py", line 71, in emeter_realtime
    "power_mw": self.energy.get("current_power"),
                ^^^^^^^^^^^^^^^
AttributeError: 'SmartErrorCode' object has no attribute 'get'
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7c4cfe1c1110>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7c4cfe190590>, 51146.985564726)]']
connector: <aiohttp.connector.TCPConnector object at 0x7c4cfe1c00d0>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions