1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-01 09:32:21 +01:00

Bump tzlocal from 3.0 to 4.0.1 (#2553)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
dependabot[bot]
2021-10-21 22:46:05 +02:00
committed by GitHub
parent b141aea4c0
commit 1468acfced
2 changed files with 3 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
import logging
from importlib import resources
from typing import Optional
from datetime import timezone
import tzlocal
@@ -66,14 +65,11 @@ def _extract_tz_string(tzfile: bytes) -> str:
def detect_tz() -> str:
localzone = tzlocal.get_localzone()
if localzone is timezone.utc:
return "UTC0"
if not hasattr(localzone, "key"):
iana_key = tzlocal.get_localzone_name()
if iana_key is None:
raise cv.Invalid(
"Could not automatically determine timezone, please set timezone manually."
)
iana_key = localzone.key
_LOGGER.info("Detected timezone '%s'", iana_key)
tzfile = _load_tzdata(iana_key)
if tzfile is None: