Comments (8)
This error is usually because the credentials you supplied are invalid. Have you provisioned this device?
from python-kasa.
I am getting this same error when trying to setup a new device, I think this might have to do with having 2fa enabled on my Tapo Account? Does this integration support having 2FA on the account you login with?
from python-kasa.
kasa discover
== Authentication failed for device ==
== Discovery Result ==
Device Type: SMART.TAPOSWITCH
Device Model: S505D(US)
IP: 192.168.1.33
MAC: 48-22-54-5F-B0-A7
Device Id (hash): 6ac480810e77b126c353e19bf49d438a
Owner (hash): 48D105C5593D5366DFCE115DCE5C3A06
HW Ver: None
Supports IOT Cloud: True
OBD Src: matter
Factory Default: False
Encrypt Type: KLAP
Supports HTTPS: False
HTTP Port: 80
LV (Login Level): 2
if you supply creds you can get a bit further:
python\python-kasa> kasa --host 192.168.1.33
No --type or --device-family and --encrypt-type defined, discovering for 5 seconds..
INFO:kasa.device_factory:Finding transport for SMART.KLAP
Raised error: Server response doesn't match our challenge on ip 192.168.1.33
Run with --debug enabled to see stacktrace
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002E6163EC990>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002E61637A970>, 875985.546)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002E6163ECED0>
python\python-kasa> kasa --host 192.168.1.33 --username *** --password ****
No --type or --device-family and --encrypt-type defined, discovering for 5 seconds..
INFO:kasa.device_factory:Finding transport for SMART.KLAP
Raised error: 'SmartErrorCode' object has no attribute 'get'
Run with --debug enabled to see stacktrace
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002A5B054A970>, 875999.546)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002A5B05BCD90>
from python-kasa.
@steveredden, this might be a separate issue, but
OBD Src: matter
tells us that the device was provisioned using matter, which could be the culprit for the error. If you add --debug
like instructed in the output, does it say which error it was?
Also, can you control the device using the mobile app?
@Maeur1 is the error the same as in the original issue description?
@sykhew do you have more information / did you get it working? If yes, please consider contributing a fixture file like described here: https://python-kasa.readthedocs.io/en/latest/contribute.html#contributing-fixture-files
from python-kasa.
yes, this dimmer switch was configured via matter first (home assistant as the controller). It is also controllable via the app - I may have had to enable additional pairing to do so (but i don't remember).
it can component_nego
just fine, haven't traced down to where it's failing exactly:
No --type or --device-family and --encrypt-type defined, discovering for 5 seconds..
DEBUG:kasa.discover:[DISCOVERY] 192.168.1.33 >> {'system': {'get_sysinfo': None}}
DEBUG:kasa.discover:Waiting a total of 5 seconds for responses...
INFO:kasa.device_factory:Finding transport for SMART.KLAP
DEBUG:kasa.klaptransport:Created KLAP transport for 192.168.1.33
DEBUG:kasa.discover:[DISCOVERY] 192.168.1.33 << {'result': {'device_id': 'xx', 'owner': 'xx', 'device_type': 'SMART.TAPOSWITCH', 'device_model': 'S505D(US)', 'ip': '192.168.1.33', 'mac': '48-22-54-5F-B0-A7', 'is_support_iot_cloud': True, 'obd_src': 'matter', 'factory_default': False, 'mgt_encrypt_schm': {'is_support_https': False, 'encrypt_type': 'KLAP', 'http_port': 80, 'lv': 2}}, 'error_code': 0}
DEBUG:kasa.device:Initializing 192.168.1.33 of type <class 'kasa.smart.smartdevice.SmartDevice'>
DEBUG:kasa.smartprotocol:192.168.1.33 multi-request-batch-1 >> '{"method":"multipleRequest","params":{"requests":[{"method":"component_nego","params":null},{"method":"get_device_info","params":null},{"method":"get_connect_cloud_state","params":null}]},"requestID":1247297533198340096,"request_time_milis":1717420505582,"terminal_uuid":"cmtcDKgyu1xt+4C/Mx6zvw=="}'
DEBUG:kasa.klaptransport:Starting handshake with 192.168.1.33
DEBUG:kasa.httpclient:Posting to http://192.168.1.33:80/app/handshake1
DEBUG:kasa.klaptransport:Handshake1 posted at 2024-06-03 08:15:05.599651. Host is 192.168.1.33, Responsestatus is 200, Request was 8e46298963f615e63612d77a4e70c7c8
DEBUG:kasa.klaptransport:Handshake1 success at 2024-06-03 08:15:05.599651. Host is 192.168.1.33, Server remote_seed is: 2c9cda24b71edb27b5535827f8d2d826, server hash is: 6a0e2dcd091718683d78f2c2f012e926ae57f2dd18d432e02c78ef3b2d7ef1e8
DEBUG:kasa.klaptransport:handshake1 hashes match with expected credentials
DEBUG:kasa.httpclient:Posting to http://192.168.1.33:80/app/handshake2
DEBUG:kasa.klaptransport:Handshake2 posted 2024-06-03 08:15:05.609660. Host is 192.168.1.33, Response status is 200, Request was 8e5e03ba1f9a7bba950bb977de66e5640d1a8299c30056f323337051868e3517
DEBUG:kasa.klaptransport:Handshake with 192.168.1.33 complete
DEBUG:kasa.httpclient:Posting to http://192.168.1.33:80/app/request
DEBUG:kasa.klaptransport:Query posted Host is 192.168.1.33, Sequence is -409129245, Response status is 200, Request was {"method":"multipleRequest","params":{"requests":[{"method":"component_nego","params":null},{"method":"get_device_info","params":null},{"method":"get_connect_cloud_state","params":null}]},"requestID":1247297533198340096,"request_time_milis":1717420505582,"terminal_uuid":"cmtcDKgyu1xt+4C/Mx6zvw=="}
DEBUG:kasa.klaptransport:192.168.1.33 << {'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': 'inherit',
'ver_code': 1},
{'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': 'brightness',
'ver_code': 1},
{'id': 'preset',
'ver_code': 1},
{'id': 'on_off_gradually',
'ver_code': 2},
{'id': 'dimmer_calibration',
'ver_code': 1},
{'id': 'localSmart',
'ver_code': 1},
{'id': 'overheat_protection',
'ver_code': 1},
{'id': 'matter',
'ver_code': 2}]}},
{'error_code': 0,
'method': 'get_device_info',
'result': {'avatar': 'switch_s500d',
'brightness': 100,
'default_states': {'re_power_type': 'always_off',
're_power_type_capability': ['last_states',
'always_on',
'always_off'],
'type': 'last_states'},
'device_id': 'xx',
'device_on': False,
'fw_id': '00000000000000000000000000000000',
'fw_ver': '1.1.0 Build 231024 Rel.201030',
'has_set_location_info': False,
'hw_id': 'xx',
'hw_ver': '1.0',
'ip': '192.168.1.33',
'lang': 'en_US',
'latitude': -xx,
'longitude': -xx,
'mac': '48-22-54-xx',
'model': 'S505D',
'nickname': 'xx==',
'oem_id': 'xx',
'on_time': 0,
'overheat_status': 'normal',
'region': 'America/Chicago',
'rssi': -39,
'signal_level': 3,
'specs': '',
'ssid': 'xx',
'time_diff': -360,
'type': 'SMART.TAPOSWITCH'}},
{'error_code': 0,
'method': 'get_connect_cloud_state',
'result': {'status': 1}}]}}
DEBUG:kasa.smartprotocol:192.168.1.33 multi-request-batch-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': 'inherit',
'ver_code': 1},
{'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': 'brightness',
'ver_code': 1},
{'id': 'preset',
'ver_code': 1},
{'id': 'on_off_gradually',
'ver_code': 2},
{'id': 'dimmer_calibration',
'ver_code': 1},
{'id': 'localSmart',
'ver_code': 1},
{'id': 'overheat_protection',
'ver_code': 1},
{'id': 'matter',
'ver_code': 2}]}},
{'error_code': 0,
'method': 'get_device_info',
'result': {'avatar': 'switch_s500d',
'brightness': 100,
'default_states': {'re_power_type': 'always_off',
're_power_type_capability': ['last_states',
'always_on',
'always_off'],
'type': 'last_states'},
'device_id': 'xx',
'device_on': False,
'fw_id': '00000000000000000000000000000000',
'fw_ver': '1.1.0 Build 231024 Rel.201030',
'has_set_location_info': False,
'hw_id': 'xx',
'hw_ver': '1.0',
'ip': '192.168.1.33',
'lang': 'en_US',
'latitude': -xx,
'longitude': -xx,
'mac': '48-22-54-xx',
'model': 'S505D',
'nickname': 'xx==',
'oem_id': 'xx',
'on_time': 0,
'overheat_status': 'normal',
'region': 'America/Chicago',
'rssi': -39,
'signal_level': 3,
'specs': '',
'ssid': 'xx',
'time_diff': -360,
'type': 'SMART.TAPOSWITCH'}},
{'error_code': 0,
'method': 'get_connect_cloud_state',
'result': {'status': 1}}]}}
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.alarm.Alarm'> requires alarm
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.autooff.AutoOff'> requires auto_off
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.batterysensor.BatterySensor'> requires battery_detect
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.brightness.Brightness'> requires brightness
DEBUG:kasa.smart.smartdevice:Found required brightness, adding Brightness to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.childdevice.ChildDevice'> requires child_device
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.cloud.Cloud'> requires cloud_connect
DEBUG:kasa.smart.smartdevice:Found required cloud_connect, adding Cloud to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.color.Color'> requires color
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.colortemperature.ColorTemperature'> requires color_temperature
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.contactsensor.ContactSensor'> requires None
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.energy.Energy'> requires energy_monitoring
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.fan.Fan'> requires fan_control
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.frostprotection.FrostProtection'> requires frost_protection
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.humiditysensor.HumiditySensor'> requires humidity
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.led.Led'> requires led
DEBUG:kasa.smart.smartdevice:Found required led, adding Led to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.light.Light'> requires None
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.lighteffect.LightEffect'> requires light_effect
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.lightpreset.LightPreset'> requires preset
DEBUG:kasa.smart.smartdevice:Found required preset, adding LightPreset to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.lightstripeffect.LightStripEffect'> requires light_strip_lighting_effect
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.lighttransition.LightTransition'> requires on_off_gradually
DEBUG:kasa.smart.smartdevice:Found required on_off_gradually, adding LightTransition to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.reportmode.ReportMode'> requires report_mode
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.temperaturecontrol.TemperatureControl'> requires temp_control
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.temperaturesensor.TemperatureSensor'> requires temperature
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.time.Time'> requires time
DEBUG:kasa.smart.smartdevice:Found required time, adding Time to modules.
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.vacuum.Vacuum'> requires clean
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.vacuumrecords.VacuumRecords'> requires consumables
DEBUG:kasa.smart.smartdevice:<class 'kasa.smart.modules.waterleaksensor.WaterleakSensor'> requires sensor_alarm
DEBUG:kasa.smartprotocol:192.168.1.33 multi-request-batch-1 >> '{"method":"multipleRequest","params":{"requests":[{"method":"get_connect_cloud_state","params":null},{"method":"get_device_info","params":null},{"method":"get_device_usage","params":null},{"method":"get_latest_fw","params":null},{"method":"get_auto_update_info","params":null}]},"requestID":1247297533777154048,"request_time_milis":1717420505720,"terminal_uuid":"cmtcDKgyu1xt+4C/Mx6zvw=="}'
DEBUG:kasa.httpclient:Posting to http://192.168.1.33:80/app/request
DEBUG:kasa.klaptransport:Query posted Host is 192.168.1.33, Sequence is -409129244, Response status is 200, Request was {"method":"multipleRequest","params":{"requests":[{"method":"get_connect_cloud_state","params":null},{"method":"get_device_info","params":null},{"method":"get_device_usage","params":null},{"method":"get_latest_fw","params":null},{"method":"get_auto_update_info","params":null}]},"requestID":1247297533777154048,"request_time_milis":1717420505720,"terminal_uuid":"cmtcDKgyu1xt+4C/Mx6zvw=="}
DEBUG:kasa.klaptransport:192.168.1.33 << {'error_code': 0,
'result': {'responses': [{'error_code': 0,
'method': 'get_connect_cloud_state',
'result': {'status': 1}},
{'error_code': 0,
'method': 'get_device_info',
'result': {'avatar': 'switch_s500d',
'brightness': 100,
'default_states': {'re_power_type': 'always_off',
're_power_type_capability': ['last_states',
'always_on',
'always_off'],
'type': 'last_states'},
'device_id': 'xx',
'device_on': False,
'fw_id': '00000000000000000000000000000000',
'fw_ver': '1.1.0 Build 231024 Rel.201030',
'has_set_location_info': False,
'hw_id': 'xx',
'hw_ver': '1.0',
'ip': '192.168.1.33',
'lang': 'en_US',
'latitude': -xx,
'longitude': -xx,
'mac': '48-22-54-xx',
'model': 'S505D',
'nickname': 'xx==',
'oem_id': 'xx',
'on_time': 0,
'overheat_status': 'normal',
'region': 'America/Chicago',
'rssi': -39,
'signal_level': 3,
'specs': '',
'ssid': 'xx',
'time_diff': -360,
'type': 'SMART.TAPOSWITCH'}},
{'error_code': -1601, 'method': 'get_device_usage'},
{'error_code': -1007, 'method': 'get_latest_fw'},
{'error_code': 0,
'method': 'get_auto_update_info',
'result': {'enable': True,
'random_range': 120,
'time': 180}}]}}
DEBUG:kasa.smartprotocol:192.168.1.33 multi-request-batch-1 << {'error_code': 0,
'result': {'responses': [{'error_code': 0,
'method': 'get_connect_cloud_state',
'result': {'status': 1}},
{'error_code': 0,
'method': 'get_device_info',
'result': {'avatar': 'switch_s500d',
'brightness': 100,
'default_states': {'re_power_type': 'always_off',
're_power_type_capability': ['last_states',
'always_on',
'always_off'],
'type': 'last_states'},
'device_id': 'xx',
'device_on': False,
'fw_id': '00000000000000000000000000000000',
'fw_ver': '1.1.0 Build 231024 Rel.201030',
'has_set_location_info': False,
'hw_id': 'xx',
'hw_ver': '1.0',
'ip': '192.168.1.33',
'lang': 'en_US',
'latitude': -xx,
'longitude': -xx,
'mac': '48-22-54-xx',
'model': 'S505D',
'nickname': 'xx==',
'oem_id': 'xx',
'on_time': 0,
'overheat_status': 'normal',
'region': 'America/Chicago',
'rssi': -39,
'signal_level': 3,
'specs': '',
'ssid': 'xx',
'time_diff': -360,
'type': 'SMART.TAPOSWITCH'}},
{'error_code': -1601, 'method': 'get_device_usage'},
{'error_code': -1007, 'method': 'get_latest_fw'},
{'error_code': 0,
'method': 'get_auto_update_info',
'result': {'enable': True,
'random_range': 120,
'time': 180}}]}}
DEBUG:kasa.smartprotocol:192.168.1.33 multi-request-batch-6 >> '{"method":"multipleRequest","params":{"requests":[{"method":"get_led_info","params":{"led_rule":null}},{"method":"get_preset_rules","params":null},{"method":"get_on_off_gradually_info","params":null},{"method":"get_device_time","params":null}]},"requestID":1247297533886205952,"request_time_milis":1717420505746,"terminal_uuid":"cmtcDKgyu1xt+4C/Mx6zvw=="}'
DEBUG:kasa.httpclient:Posting to http://192.168.1.33:80/app/request
DEBUG:kasa.klaptransport:Query posted Host is 192.168.1.33, Sequence is -409129243, Response status is 200, Request was {"method":"multipleRequest","params":{"requests":[{"method":"get_led_info","params":{"led_rule":null}},{"method":"get_preset_rules","params":null},{"method":"get_on_off_gradually_info","params":null},{"method":"get_device_time","params":null}]},"requestID":1247297533886205952,"request_time_milis":1717420505746,"terminal_uuid":"cmtcDKgyu1xt+4C/Mx6zvw=="}
DEBUG:kasa.klaptransport:192.168.1.33 << {'error_code': 0,
'result': {'responses': [{'error_code': 0,
'method': 'get_led_info',
'result': {'led_rule': 'always',
'led_status': True,
'night_mode': {'end_time': 420,
'night_mode_type': 'sunrise_sunset',
'start_time': 1140,
'sunrise_offset': 0,
'sunset_offset': 0}}},
{'error_code': -1008, 'method': 'get_preset_rules'},
{'error_code': -1008,
'method': 'get_on_off_gradually_info'},
{'error_code': 0,
'method': 'get_device_time',
'result': {'region': 'America/Chicago',
'time_diff': -360,
'timestamp': 952082259}}]}}
DEBUG:kasa.smartprotocol:192.168.1.33 multi-request-batch-6 << {'error_code': 0,
'result': {'responses': [{'error_code': 0,
'method': 'get_led_info',
'result': {'led_rule': 'always',
'led_status': True,
'night_mode': {'end_time': 420,
'night_mode_type': 'sunrise_sunset',
'start_time': 1140,
'sunrise_offset': 0,
'sunset_offset': 0}}},
{'error_code': -1008, 'method': 'get_preset_rules'},
{'error_code': -1008,
'method': 'get_on_off_gradually_info'},
{'error_code': 0,
'method': 'get_device_time',
'result': {'region': 'America/Chicago',
'time_diff': -360,
'timestamp': 952082259}}]}}
Raised error: 'SmartErrorCode' object has no attribute 'get'
Traceback (most recent call last):
File "...\kasaenv\Scripts\\kasa", line 6, in <module>
sys.exit(cli())
^^^^^
File "...\kasaenv\Lib\site-packages\asyncclick\core.py", line 1205, in __call__
return anyio.run(self._main, main, args, kwargs, **opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\anyio\_core\_eventloop.py", line 73, in run
return async_backend.run(func, args, {}, backend_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2001, in run
return runner.run(wrapper())
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\anyio\_backends\_asyncio.py", line 1989, in wrapper
return await func(*args)
^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\asyncclick\core.py", line 1208, in _main
return await main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\asyncclick\core.py", line 1120, in main
rv = await self.invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^
File "...\python-kasa\kasa\cli.py", line 142, in invoke
_handle_exception(self._debug, exc)
File "...\python-kasa\kasa\cli.py", line 140, in invoke
return await super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\asyncclick\core.py", line 1717, in invoke
rv = await super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\asyncclick\core.py", line 1485, in invoke
return await ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\kasaenv\Lib\site-packages\asyncclick\core.py", line 824, in invoke
rv = await rv
^^^^^^^^
File "...\python-kasa\kasa\cli.py", line 407, in cli
await dev.update()
File "...\python-kasa\kasa\smart\smartdevice.py", line 189, in update
module._post_update_hook()
File "...\python-kasa\kasa\smart\modules\lightpreset.py", line 38, in _post_update_hook
if preset_states := self.data.get(state_key):
^^^^^^^^^^^^^
AttributeError: 'SmartErrorCode' object has no attribute 'get'
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000229BB0742D0>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x00000229BB0029E0>, 948379.015)]']
connector: <aiohttp.connector.TCPConnector object at 0x00000229BA18A910>
fixture S505D(US)_1.0_1.1.0.json
from python-kasa.
Looks like it's (almost) working, thanks for the fixture file!
So the culprit is this (ping @sdb9696):
File "...\python-kasa\kasa\smart\modules\lightpreset.py", line 38, in _post_update_hook
if preset_states := self.data.get(state_key):
^^^^^^^^^^^^^
AttributeError: 'SmartErrorCode' object has no attribute 'get'
Looks like there are a couple of cases with error -1008
(PARAMS_ERROR
): get_preset_rules
and get_on_off_gradually_info
, but also other errors.
-1601
for get_device_usage
is known when the clock is off/not synchronized as the device isn't been connected to the cloud, which might be related.
You could try to let the device to connect to the NTP server for synchronization (port 123/udp), or set the time manually using something like kasa command set_device_time '{"timestamp": 1717424591, "time_diff": -360, "region": "America/Chicago"}'
from python-kasa.
So the culprit is this (ping @sdb9696):
File "...\python-kasa\kasa\smart\modules\lightpreset.py", line 38, in _post_update_hook
if preset_states := self.data.get(state_key):
^^^^^^^^^^^^^
AttributeError: 'SmartErrorCode' object has no attribute 'get'
So the fixture file https://github.com/python-kasa/python-kasa/pull/947/files appears have the preset rules. @rytilahti do you know why the error was being raised? Was it fixed by the time sync?
from python-kasa.
Hmm, maybe the dump_devinfo performs a different query, as those in the attached logs are erroring out with params error, and after seeing the time error I made an assumption that it could be the root cause.
from python-kasa.
Related Issues (20)
- Allow exposing extra feature metadata HOT 1
- Error when connecting P110 to wi-fi HOT 3
- Support for T300 and T110 HOT 26
- Credentials hash does not work for H100 HOT 6
- Fix --help on subcommands
- Module queries in dump_devinfo
- Question: Remote control devices from external servers? HOT 1
- Return correct unit for temperature sensor
- Improve typing of Feature HOT 1
- Simplify instance creation API HOT 1
- Cleanup TODO comments
- dumping HTTP POST Body for Tapo Vacuum (RV30 Plus) HOT 10
- New HS220 require authentication HOT 5
- from kasa import Device fails HOT 1
- DeviceConfig dict must always be serializable
- 0.7.0 Release Summary HOT 1
- KP200 factory resets [Using a BASH script with python-kasa to auto repair] HOT 6
- SMART.TAPOHUB does not work with 0.7.0 dev2 HOT 4
- kasa.exceptions.SmartDeviceException: Communication error on system:set_relay_state HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-kasa.