Skip to content

ZoneInfoNotFoundError(f"No time zone found with key {key}") #1620

@KF0ILP

Description

@KF0ILP

I had to install pipx to get kasa to install on my OS.

Bottom line Issue:
ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key MST7MDT'

Environment:
OS : Debian GNU/Linux 13 (trixie)
OS Kernel : 6.12.47+rpt-rpi-v8


kasa --debug --host 172.16.64.114 on
Discovering device 172.16.64.114 for 10 seconds
DEBUG:kasa.discover:[DISCOVERY] 172.16.64.114 >> {'system': {'get_sysinfo': {}}}
DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
DEBUG:kasa.discover:[DISCOVERY] 172.16.64.114 << {'system': {'get_sysinfo': {'active_mode': 'schedule',
'alias': '#MASKED_NAME#',
'dev_name': 'Smart Wi-Fi Plug Mini',
'deviceId': 'REDACTED_0A22BC71268038F2A8D3C781DBDEBED',
'err_code': 0,
'feature': 'TIM',
'hwId': 'REDACTED_1D91460D5F5201C65C8A549',
'hw_ver': '5.0',
'icon_hash': '',
'latitude_i': 0,
'led_off': 0,
'longitude_i': 0,
'mac': 'E4:C3:2A:00:00:00',
'mic_type': 'IOT.SMARTPLUGSWITCH',
'model': 'HS105(US)',
'next_action': {'action': 1,
'id': '5DBDFAA268B419837121453B876D957C',
'schd_sec': 59400,
'type': 1},
'obd_src': 'tplink',
'oemId': 'REDACTED_350D76F11728AC99180D5E8',
'on_time': 0,
'relay_state': 0,
'rssi': -38,
'status': 'configured',
'sw_ver': '1.0.2 Build 200819 Rel.103733',
'updating': 0}}}
DEBUG:kasa.device:Initializing 172.16.64.114 of type <class 'kasa.iot.iotplug.IotPlug'>
DEBUG:kasa.device_factory:Finding protocol for 172.16.64.114
DEBUG:kasa.device_factory:Finding protocol for DeviceFamily.IotSmartPlugSwitch
DEBUG:kasa.device_factory:Finding transport for IOT.XOR
DEBUG:kasa.iot.iotdevice:Adding module <Module Schedule (schedule) for 172.16.64.114>
DEBUG:kasa.iot.iotdevice:Adding module <Module Usage (schedule) for 172.16.64.114>
DEBUG:kasa.iot.iotdevice:Adding module <Module Antitheft (anti_theft) for 172.16.64.114>
DEBUG:kasa.iot.iotdevice:Adding module <Module Time (time) for 172.16.64.114>
DEBUG:kasa.iot.iotdevice:Adding module <Module Cloud (cnCloud) for 172.16.64.114>
DEBUG:kasa.iot.iotdevice:Adding module <Module Led (system) for 172.16.64.114>
DEBUG:kasa.iot.iotmodule:Initial update, so consider supported: schedule
DEBUG:kasa.iot.iotdevice:Adding query for <Module Schedule (schedule) for 172.16.64.114>: {'schedule': {'get_rules': {}, 'get_next_action': {}}}
DEBUG:kasa.iot.iotmodule:Initial update, so consider supported: schedule
DEBUG:kasa.iot.iotdevice:Adding query for <Module Usage (schedule) for 172.16.64.114>: {'schedule': {'get_realtime': {}, 'get_daystat': {'year': 2025, 'month': 12}, 'get_monthstat': {'year': 2025}}}
DEBUG:kasa.iot.iotmodule:Initial update, so consider supported: anti_theft
DEBUG:kasa.iot.iotdevice:Adding query for <Module Antitheft (anti_theft) for 172.16.64.114>: {'anti_theft': {'get_rules': {}, 'get_next_action': {}}}
DEBUG:kasa.iot.iotmodule:Initial update, so consider supported: time
DEBUG:kasa.iot.iotdevice:Adding query for <Module Time (time) for 172.16.64.114>: {'time': {'get_time': {}, 'get_timezone': {}}}
DEBUG:kasa.iot.iotmodule:Initial update, so consider supported: cnCloud
DEBUG:kasa.iot.iotdevice:Adding query for <Module Cloud (cnCloud) for 172.16.64.114>: {'cnCloud': {'get_info': {}}}
DEBUG:kasa.iot.iotdevice:Adding query for <Module Led (system) for 172.16.64.114>: {}
DEBUG:kasa.protocols.iotprotocol:172.16.64.114 >> {"system":{"get_sysinfo":{}},"schedule":{"get_rules":{},"get_next_action":{},"get_realtime":{},"get_daystat":{"year":2025,"month":12},"get_monthstat":{"year":2025}},"anti_theft":{"get_rules":{},"get_next_action":{}},"time":{"get_time":{},"get_timezone":{}},"cnCloud":{"get_info":{}}}
DEBUG:kasa.transports.xortransport:Device 172.16.64.114 sending query {"system":{"get_sysinfo":{}},"schedule":{"get_rules":{},"get_next_action":{},"get_realtime":{},"get_daystat":{"year":2025,"month":12},"get_monthstat":{"year":2025}},"anti_theft":{"get_rules":{},"get_next_action":{}},"time":{"get_time":{},"get_timezone":{}},"cnCloud":{"get_info":{}}}
DEBUG:kasa.transports.xortransport:Device 172.16.64.114 query response received
DEBUG:kasa.protocols.iotprotocol:172.16.64.114 << {'anti_theft': {'get_next_action': {'err_code': -2,
'err_msg': 'member not support'},
'get_rules': {'enable': 0,
'err_code': 0,
'rule_list': [],
'version': 2}},
'cnCloud': {'get_info': {'binded': 1,
'cld_connection': 1,
'err_code': 0,
'fwDlPage': '',
'fwNotifyType': -1,
'illegalType': 0,
'server': 'n-devs.tplinkcloud.com',
'stopConnect': 0,
'tcspInfo': '',
'tcspStatus': 1,
'username': '[email protected]'}},
'schedule': {'get_daystat': {'day_list': [{'day': 1,
'month': 12,
'time': 390,
'year': 2025},
{'day': 2,
'month': 12,
'time': 390,
'year': 2025},
{'day': 3,
'month': 12,
'time': 390,
'year': 2025},
{'day': 4,
'month': 12,
'time': 390,
'year': 2025},
{'day': 5,
'month': 12,
'time': 390,
'year': 2025},
{'day': 6,
'month': 12,
'time': 0,
'year': 2025}],
'err_code': 0},
'get_monthstat': {'err_code': 0,
'month_list': [{'month': 6,
'time': 10800,
'year': 2025},
{'month': 7,
'time': 11157,
'year': 2025},
{'month': 8,
'time': 10998,
'year': 2025},
{'month': 9,
'time': 10799,
'year': 2025},
{'month': 10,
'time': 11159,
'year': 2025},
{'month': 11,
'time': 11639,
'year': 2025},
{'month': 12,
'time': 1950,
'year': 2025},
{'month': 1,
'time': 13019,
'year': 2025},
{'month': 2,
'time': 11759,
'year': 2025},
{'month': 3,
'time': 13018,
'year': 2025},
{'month': 4,
'time': 12600,
'year': 2025},
{'month': 5,
'time': 11557,
'year': 2025}]},
'get_next_action': {'action': 1,
'err_code': 0,
'id': '5DBDFAA268B419837121453B876D957C',
'schd_time': 59400,
'type': 1},
'get_realtime': {'err_code': -2, 'err_msg': 'member not support'},
'get_rules': {'enable': 1,
'err_code': 0,
'rule_list': [{'eact': -1,
'enable': 1,
'id': '5DBDFAA268B419837121453B876D957C',
'name': 'name',
'repeat': 1,
'sact': 1,
'smin': 990,
'stime_opt': 0,
'wday': [1, 1, 1, 1, 1, 1, 1]},
{'eact': -1,
'enable': 1,
'id': '3BFB45E465E0A4D574B01A1B55A58B84',
'name': 'name',
'repeat': 1,
'sact': 0,
'smin': 1380,
'stime_opt': 0,
'wday': [1, 1, 1, 1, 1, 1, 1]}],
'version': 2}},
'system': {'get_sysinfo': {'active_mode': 'schedule',
'alias': '#MASKED_NAME#',
'dev_name': 'Smart Wi-Fi Plug Mini',
'deviceId': 'REDACTED_0A22BC71268038F2A8D3C781DBDEBED',
'err_code': 0,
'feature': 'TIM',
'hwId': 'REDACTED_1D91460D5F5201C65C8A549',
'hw_ver': '5.0',
'icon_hash': '',
'latitude_i': 0,
'led_off': 0,
'longitude_i': 0,
'mac': 'E4:C3:2A:00:00:00',
'mic_type': 'IOT.SMARTPLUGSWITCH',
'model': 'HS105(US)',
'next_action': {'action': 1,
'id': '5DBDFAA268B419837121453B876D957C',
'schd_sec': 59400,
'type': 1},
'obd_src': 'tplink',
'oemId': 'REDACTED_350D76F11728AC99180D5E8',
'on_time': 0,
'relay_state': 0,
'rssi': -38,
'status': 'configured',
'sw_ver': '1.0.2 Build 200819 Rel.103733',
'updating': 0}},
'time': {'get_time': {'err_code': 0,
'hour': 6,
'mday': 6,
'min': 33,
'month': 12,
'sec': 12,
'year': 2025},
'get_timezone': {'err_code': 0, 'index': 10}}}
Raised error: 'No time zone found with key MST7MDT'
Traceback (most recent call last):
File "/usr/lib/python3.13/zoneinfo/_common.py", line 12, in load_tzdata
return resources.files(package_name).joinpath(resource_name).open("rb")
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/usr/lib/python3.13/importlib/resources/_common.py", line 46, in wrapper
return func(anchor)
File "/usr/lib/python3.13/importlib/resources/_common.py", line 56, in files
return from_package(resolve(anchor))
~~~~~~~^^^^^^^^
File "/usr/lib/python3.13/functools.py", line 934, in wrapper
return dispatch(args[0].class)(*args, **kw)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/lib/python3.13/importlib/resources/_common.py", line 82, in _
return importlib.import_module(cand)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tzdata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/.local/bin/kasa", line 7, in
sys.exit(cli())
~~~^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py", line 282, in call
asyncio.run(self.main(*args, **kwargs))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/asyncclick/core.py", line 1443, in main
rv = await self.invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py", line 270, in invoke
_handle_exception(self._debug, exc)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/cli/common.py", line 268, in invoke
return await super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/asyncclick/core.py", line 1953, in invoke
await super().invoke(ctx)
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/asyncclick/core.py", line 1306, in invoke
return await ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/asyncclick/core.py", line 873, in invoke
rv = await rv
^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/cli/main.py", line 370, in cli
await dev.update()
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/iot/iotdevice.py", line 326, in update
await module._post_update_hook()
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/iot/modules/time.py", line 28, in _post_update_hook
self._timezone = await get_timezone(res.get("index"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/iot/iottimezone.py", line 24, in get_timezone
return await CachedZoneInfo.get_cached_zone_info(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/cachedzoneinfo.py", line 20, in get_cached_zone_info
zinfo = await loop.run_in_executor(None, _get_zone_info, time_zone_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/root/.local/share/pipx/venvs/python-kasa/lib/python3.13/site-packages/kasa/cachedzoneinfo.py", line 27, in _get_zone_info
return ZoneInfo(time_zone_str)
File "/usr/lib/python3.13/zoneinfo/_common.py", line 24, in load_tzdata
raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key MST7MDT'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions