Skip to content
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

[climate] Bugfix honeywell misleading error message #25048

merged 12 commits into from Jul 10, 2019

refactor convert code

  • Loading branch information...
zxdavb committed Jul 9, 2019
commit b678c87004a427f804b593079746c4c100e25110
@@ -48,8 +48,12 @@

def _local_dt_to_utc(dt_naive: datetime) -> datetime:
dt_aware = as_utc(dt_naive.replace(microsecond=0, tzinfo=tzlocal()))
return dt_aware.replace(tzinfo=None)
dt_aware = as_utc(dt_naive.replace(tzinfo=tzlocal()))
return dt_aware.replace(microsecond=0, tzinfo=None)

def _utc_to_local_dt(dt_naive: datetime) -> datetime:
dt_aware = as_utc(dt_naive).astimezone(tzlocal())
return dt_aware.replace(microsecond=0, tzinfo=None)

def _handle_exception(err):
@@ -193,13 +197,12 @@ def init_client(self) -> bool:
access_token = app_storage.get(CONF_ACCESS_TOKEN)
at_expires_str = app_storage.get(CONF_ACCESS_TOKEN_EXPIRES)
if at_expires_str:
at_expires_dt = as_utc(parse_datetime(at_expires_str))
at_expires_dt = at_expires_dt.astimezone(tzlocal())
at_expires_dt = at_expires_dt.replace(tzinfo=None)
at_expires_local_dt = _utc_to_local_dt(
at_expires_dt = None
at_expires_local_dt = None

return (refresh_token, access_token, at_expires_dt)
return (refresh_token, access_token, at_expires_local_dt)

return (None, None, None) # account switched: so tokens wont be valid

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.