From c98b2d1509462253443bb704db1d6f0ebcd32f34 Mon Sep 17 00:00:00 2001 From: Sander Bakkum <150665177+SanderBakkumCuriousInc@users.noreply.github.com> Date: Fri, 14 Aug 2026 13:17:58 +0200 Subject: [PATCH] Avoid naive datetime.now() in sensoterra (#179117) --- homeassistant/components/sensoterra/config_flow.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensoterra/config_flow.py b/homeassistant/components/sensoterra/config_flow.py index 5e600ca89c25..5d0ae61ecb1e 100644 --- a/homeassistant/components/sensoterra/config_flow.py +++ b/homeassistant/components/sensoterra/config_flow.py @@ -1,6 +1,6 @@ """Config flow for Sensoterra integration.""" -from datetime import datetime, timedelta +from datetime import timedelta from typing import Any, override from jwt import DecodeError, decode @@ -18,6 +18,7 @@ from homeassistant.helpers.selector import ( TextSelectorConfig, TextSelectorType, ) +from homeassistant.util import dt as dt_util from .const import DOMAIN, LOGGER, TOKEN_EXPIRATION_DAYS @@ -47,7 +48,7 @@ class SensoterraConfigFlow(ConfigFlow, domain=DOMAIN): api = CustomerApi(user_input[CONF_EMAIL], user_input[CONF_PASSWORD]) # We need a unique tag per HA instance uuid = self.hass.data["core.uuid"] - expiration = datetime.now() + timedelta(TOKEN_EXPIRATION_DAYS) # pylint: disable=home-assistant-enforce-naive-now + expiration = dt_util.utcnow() + timedelta(TOKEN_EXPIRATION_DAYS) try: token: str = await api.get_token(