Skip to content

No time zone found with key GB #1508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ZeliardM opened this issue Feb 20, 2025 · 10 comments
Open

No time zone found with key GB #1508

ZeliardM opened this issue Feb 20, 2025 · 10 comments

Comments

@ZeliardM
Copy link
Contributor

I have a user that is reporting an issue when discovering devices from my plug-in, it gives them an error during discovery about No time zone found with key GB.

They state that they are in the UK/GB Time Zone in their app, so I'm not quite sure what is going on here.

Let me know what you will need and how you would like me to proceed with them and troubleshooting this issue.

@ZeliardM
Copy link
Contributor Author

I have the user pulling a debug from the CLI of the discover output to see if that gives us anymore information.

@ZeliardM
Copy link
Contributor Author

Found this from the discover on the users machine:
'system': {'get_sysinfo': {'active_mode': 'none',
'alias': '#MASKED_NAME#',
'dev_name': 'Smart Wi-Fi Plug',
'deviceId': 'REDACTED_B32208C374929422AA683821D7543B6',
'err_code': 0,
'feature': 'TIM',
'hwId': 'REDACTED_3FF92118AF9C35ACA47F3A2',
'hw_ver': '1.0',
'icon_hash': '',
'latitude_i': 0,
'led_off': 0,
'longitude_i': 0,
'mac': '60:32:B1:00:00:00',
'mic_type': 'IOT.SMARTPLUGSWITCH',
'model': 'KP105(UK)',
'next_action': {'type': -1},
'ntc_state': 0,
'obd_src': 'tplink',
'oemId': 'REDACTED_1E2049D9A84CFE1754CADEE',
'on_time': 0,
'relay_state': 0,
'rssi': -79,
'status': 'configured',
'sw_ver': '1.0.7 Build 210506 Rel.153510',
'updating': 0}},
'time': {'get_time': {'err_code': 0,
'hour': 16,
'mday': 20,
'min': 31,
'month': 2,
'sec': 12,
'year': 2025},
'get_timezone': {'err_code': 0, 'index': 39}}}
Raised error: 'No time zone found with key GB'
Traceback (most recent call last):
File "/usr/lib/python3.12/zoneinfo/_common.py", line 12, in load_tzdata
return resources.files(package_name).joinpath(resource_name).open("rb")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/resources/_common.py", line 46, in wrapper
return func(anchor)
^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/resources/_common.py", line 56, in files
return from_package(resolve(anchor))
^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/functools.py", line 909, in wrapper
return dispatch(args[0].class)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/resources/_common.py", line 82, in _
return importlib.import_module(cand)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/init.py", line 90, 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'

@ZeliardM
Copy link
Contributor Author

Not sure why it was missing, I've never seen it missing before. they installed tzdata manually and it worked, just not sure why it was missing in the first place.

@sdb9696
Copy link
Collaborator

sdb9696 commented Feb 21, 2025

It is usually installed by default except on Windows machines where pip should install it. What is their PC setup?

@ZeliardM
Copy link
Contributor Author

I'll find out and let you know.

@ZeliardM
Copy link
Contributor Author

The underlying OS is Unraid, and Homebridge is installed via Docker from the repo homebridge/homebridge:ubuntu

Environment:

Plugin Version: v2.7.2-beta.0
Homebridge Version: v1.9.0
Node.js Version: v22.14.0
NPM Version: 10.9.2
Operating System: Docker
Python Version: Python 3.12.3

@ZeliardM
Copy link
Contributor Author

ZeliardM commented Mar 4, 2025

I've got another user in US Central that had to install tzdata to get it working as well. I'm trying to get more information about their setup now.

@ZeliardM
Copy link
Contributor Author

@sdb9696 @rytilahti I've added the tzdata as a requirement in my plug-in for Homebridge and this has resolved the issue until it's decided what y'all want to do on your end.

@XtraordinairDEV
Copy link

Originally I bandaided the offending line setting the tz = None, and that fixed the current release for me, but I didn't realize tzdata wasn't installed on my device. I installed it and I'll see if it stays fixed in the next release.

@ZeliardM
Copy link
Contributor Author

ZeliardM commented May 1, 2025

@XtraordinairDEV Normally it is installed already, but sometimes it isn't. Depending on the installation of python-kasa you have a couple of options. If you just use pip to install python-kasa, you just need to pip install tzdata. If you use pipx to install python-kasa, you need to pipx inject python-kasa tzdata. This will install tzdata to the same venv that pipx creates when it installs python-kasa. These are just ways to mitigate the issue until the devs decide how they want to handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants