I discovered in Home Assistant that my T310 (connected via H100) was reported as unavailable and upon investigating I found that python-kasa was throwing the attached error.
I ran the following command from inside the Home Assistant v2025.2.1 docker container kasa --username <username> --password <password> --host <host> --debug &> dump.txt.
Looks like the device is not reporting its build version as part of the firmware version field:
'fw_ver': '1.5.0',
which causes the crash as the code is expecting the version string to contain an empty space.
Relevant information from the log:
File "/usr/local/lib/python3.13/site-packages/kasa/cli/device.py", line 70, in state
title_prefix=f"{child.alias} ({child.model})",
^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartdevice.py", line 590, in model
return self.device_info.short_name
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartchilddevice.py", line 63, in device_info
return self._get_device_info(
~~~~~~~~~~~~~~~~~~~~~^
{
^
...<3 lines>...
None,
^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartdevice.py", line 916, in _get_device_info
firmware_version, firmware_build = fw_version_full.split(" ", maxsplit=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Activity
rytilahti commented on Feb 9, 2025
Looks like the device is not reporting its build version as part of the firmware version field:
which causes the crash as the code is expecting the version string to contain an empty space.
Relevant information from the log:
File "/usr/local/lib/python3.13/site-packages/kasa/cli/device.py", line 70, in state title_prefix=f"{child.alias} ({child.model})", ^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartdevice.py", line 590, in model return self.device_info.short_name ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartchilddevice.py", line 63, in device_info return self._get_device_info( ~~~~~~~~~~~~~~~~~~~~~^ { ^ ...<3 lines>... None, ^^^^^ ) ^ File "/usr/local/lib/python3.13/site-packages/kasa/smart/smartdevice.py", line 916, in _get_device_info firmware_version, firmware_build = fw_version_full.split(" ", maxsplit=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^It would be great if you could create a fixture file (https://python-kasa.readthedocs.io/en/stable/contribute.html#contributing-fixture-files) to this device and upload it, so we can add a test & create a fix for this. This can be done on any device that runs python, so no need to do it inside a docker container.
LXGaming commented on Feb 9, 2025
Unfortunately attempting to create a fixture results in the same error occurring
python-kasa-fixture-dump.txt
rytilahti commented on Feb 9, 2025
You could try with #1500 to see if that helps. If you have github client installed, gh pr checkout 1500 will fetch the correct branch.
LXGaming commented on Feb 9, 2025
Thank you for fixing that, I've attached the fixture.
T310(US)_1.0_1.5.0.json
rytilahti commented on Feb 10, 2025
Thanks for reporting and for the fixture, this should be fixed in the next release!
Prepare 0.10.2 (#1505)
Prepare 0.10.2 (python-kasa#1505)
Prepare 0.10.2 (python-kasa#1505)
Prepare 0.10.2 (python-kasa#1505)
Prepare 0.10.2 (python-kasa#1505)
Prepare 0.10.2 (python-kasa#1505)