Giter VIP home page Giter VIP logo

Comments (26)

ngaertner avatar ngaertner commented on July 2, 2024 1

i will send the component listing later...

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024 1

so... everything works fine.

Just another question (a little off-topic let me know if i should create another issue for it).

During the tests I noticed the following:

When i control the Tapo Plugs (like P100) i can use KLAP encryption with --credentions-hash , but when i try to access the H100 Hub I have to use AES and --username and --password.

Using credentials-hash gives me:

Raised error: 'utf-8' codec can't decode byte 0xed in position 1: invalid continuation byte

Is it possible to support the credentials hash for the hub as well?

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024 1

here you go ;-)

T110(EU)_1.0_1.8.0.json
T300(EU)_1.0_1.7.0.json

from python-kasa.

sdb9696 avatar sdb9696 commented on July 2, 2024 1

Fantastic thanks Nico!

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Hi Nico, could you run python -m devtools.dump_devinfo --host <addr> --username <username> --password <password> (username and password not needed, if you have defined those as environment variables), and create a PR to upload the fixture files?

Adding support for the water leak sensor should be straightforward as the information is contained within the JSON, supporting the other one requires probably a bit more work.

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

Thanks for the prompt response!

The relevant information for the T110 sensor is also part of the JSON:
"open": false ==> contact is closed
"open": true ==> contact is open

I have executed the command, but i don't know where to find the fixture files - i am not also not familiar with the process of creating PRs.
Maybe you can build something without the files...

Here's the output that i received from the command:

Host given, performing discovery on 192.168.1.86.
Testing component_nego call ..OK
Skipping child_inherit..UNSUPPORTED
Skipping chime..UNSUPPORTED
Skipping trigger_log..UNSUPPORTED
Skipping battery_detect..UNSUPPORTED
Skipping temperature..UNSUPPORTED
Skipping humidity..UNSUPPORTED
Skipping temp_humidity_record..UNSUPPORTED
Skipping comfort_temperature..UNSUPPORTED
Skipping comfort_humidity..UNSUPPORTED
Skipping report_mode..UNSUPPORTED
Skipping trigger_log..UNSUPPORTED
Skipping battery_detect..UNSUPPORTED
Skipping sensor_alarm..UNSUPPORTED
Skipping trigger_log..UNSUPPORTED
Skipping battery_detect..UNSUPPORTED
Testing  child_device_list..Testing SmartCall(module='child_device_list', request=SmartRequest(get_child_device_list), should_succeed=True, child_device_id='')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_info), should_succeed=True, child_device_id='')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_usage), should_succeed=True, child_device_id='')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_auto_update_info), should_succeed=True, child_device_id='')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_fw_download_state), should_succeed=True, child_device_id='')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_latest_fw), should_succeed=True, child_device_id='')..OK
Testing  quick_setup..Testing SmartCall(module='quick_setup', request=SmartRequest(qs_component_nego), should_succeed=True, child_device_id='')..OK
Testing  inherit..Testing SmartCall(module='inherit', request=SmartRequest(get_inherit_info), should_succeed=True, child_device_id='')..OK
Testing  time..Testing SmartCall(module='time', request=SmartRequest(get_device_time), should_succeed=True, child_device_id='')..OK
Testing  wireless..Testing SmartCall(module='wireless', request=SmartRequest(get_wireless_scan_info), should_succeed=True, child_device_id='')..OK
Testing  led..Testing SmartCall(module='led', request=SmartRequest(get_led_info), should_succeed=True, child_device_id='')..OK
Testing  cloud_connect..Testing SmartCall(module='cloud_connect', request=SmartRequest(get_connect_cloud_state), should_succeed=True, child_device_id='')..OK
Testing  child_quick_setup..Testing SmartCall(module='child_quick_setup', request=SmartRequest(get_support_child_device_category), should_succeed=True, child_device_id='')..OK
Testing  alarm..Testing SmartCall(module='alarm', request=SmartRequest(get_support_alarm_type_list), should_succeed=True, child_device_id='')..OK
Testing  alarm..Testing SmartCall(module='alarm', request=SmartRequest(get_alarm_configure), should_succeed=True, child_device_id='')..OK
Testing  device_load..Testing SmartCall(module='device_load', request=SmartRequest(get_device_load_info), should_succeed=True, child_device_id='')..OK
Testing  alarm_logs..Testing SmartCall(module='alarm_logs', request=SmartRequest(get_alarm_triggers), should_succeed=True, child_device_id='')..FAIL Error querying device: 192.168.1.86: UNKNOWN_METHOD_ERROR(-1002) for method: get_alarm_triggers (error_code=UNKNOWN_METHOD_ERROR)
Testing  matter..Testing SmartCall(module='matter', request=SmartRequest(get_matter_setup_info), should_succeed=True, child_device_id='')..OK
Testing  temp_humidity_records..Testing SmartCall(module='temp_humidity_records', request=SmartRequest(get_temp_humidity_records), should_succeed=False, child_device_id='')..FAIL - EXPECTED
Testing  trigger_logs..Testing SmartCall(module='trigger_logs', request=SmartRequest(get_trigger_logs), should_succeed=False, child_device_id='')..FAIL - EXPECTED
Testing  component_nego..Testing SmartCall(module='component_nego', request=SmartRequest(component_nego), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_info), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_usage), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_auto_update_info), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  quick_setup..Testing SmartCall(module='quick_setup', request=SmartRequest(qs_component_nego), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  time..Testing SmartCall(module='time', request=SmartRequest(get_device_time), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  cloud_connect..Testing SmartCall(module='cloud_connect', request=SmartRequest(get_connect_cloud_state), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_fw_download_state), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_latest_fw), should_succeed=True, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK
Testing  temp_humidity_records..Testing SmartCall(module='temp_humidity_records', request=SmartRequest(get_temp_humidity_records), should_succeed=False, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK - EXPECTED FAIL
Testing  trigger_logs..Testing SmartCall(module='trigger_logs', request=SmartRequest(get_trigger_logs), should_succeed=False, child_device_id='802E6B66E717D6AD31BB4726011746212219698C')..OK - EXPECTED FAIL
Testing  component_nego..Testing SmartCall(module='component_nego', request=SmartRequest(component_nego), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_info), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_usage), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_auto_update_info), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  quick_setup..Testing SmartCall(module='quick_setup', request=SmartRequest(qs_component_nego), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  time..Testing SmartCall(module='time', request=SmartRequest(get_device_time), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  cloud_connect..Testing SmartCall(module='cloud_connect', request=SmartRequest(get_connect_cloud_state), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_fw_download_state), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_latest_fw), should_succeed=True, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK
Testing  temp_humidity_records..Testing SmartCall(module='temp_humidity_records', request=SmartRequest(get_temp_humidity_records), should_succeed=False, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK - EXPECTED FAIL
Testing  trigger_logs..Testing SmartCall(module='trigger_logs', request=SmartRequest(get_trigger_logs), should_succeed=False, child_device_id='802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7')..OK - EXPECTED FAIL
Testing  component_nego..Testing SmartCall(module='component_nego', request=SmartRequest(component_nego), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_info), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_device_usage), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  device..Testing SmartCall(module='device', request=SmartRequest(get_auto_update_info), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  quick_setup..Testing SmartCall(module='quick_setup', request=SmartRequest(qs_component_nego), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  time..Testing SmartCall(module='time', request=SmartRequest(get_device_time), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..FAIL Error querying device: 192.168.1.86: UNSPECIFIC_ERROR(-1001) for method: control_child (error_code=UNSPECIFIC_ERROR)
Testing  cloud_connect..Testing SmartCall(module='cloud_connect', request=SmartRequest(get_connect_cloud_state), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_fw_download_state), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK
Testing  firmware..Testing SmartCall(module='firmware', request=SmartRequest(get_latest_fw), should_succeed=True, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK
Testing  temp_humidity_records..Testing SmartCall(module='temp_humidity_records', request=SmartRequest(get_temp_humidity_records), should_succeed=False, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK - EXPECTED FAIL
Testing  trigger_logs..Testing SmartCall(module='trigger_logs', request=SmartRequest(get_trigger_logs), should_succeed=False, child_device_id='802E3B14B17594B105DEB69CCED699DD22155944')..OK - EXPECTED FAIL
Unexpected exception querying all successes at once at once: argument of type 'NoneType' is not iterable

Best Regards

Nico

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024
> Unexpected exception querying all successes at once at once: argument of type 'NoneType' is not iterable

Looks like there's a bug in the script itself, you could add --debug to the command line and you will get a lot of output. Could you check what happens just before that error?

We really do need those fixture files, but if you could search for child_component_list response that would allow me to get started with the implementation.

Here's an example what it outputs to my T315, we use "temperature" and "humidity" (and others) to select which modules we activate and which information we show, so we need to figure out what features your sensors have:

{'component_list': [{'id': 'device',
                     'ver_code': 2},
                    {'id': 'quick_setup',
                     'ver_code': 3},
                    {'id': 'trigger_log',
                     'ver_code': 1},
                    {'id': 'time',
                     'ver_code': 1},
                    {'id': 'device_local_time',
                     'ver_code': 1},
                    {'id': 'account',
                     'ver_code': 1},
                    {'id': 'synchronize',
                     'ver_code': 1},
                    {'id': 'cloud_connect',
                     'ver_code': 1},
                    {'id': 'iot_cloud',
                     'ver_code': 1},
                    {'id': 'firmware',
                     'ver_code': 1},
                    {'id': 'localSmart',
                     'ver_code': 1},
                    {'id': 'battery_detect',
                     'ver_code': 1},
                    {'id': 'temperature',
                     'ver_code': 1},
                    {'id': 'humidity',
                     'ver_code': 1},
                    {'id': 'temp_humidity_record',
                     'ver_code': 1},
                    {'id': 'comfort_temperature',
                     'ver_code': 1},
                    {'id': 'comfort_humidity',
                     'ver_code': 1},
                    {'id': 'report_mode',
                     'ver_code': 1}],

Do you see something related to waterleaks and/or contact in yours?

I started to add support for waterleaks in #876, but the REQUIRED_COMPONENT = "waterleak" may not be correct here :-)

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Thanks for the prompt response!

Sure thing, thanks for the issue report and those JSONs, they are already helpful!

The relevant information for the T110 sensor is also part of the JSON: "open": false ==> contact is closed "open": true ==> contact is open

Great catch! I created #877 which will eventually add support for this. Like with the water leak sensor, we are going to need the component name.

I have executed the command, but i don't know where to find the fixture files - i am not also not familiar with the process of creating PRs. Maybe you can build something without the files...

When we get the dump_devinfo fixed, you could also send the files to me by email and I can add them.

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Looks like T310 doesn't support reporting the battery level like T315 does, but the component listing will likely reveal how we need to adapt the library to avoid creating that feature :-)

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

Here is the output just before the error with -- debug

DEBUG:kasa.smartprotocol:192.168.1.86 multi-request-batch-1 >> '{"method":"multipleRequest","params":{"requests":[{"method":"get_auto_update_info","params":null},{"method":"get_fw_download_state","params":null},{"method":"get_latest_fw","params":null},{"method":"qs_component_nego","params":null},{"method":"get_inherit_info","params":null}]},"requestID":1233901580097556480,"request_time_milis":1714226661478,"terminal_uuid":"MerxVh6FaBbv9jVpVR3D6A=="}'
DEBUG:kasa.httpclient:Posting to http://192.168.1.86:80/app?token=AE7CAA4C1E26AA4D447EAB4D1C532B4D
DEBUG:kasa.smartprotocol:192.168.1.86 multi-request-batch-1 << {'error_code': 0,
 'result': {'responses': [{'error_code': 0,
                           'method': 'get_auto_update_info',
                           'result': {'enable': True,
                                      'random_range': 120,
                                      'time': 780}},
                          {'error_code': 0,
                           'method': 'get_fw_download_state',
                           'result': {'auto_upgrade': False,
                                      'download_progress': 0,
                                      'reboot_time': 5,
                                      'status': 0,
                                      'upgrade_time': 5}},
                          {'error_code': 0,
                           'method': 'get_latest_fw',
                           'result': {'fw_size': 0,
                                      'fw_ver': '1.5.10 Build 240207 '
                                                'Rel.175759',
                                      'hw_id': '',
                                      'need_to_upgrade': False,
                                      'oem_id': '',
                                      'release_date': '',
                                      'release_note': '',
                                      'type': 0}},
                          {'error_code': 0,
                           'method': 'qs_component_nego',
                           'result': {'component_list': [{'id': 'quick_setup',
                                                          'ver_code': 3},
                                                         {'id': 'sunrise_sunset',
                                                          'ver_code': 1},
                                                         {'id': 'iot_cloud',
                                                          'ver_code': 1},
                                                         {'id': 'inherit',
                                                          'ver_code': 1},
                                                         {'id': 'firmware',
                                                          'ver_code': 2},
                                                         {'id': 'matter',
                                                          'ver_code': 3}],
                                      'extra_info': {'device_model': 'H100',
                                                     'device_type': 'SMART.TAPOHUB',
                                                     'is_klap': False}}},
                          {'error_code': 0, 'method': 'get_inherit_info'}]}}
Unexpected exception querying all successes at once at once: argument of type 'NoneType' is not iterable
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 675, in <module>
    cli()
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1205, in __call__
    return anyio.run(self._main, main, args, kwargs, **opts)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\anyio\_core\_eventloop.py", line 73, in run
    return async_backend.run(func, args, {}, backend_options)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\anyio\_backends\_asyncio.py", line 2001, in run
    return runner.run(wrapper())
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 640, in run_until_complete
    self.run_forever()
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 607, in run_forever
    self._run_once()
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1922, in _run_once
    handle._run()
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\anyio\_backends\_asyncio.py", line 1989, in wrapper
    return await func(*args)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1208, in _main
    return await main(*args, **kwargs)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1120, in main
    rv = await self.invoke(ctx)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1485, in invoke
    return await ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 824, in invoke
    rv = await rv
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 255, in cli
    await handle_device(basedir, autosave, device, batch_size)
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 147, in handle_device
    fixture_results: list[FixtureResult] = await get_smart_fixtures(
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 609, in get_smart_fixtures
    final = await _make_requests_or_exit(
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 392, in _make_requests_or_exit
    traceback.print_stack()

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Great, thanks! You could also try one of those linked PRs after adjusting the required_component field to see if it's working as expected.

@sdb9696 is more familiar with the dump_devinfo so maybe he knows off the bat how what's the issue, but I'm guess it could be the missing result in this response: {'error_code': 0, 'method': 'get_inherit_info'}.

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

Here is the component listing with some additional context information about the devices.
I hope it helps, and it contains all required infos.

DEBUG:kasa.smartprotocol:192.168.1.86 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': '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': 'child_device',
                                                          'ver_code': 1},
                                                         {'id': 'child_quick_setup',
                                                          'ver_code': 1},
                                                         {'id': 'child_inherit',
                                                          'ver_code': 1},
                                                         {'id': 'control_child',
                                                          'ver_code': 1},
                                                         {'id': 'alarm',
                                                          'ver_code': 1},
                                                         {'id': 'device_load',
                                                          'ver_code': 1},
                                                         {'id': 'device_local_time',
                                                          'ver_code': 1},
                                                         {'id': 'alarm_logs',
                                                          'ver_code': 1},
                                                         {'id': 'localSmart',
                                                          'ver_code': 1},
                                                         {'id': 'matter',
                                                          'ver_code': 3},
                                                         {'id': 'chime',
                                                          'ver_code': 1}]}},
                          {'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': 'trigger_log',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'time',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'device_local_time',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'account',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'synchronize',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'cloud_connect',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'iot_cloud',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'firmware',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'localSmart',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'battery_detect',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'temperature',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'humidity',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'temp_humidity_record',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'comfort_temperature',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'comfort_humidity',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'report_mode',
                                                                                    'ver_code': 1}],
                                                                'device_id': '802E6B66E717D6AD31BB4726011746212219698C'},
                                                               {'component_list': [{'id': 'device',
                                                                                    'ver_code': 2},
                                                                                   {'id': 'quick_setup',
                                                                                    'ver_code': 3},
                                                                                   {'id': 'trigger_log',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'time',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'device_local_time',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'account',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'synchronize',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'cloud_connect',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'iot_cloud',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'firmware',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'localSmart',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'battery_detect',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'sensor_alarm',
                                                                                    'ver_code': 1}],
                                                                'device_id': '802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7'},
                                                               {'component_list': [{'id': 'device',
                                                                                    'ver_code': 2},
                                                                                   {'id': 'quick_setup',
                                                                                    'ver_code': 3},
                                                                                   {'id': 'trigger_log',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'time',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'device_local_time',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'account',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'synchronize',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'cloud_connect',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'iot_cloud',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'firmware',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'localSmart',
                                                                                    'ver_code': 1},
                                                                                   {'id': 'battery_detect',
                                                                                    'ver_code': 1}],
                                                                'device_id': '802E3B14B17594B105DEB69CCED699DD22155944'}],
                                      'start_index': 0,
                                      'sum': 3}},
                          {'error_code': 0,
                           'method': 'get_child_device_list',
                           'result': {'child_device_list': [{'at_low_battery': False,
                                                             'avatar': 'sensor_t310',
                                                             'bind_count': 2,
                                                             'category': 'subg.trigger.temp-hmdt-sensor',
                                                             'current_humidity': 41,
                                                             'current_humidity_exception': 0,
                                                             'current_temp': 21.5,
                                                             'current_temp_exception': 0,
                                                             'device_id': '802E6B66E717D6AD31BB4726011746212219698C',
                                                             'fw_ver': '1.5.0 '
                                                                       'Build '
                                                                       '230105 '
                                                                       'Rel.150707',
                                                             'hw_id': '2AE1228C7CE042A310FC70EA70D7A788',
                                                             'hw_ver': '1.0',
                                                             'jamming_rssi': -119,
                                                             'jamming_signal_level': 1,
                                                             'lastOnboardingTimestamp': 1708892232,
                                                             'mac': 'E4FAC44C516F',
                                                             'model': 'T310',
                                                             'nickname': 'VGVtcGVyYXR1ciAoaW5uZW4p',
                                                             'oem_id': '02F7CFFC203A7E622F6EA84BBB74C68F',
                                                             'parent_device_id': '802D587301438320D7122ECF6E591028221B023C',
                                                             'region': 'Europe/Berlin',
                                                             'report_interval': 16,
                                                             'rssi': -43,
                                                             'signal_level': 3,
                                                             'specs': 'EU',
                                                             'status': 'online',
                                                             'status_follow_edge': False,
                                                             'temp_unit': 'celsius',
                                                             'type': 'SMART.TAPOSENSOR'},
                                                            {'at_low_battery': False,
                                                             'avatar': 'sensor_t300',
                                                             'battery_percentage': 100,
                                                             'bind_count': 3,
                                                             'category': 'subg.trigger.water-leak-sensor',
                                                             'device_id': '802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7',
                                                             'fw_ver': '1.7.0 '
                                                                       'Build '
                                                                       '230628 '
                                                                       'Rel.194748',
                                                             'hw_id': 'CE0B3AE8E83B5A0D78D53B41EC4D5F1E',
                                                             'hw_ver': '1.0',
                                                             'in_alarm': False,
                                                             'jamming_rssi': -121,
                                                             'jamming_signal_level': 1,
                                                             'lastOnboardingTimestamp': 1708893337,
                                                             'mac': '98254AED3001',
                                                             'model': 'T300',
                                                             'nickname': 'V2Fzc2Vy',
                                                             'oem_id': 'BA0BFAB2B6264F680059C097EA3AC8F4',
                                                             'parent_device_id': '802D587301438320D7122ECF6E591028221B023C',
                                                             'region': 'Europe/Berlin',
                                                             'report_interval': 16,
                                                             'rssi': -43,
                                                             'signal_level': 3,
                                                             'specs': 'EU',
                                                             'status': 'online',
                                                             'status_follow_edge': False,
                                                             'type': 'SMART.TAPOSENSOR',
                                                             'water_leak_status': 'normal'},
                                                            {'at_low_battery': False,
                                                             'avatar': 'sensor_t110',
                                                             'bind_count': 2,
                                                             'category': 'subg.trigger.contact-sensor',
                                                             'device_id': '802E3B14B17594B105DEB69CCED699DD22155944',
                                                             'fw_ver': '1.9.0 '
                                                                       'Build '
                                                                       '230704 '
                                                                       'Rel.154531',
                                                             'hw_id': '8B5164B3EDF216E59BCAB740ABCB40CD',
                                                             'hw_ver': '1.0',
                                                             'jamming_rssi': -117,
                                                             'jamming_signal_level': 1,
                                                             'lastOnboardingTimestamp': 1708892158,
                                                             'mac': 'E4FAC4310C0D',
                                                             'model': 'T110',
                                                             'nickname': 'RGFjaCAoaW5uZW4p',
                                                             'oem_id': '477C83614EF5FFFF6A8C2D80BBD306AB',
                                                             'open': False,
                                                             'parent_device_id': '802D587301438320D7122ECF6E591028221B023C',
                                                             'region': 'Europe/Berlin',
                                                             'report_interval': 16,
                                                             'rssi': -63,
                                                             'signal_level': 3,
                                                             'specs': 'EU',
                                                             'status': 'online',
                                                             'status_follow_edge': False,
                                                             'type': 'SMART.TAPOSENSOR'}],
                                      'start_index': 0,
                                      'sum': 3}},
                          {'error_code': 0,
                           'method': 'get_device_info',
                           'result': {'avatar': 'hub',
                                      'device_id': '802D587301438320D7122ECF6E591028221B023C',
                                      'fw_id': '00000000000000000000000000000000',
                                      'fw_ver': '1.5.10 Build 240207 '
                                                'Rel.175759',
                                      'has_set_location_info': True,
                                      'hw_id': '81C01BC6E4AD1827315AC6A9D81A5132',
                                      'hw_ver': '1.0',
                                      'in_alarm': False,
                                      'in_alarm_source': '',
                                      'ip': '192.168.1.86',
                                      'lang': 'de_DE',
                                      'latitude': 493225,
                                      'longitude': 86947,
                                      'mac': 'E4-FA-C4-6F-50-64',
                                      'model': 'H100',
                                      'nickname': 'U21hcnQgSHVi',
                                      'oem_id': 'D65F1AA7B819559EDF3C5C2BD5957929',
                                      'overheated': False,
                                      'region': 'Europe/Berlin',
                                      'rssi': -44,
                                      'signal_level': 3,
                                      'specs': 'EU',
                                      'ssid': 'Q2FycGVOb2N0ZW1SZW1vdGU=',
                                      'time_diff': 60,
                                      'type': 'SMART.TAPOHUB'}},
                          {'error_code': 0,
                           'method': 'get_device_usage',
                           'result': {}}]}}

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Thanks, I updated the waterleak PR to use sensor_alarm for detection, which should work for the time being as there are no other sensors using that. We will probably need to revisit this at some later point, but feel free to test that PR if you wish.

The contact sensor doesn't provide any component specific to it, so that will require us to rethink the logic how the library handles modules, likely by introducing a way to initialize modules based on the device model.

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

Hi,
i have tested the feat/waterleak_sensor branch, and it seems to work.

output:

...
        == Debug ==
        Device ID (device_id): 802E6B66E717D6AD31BB4726011746212219698C
        RSSI (rssi): -45
        Report interval (report_interval): 16
        Time (time): 2024-04-28 11:33:58+01:00

         == Wasser (T300, DeviceType.Sensor) ==

        == Information ==
        Signal Level (signal_level): 3
        Battery level (battery_level): 100
        Battery low (battery_low): False
        Cloud connection (cloud_connection): True
        Update available (update_available): False
        Status (status): normal
        Alarm (alarm): False

        == Debug ==
        Device ID (device_id): 802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7
        RSSI (rssi): -47
        Time (time): 2024-04-28 11:33:58+01:00
...

json:

            {
                "parent_device_id": "802D587301438320D7122ECF6E591028221B023C",
                "hw_ver": "1.0",
                "fw_ver": "1.7.0 Build 230628 Rel.194748",
                "device_id": "802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7",
                "mac": "98254AED3001",
                "type": "SMART.TAPOSENSOR",
                "model": "T300",
                "hw_id": "CE0B3AE8E83B5A0D78D53B41EC4D5F1E",
                "oem_id": "BA0BFAB2B6264F680059C097EA3AC8F4",
                "specs": "EU",
                "category": "subg.trigger.water-leak-sensor",
                "bind_count": 3,
                "status_follow_edge": false,
                "status": "online",
                "lastOnboardingTimestamp": 1708893337,
                "rssi": -53,
                "signal_level": 3,
                "jamming_rssi": -120,
                "jamming_signal_level": 1,
                "in_alarm": false,
                "water_leak_status": "water_dry",
                "trigger_timestamp": 1714300553,
                "battery_percentage": 100,
                "at_low_battery": false,
                "nickname": "V2Fzc2Vy",
                "avatar": "sensor_t300",
                "report_interval": 16,
                "region": "Europe/Berlin"
            },

"water_leak_status" can be either "normal" -> "water_leak" -> "water_dry" (after the water has dried up) -> "normal"

It seems "in_alarm" will always only be true if the alarm sound on the sensor is enabled - if it is silent "in_alarm" seems to be always false.

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

Regarding the T110:

At least it does not show up anymore as unknown device.

In the CLI the output of the contact status is still missing:

         == Dach (innen) (T110, DeviceType.Sensor) ==

        == Information ==
        Signal Level (signal_level): 3
        Battery level (battery_level): got exception ('battery_percentage')
        Battery low (battery_low): False
        Cloud connection (cloud_connection): True
        Update available (update_available): False

        == Debug ==
        Device ID (device_id): 802E3B14B17594B105DEB69CCED699DD22155944
        RSSI (rssi): -73
        Time (time): 2024-04-28 12:15:25+01:00

JSON looks fine

        "child_device_list": [
            {
                "parent_device_id": "802D587301438320D7122ECF6E591028221B023C",
                "hw_ver": "1.0",
                "fw_ver": "1.9.0 Build 230704 Rel.154531",
                "device_id": "802E3B14B17594B105DEB69CCED699DD22155944",
                "mac": "E4FAC4310C0D",
                "type": "SMART.TAPOSENSOR",
                "model": "T110",
                "hw_id": "8B5164B3EDF216E59BCAB740ABCB40CD",
                "oem_id": "477C83614EF5FFFF6A8C2D80BBD306AB",
                "specs": "EU",
                "category": "subg.trigger.contact-sensor",
                "bind_count": 2,
                "status_follow_edge": false,
                "status": "online",
                "lastOnboardingTimestamp": 1708892158,
                "rssi": -73,
                "signal_level": 3,
                "jamming_rssi": -114,
                "jamming_signal_level": 1,
                "at_low_battery": false,
                "open": false,
                "nickname": "RGFjaCAoaW5uZW4p",
                "avatar": "sensor_t110",
                "report_interval": 16,
                "region": "Europe/Berlin"
            },

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

i have tested the feat/waterleak_sensor branch, and it seems to work.

"water_leak_status" can be either "normal" -> "water_leak" -> "water_dry" (after the water has dried up) -> "normal"
It seems "in_alarm" will always only be true if the alarm sound on the sensor is enabled - if it is silent "in_alarm" seems to be always false.

Great, so both of these features are useful to have around! I updated the PR a bit and it should be ready to be merged now. Would you mind retesting to make sure it's still working? I added an enum for the water leak status, so that we can later show the available options for homeassistant automations.

At least it does not show up anymore as unknown device.
In the CLI the output of the contact status is still missing:

Yeah, this will require some architectural changes as we are currently initializing the modules based on supported component names and there was nothing explicit for the contact sensor. We are either going to need to use the existence of "open" in the response, or the model information, to decide on that, but neither is really optimal.

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

ok.. did another test:

Normal state:

        == Information ==
        Signal Level (signal_level): 3
        Battery level (battery_level): 100
        Battery low (battery_low): False
        Cloud connection (cloud_connection): True
        Update available (update_available): False
        Water leak (water_leak): WaterleakStatus.Normal
        Water alert (water_alert): False
            {
                "parent_device_id": "802D587301438320D7122ECF6E591028221B023C",
                "hw_ver": "1.0",
                "fw_ver": "1.7.0 Build 230628 Rel.194748",
                "device_id": "802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7",
                "mac": "98254AED3001",
                "type": "SMART.TAPOSENSOR",
                "model": "T300",
                "hw_id": "CE0B3AE8E83B5A0D78D53B41EC4D5F1E",
                "oem_id": "BA0BFAB2B6264F680059C097EA3AC8F4",
                "specs": "EU",
                "category": "subg.trigger.water-leak-sensor",
                "bind_count": 6,
                "status_follow_edge": false,
                "status": "online",
                "lastOnboardingTimestamp": 1714302216,
                "rssi": -44,
                "signal_level": 3,
                "jamming_rssi": -114,
                "jamming_signal_level": 1,
                "in_alarm": false,
                "water_leak_status": "normal",
                "battery_percentage": 100,
                "at_low_battery": false,
                "nickname": "V2Fzc2VybGVjaw==",
                "avatar": "sensor_t300",
                "report_interval": 16,
                "region": "Europe/Berlin"
            },

Wet state:

        == Information ==
        Signal Level (signal_level): 3
        Battery level (battery_level): 100
        Battery low (battery_low): False
        Cloud connection (cloud_connection): True
        Update available (update_available): False
        Water leak (water_leak): WaterleakStatus.LeakDetected
        Water alert (water_alert): False
            {
                "parent_device_id": "802D587301438320D7122ECF6E591028221B023C",
                "hw_ver": "1.0",
                "fw_ver": "1.7.0 Build 230628 Rel.194748",
                "device_id": "802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7",
                "mac": "98254AED3001",
                "type": "SMART.TAPOSENSOR",
                "model": "T300",
                "hw_id": "CE0B3AE8E83B5A0D78D53B41EC4D5F1E",
                "oem_id": "BA0BFAB2B6264F680059C097EA3AC8F4",
                "specs": "EU",
                "category": "subg.trigger.water-leak-sensor",
                "bind_count": 6,
                "status_follow_edge": false,
                "status": "online",
                "lastOnboardingTimestamp": 1714302216,
                "rssi": -60,
                "signal_level": 3,
                "jamming_rssi": -118,
                "jamming_signal_level": 1,
                "in_alarm": false,
                "water_leak_status": "water_leak",
                "trigger_timestamp": 1714310287,
                "battery_percentage": 100,
                "at_low_battery": false,
                "nickname": "V2Fzc2VybGVjaw==",
                "avatar": "sensor_t300",
                "report_interval": 16,
                "region": "Europe/Berlin"
            },

Drying State:

        == Information ==
        Signal Level (signal_level): 3
        Battery level (battery_level): 100
        Battery low (battery_low): False
        Cloud connection (cloud_connection): True
        Update available (update_available): False
        Water leak (water_leak): WaterleakStatus.Drying
        Water alert (water_alert): False
            {
                "parent_device_id": "802D587301438320D7122ECF6E591028221B023C",
                "hw_ver": "1.0",
                "fw_ver": "1.7.0 Build 230628 Rel.194748",
                "device_id": "802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7",
                "mac": "98254AED3001",
                "type": "SMART.TAPOSENSOR",
                "model": "T300",
                "hw_id": "CE0B3AE8E83B5A0D78D53B41EC4D5F1E",
                "oem_id": "BA0BFAB2B6264F680059C097EA3AC8F4",
                "specs": "EU",
                "category": "subg.trigger.water-leak-sensor",
                "bind_count": 6,
                "status_follow_edge": false,
                "status": "online",
                "lastOnboardingTimestamp": 1714302216,
                "rssi": -54,
                "signal_level": 3,
                "jamming_rssi": -124,
                "jamming_signal_level": 1,
                "in_alarm": false,
                "water_leak_status": "water_dry",
                "trigger_timestamp": 1714310408,
                "battery_percentage": 100,
                "at_low_battery": false,
                "nickname": "V2Fzc2VybGVjaw==",
                "avatar": "sensor_t300",
                "report_interval": 16,
                "region": "Europe/Berlin"
            },

Wet state with sound alert:

        == Information ==
        Signal Level (signal_level): 3
        Battery level (battery_level): 100
        Battery low (battery_low): False
        Cloud connection (cloud_connection): True
        Update available (update_available): False
        Water leak (water_leak): WaterleakStatus.LeakDetected
        Water alert (water_alert): True
            {
                "parent_device_id": "802D587301438320D7122ECF6E591028221B023C",
                "hw_ver": "1.0",
                "fw_ver": "1.7.0 Build 230628 Rel.194748",
                "device_id": "802ED99B9EC1A0A8C9F48AB5C709927D2245EEE7",
                "mac": "98254AED3001",
                "type": "SMART.TAPOSENSOR",
                "model": "T300",
                "hw_id": "CE0B3AE8E83B5A0D78D53B41EC4D5F1E",
                "oem_id": "BA0BFAB2B6264F680059C097EA3AC8F4",
                "specs": "EU",
                "category": "subg.trigger.water-leak-sensor",
                "bind_count": 6,
                "status_follow_edge": false,
                "status": "online",
                "lastOnboardingTimestamp": 1714302216,
                "rssi": -55,
                "signal_level": 3,
                "jamming_rssi": -121,
                "jamming_signal_level": 1,
                "in_alarm": true,
                "water_leak_status": "water_leak",
                "trigger_timestamp": 1714310503,
                "battery_percentage": 100,
                "at_low_battery": false,
                "nickname": "V2Fzc2VybGVjaw==",
                "avatar": "sensor_t300",
                "report_interval": 16,
                "region": "Europe/Berlin"
            },

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Yes, please create a new issue for that. The --credential-hash should work, but note that this is protocol specific, i.e., the hash gets generated differently for KLAP and for AES encryption schemes, that's likely the problem you are encountering here?

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

thanks - i created #878 for it.

from python-kasa.

sdb9696 avatar sdb9696 commented on July 2, 2024

@sdb9696 is more familiar with the dump_devinfo so maybe he knows off the bat how what's the issue, but I'm guess it could be the missing result in this response: {'error_code': 0, 'method': 'get_inherit_info'}.

@ngaertner PR #882 should fix the dump_devinfo issue you were having. If you could try running it from that PR it should work now and give you the fixture. Thanks.

EDIT: #884 contains the fix and has been merged so you should be able to run this from the master branch now.

from python-kasa.

sdb9696 avatar sdb9696 commented on July 2, 2024

Hi @ngaertner, it would be really great if you could try the dump_devinfo from the latest master branch of python-kasa. If we get those fixtures uploading we'll be able to confirm that we can properly support these devices and make sure the support goes into the next library release.

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

The saving of the fixture JSON failed, but here's the output - I hope it helps.
Just note that this is now a different hub, as I don't have access to the original one anymore.

## device info file ##
{'component_nego': {'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': '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': 'child_device', 'ver_code': 1},
                                       {'id': 'child_quick_setup',
                                        'ver_code': 1},
                                       {'id': 'child_inherit', 'ver_code': 1},
                                       {'id': 'control_child', 'ver_code': 1},
                                       {'id': 'alarm', 'ver_code': 1},
                                       {'id': 'device_load', 'ver_code': 1},
                                       {'id': 'device_local_time',
                                        'ver_code': 1},
                                       {'id': 'alarm_logs', 'ver_code': 1},
                                       {'id': 'localSmart', 'ver_code': 1},
                                       {'id': 'matter', 'ver_code': 3},
                                       {'id': 'chime', 'ver_code': 1}]},
 'discovery_result': {'device_id': '00000000000000000000000000000000',
                      'device_model': 'H100(EU)',
                      'device_type': 'SMART.TAPOHUB',
                      'factory_default': False,
                      'ip': '127.0.0.123',
                      'is_support_iot_cloud': True,
                      'mac': '5C-E9-31-00-00-00',
                      'mgt_encrypt_schm': {'encrypt_type': 'AES',
                                           'http_port': 80,
                                           'is_support_https': False,
                                           'lv': 2},
                      'obd_src': 'tplink',
                      'owner': '00000000000000000000000000000000'},
 'get_alarm_configure': {'duration': 300,
                         'type': 'Doorbell Ring 1',
                         'volume': 'high'},
 'get_auto_update_info': {'enable': True, 'random_range': 120, 'time': 180},
 'get_child_device_component_list': {'child_component_list': [{'component_list': [{'id': 'device',
                                                                                   'ver_code': 2},
                                                                                  {'id': 'quick_setup',
                                                                                   'ver_code': 3},
                                                                                  {'id': 'trigger_log',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'time',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'device_local_time',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'account',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'synchronize',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'cloud_connect',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'iot_cloud',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'firmware',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'localSmart',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'battery_detect',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'sensor_alarm',
                                                                                   'ver_code': 1}],
                                                               'device_id': 'SCRUBBED_CHILD_DEVICE_ID_1'},
                                                              {'component_list': [{'id': 'device',
                                                                                   'ver_code': 2},
                                                                                  {'id': 'quick_setup',
                                                                                   'ver_code': 3},
                                                                                  {'id': 'trigger_log',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'time',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'device_local_time',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'account',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'synchronize',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'cloud_connect',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'iot_cloud',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'firmware',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'localSmart',
                                                                                   'ver_code': 1},
                                                                                  {'id': 'battery_detect',
                                                                                   'ver_code': 1}],
                                                               'device_id': 'SCRUBBED_CHILD_DEVICE_ID_2'}],
                                     'start_index': 0,
                                     'sum': 2},
 'get_child_device_list': {'child_device_list': [{'at_low_battery': False,
                                                  'avatar': 'sensor_t300',
                                                  'battery_percentage': 100,
                                                  'bind_count': 1,
                                                  'category': 'subg.trigger.water-leak-sensor',
                                                  'device_id': 'SCRUBBED_CHILD_DEVICE_ID_1',
                                                  'fw_ver': '1.7.0 Build '
                                                            '230628 Rel.194748',
                                                  'hw_id': '00000000000000000000000000000000',
                                                  'hw_ver': '1.0',
                                                  'in_alarm': False,
                                                  'jamming_rssi': -119,
                                                  'jamming_signal_level': 1,
                                                  'lastOnboardingTimestamp': 1714661760,
                                                  'mac': '98254A000000',
                                                  'model': 'T300',
                                                  'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                  'oem_id': '00000000000000000000000000000000',
                                                  'parent_device_id': '0000000000000000000000000000000000000000',
                                                  'region': 'Europe/Berlin',
                                                  'report_interval': 16,
                                                  'rssi': -73,
                                                  'signal_level': 3,
                                                  'specs': 'EU',
                                                  'status': 'online',
                                                  'status_follow_edge': False,
                                                  'type': 'SMART.TAPOSENSOR',
                                                  'water_leak_status': 'normal'},
                                                 {'at_low_battery': False,
                                                  'avatar': 'sensor_t110',
                                                  'bind_count': 1,
                                                  'category': 'subg.trigger.contact-sensor',
                                                  'device_id': 'SCRUBBED_CHILD_DEVICE_ID_2',
                                                  'fw_ver': '1.8.0 Build '
                                                            '220728 Rel.160024',
                                                  'hw_id': '00000000000000000000000000000000',
                                                  'hw_ver': '1.0',
                                                  'jamming_rssi': -113,
                                                  'jamming_signal_level': 1,
                                                  'lastOnboardingTimestamp': 1714661626,
                                                  'mac': 'E4FAC4000000',
                                                  'model': 'T110',
                                                  'nickname': 'I01BU0tFRF9OQU1FIw==',
                                                  'oem_id': '00000000000000000000000000000000',
                                                  'open': False,
                                                  'parent_device_id': '0000000000000000000000000000000000000000',
                                                  'region': 'Europe/Berlin',
                                                  'report_interval': 16,
                                                  'rssi': -54,
                                                  'signal_level': 3,
                                                  'specs': 'EU',
                                                  'status': 'online',
                                                  'status_follow_edge': False,
                                                  'type': 'SMART.TAPOSENSOR'}],
                           'start_index': 0,
                           'sum': 2},
 'get_connect_cloud_state': {'status': 0},
 'get_device_info': {'avatar': 'hub',
                     'device_id': '0000000000000000000000000000000000000000',
                     'fw_id': '00000000000000000000000000000000',
                     'fw_ver': '1.5.10 Build 240207 Rel.175759',
                     'has_set_location_info': True,
                     'hw_id': '00000000000000000000000000000000',
                     'hw_ver': '1.0',
                     'in_alarm': False,
                     'in_alarm_source': '',
                     'ip': '127.0.0.123',
                     'lang': '',
                     'latitude': 0,
                     'longitude': 0,
                     'mac': '5C-E9-31-00-00-00',
                     'model': 'H100',
                     'nickname': 'I01BU0tFRF9OQU1FIw==',
                     'oem_id': '00000000000000000000000000000000',
                     'overheated': False,
                     'region': 'Europe/Berlin',
                     'rssi': -46,
                     'signal_level': 3,
                     'specs': 'EU',
                     'ssid': 'I01BU0tFRF9TU0lEIw==',
                     'time_diff': 60,
                     'type': 'SMART.TAPOHUB'},
 'get_device_load_info': {'cur_load_num': 2,
                          'load_level': 'light',
                          'max_load_num': 64,
                          'total_memory': 4352,
                          'used_memory': 1483},
 'get_device_time': {'region': 'Europe/Berlin',
                     'time_diff': 60,
                     'timestamp': 1714666608},
 'get_device_usage': {},
 'get_fw_download_state': {'auto_upgrade': False,
                           'download_progress': 0,
                           'reboot_time': 5,
                           'status': 0,
                           'upgrade_time': 5},
 'get_inherit_info': None,
 'get_latest_fw': {'fw_size': 0,
                   'fw_ver': '1.5.10 Build 240207 Rel.175759',
                   'hw_id': '',
                   'need_to_upgrade': False,
                   'oem_id': '',
                   'release_date': '',
                   'release_note': '',
                   'type': 0},
 'get_led_info': {'led_rule': 'always',
                  'led_status': True,
                  'night_mode': {'end_time': 359,
                                 'night_mode_type': 'sunrise_sunset',
                                 'start_time': 1246,
                                 'sunrise_offset': 0,
                                 'sunset_offset': 0}},
 'get_matter_setup_info': {'setup_code': '00000000000',
                           'setup_payload': '00:000000-000000000000'},
 'get_support_alarm_type_list': {'alarm_type_list': ['Doorbell Ring 1',
                                                     'Doorbell Ring 2',
                                                     'Doorbell Ring 3',
                                                     'Doorbell Ring 4',
                                                     'Doorbell Ring 5',
                                                     'Doorbell Ring 6',
                                                     'Doorbell Ring 7',
                                                     'Doorbell Ring 8',
                                                     'Doorbell Ring 9',
                                                     'Doorbell Ring 10',
                                                     'Phone Ring',
                                                     'Alarm 1',
                                                     'Alarm 2',
                                                     'Alarm 3',
                                                     'Alarm 4',
                                                     'Dripping Tap',
                                                     'Alarm 5',
                                                     'Connection 1',
                                                     'Connection 2']},
 'get_support_child_device_category': {'device_category_list': [{'category': 'subg.trv'},
                                                                {'category': 'subg.trigger'},
                                                                {'category': 'subg.plugswitch'}]},
 'get_wireless_scan_info': {'ap_list': [],
                            'start_index': 0,
                            'sum': 0,
                            'wep_supported': False},
 'qs_component_nego': {'component_list': [{'id': 'quick_setup', 'ver_code': 3},
                                          {'id': 'sunrise_sunset',
                                           'ver_code': 1},
                                          {'id': 'iot_cloud', 'ver_code': 1},
                                          {'id': 'inherit', 'ver_code': 1},
                                          {'id': 'firmware', 'ver_code': 2},
                                          {'id': 'matter', 'ver_code': 3}],
                       'extra_info': {'device_model': 'H100',
                                      'device_type': 'SMART.TAPOHUB',
                                      'is_klap': False}}}

from python-kasa.

ngaertner avatar ngaertner commented on July 2, 2024

And here's the error that I received...

Do you want to save the above content to kasa\tests\fixtures\smart\H100(EU)_1.0_1.5.10.json (y/n): y
Saving info to kasa\tests\fixtures\smart\H100(EU)_1.0_1.5.10.json
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 696, in <module>
    cli()
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1205, in __call__
    return anyio.run(self._main, main, args, kwargs, **opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\anyio\_core\_eventloop.py", line 73, in run
    return async_backend.run(func, args, {}, backend_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\anyio\_backends\_asyncio.py", line 2001, in run
    return runner.run(wrapper())
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\anyio\_backends\_asyncio.py", line 1989, in wrapper
    return await func(*args)
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1208, in _main
    return await main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1120, in main
    rv = await self.invoke(ctx)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 1485, in invoke
    return await ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ngaer\AppData\Local\pypoetry\Cache\virtualenvs\python-kasa-CdcHLFJd-py3.11\Lib\site-packages\asyncclick\core.py", line 824, in invoke
    rv = await rv
         ^^^^^^^^
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 256, in cli
    await handle_device(basedir, autosave, device, batch_size)
  File "C:\git\python-kasa\devtools\dump_devinfo.py", line 167, in handle_device
    with open(save_filename, "w") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'kasa\\tests\\fixtures\\smart\\H100(EU)_1.0_1.5.10.json'

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Unfortunately, that only contains the fixture for the main device. Could you retry it with #894?

from python-kasa.

sdb9696 avatar sdb9696 commented on July 2, 2024

Ah, it assumes you're running from a cloned git repository. First it tries to save the hub then the children. If you create the following folders below where you are running it from it should save all of them:

kasa\tests\fixtures\smart\child

The hub will be in the smart folder and the other devices in the child folder.

from python-kasa.

rytilahti avatar rytilahti commented on July 2, 2024

Feel free to test if #877 works now with the contact sensor. I'm unsure if that's the correct approach (instead of trying to initialize all modules and to check _check_supported), but it's worth testing if it works otherwise.

from python-kasa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.