8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardware version 1.0 firmware 1.1.0 build 231024
Authenticating device results in following error
Invalid authentication: Unable to complete handshake: 192.168.x.x: TRANSPORT_UNKNOWN_CREDENTIALS_ERROR(1003)
The text was updated successfully, but these errors were encountered:
This error is usually because the credentials you supplied are invalid. Have you provisioned this device?
Sorry, something went wrong.
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?
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>
@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?
--debug
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
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:
component_nego
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 p 8000 osted 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
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.
-1008
PARAMS_ERROR
get_preset_rules
get_on_off_gradually_info
-1601
get_device_usage
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"}'
kasa command set_device_time '{"timestamp": 1717424591, "time_diff": -360, "region": "America/Chicago"}'
Add fixture for S505D (#947)
bfba7a3
By courtesy of @steveredden: #888 (comment)
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?
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.
I was able to get get_preset_rules and get_on_off_gradually_info by passing {} as the param:
{}
diff --git a/kasa/smart/modules/lightpreset.py b/kasa/smart/modules/lightpreset.py index 8e5cae2..898c3f3 100644 --- a/kasa/smart/modules/lightpreset.py +++ b/kasa/smart/modules/lightpreset.py @@ -140,7 +140,7 @@ class LightPreset(SmartModule, LightPresetInterface): """Query to execute during the update cycle.""" if self._state_in_sysinfo: # Child lights can have states in the child info return {} - return {self.QUERY_GETTER_NAME: None} + return {self.QUERY_GETTER_NAME: {}} async def _check_supported(self): """Additional check to see if the module is supported by the device. diff --git a/kasa/smart/modules/lighttransition.py b/kasa/smart/modules/lighttransition.py index 29a4bb0..ca0eca8 100644 --- a/kasa/smart/modules/lighttransition.py +++ b/kasa/smart/modules/lighttransition.py @@ -230,7 +230,7 @@ class LightTransition(SmartModule): if self._state_in_sysinfo: return {} else: - return {self.QUERY_GETTER_NAME: None} + return {self.QUERY_GETTER_NAME: {}} async def _check_supported(self): """Additional check to see if the module is supported by the device."""
@pierlon would you mind creating a PR? Changing this does not seem to affect my devices.
Hi, could you test your devices with this PR #1036 and see if it fixes the issue?
This is now fixed in master and released in 0.7.0.3 (release)
Thanks @pierlon for the tip about the {} parameters for lighttransition.
Thanks for fixing this @sdb9696! Tested and it works perfectly.
No branches or pull requests