diff --git a/bridge/aira_bridge.py b/bridge/aira_bridge.py index 48dd741..c6e0411 100644 --- a/bridge/aira_bridge.py +++ b/bridge/aira_bridge.py @@ -698,7 +698,11 @@ def boost_restanti(st: dict) -> int: # sottrazione con "adesso" (che il fuso ce l'ha) solleva TypeError e # /summary risponde 502 -- l'app resta senza dati ("Nessun dato"). if quando.tzinfo is None: - quando = quando.replace(tzinfo=PLANT_TZ) + # "Senza fuso" NON vuol dire ora locale: pyairahome converte i Timestamp + # con ts.ToDatetime() (utils/utils.py) che, senza argomenti, restituisce + # un datetime *naive ma in UTC*. Leggerlo come ora dell'impianto + # sbaglierebbe il conto di una o due ore. + quando = quando.replace(tzinfo=timezone.utc) return max(0, int((quando - datetime.now(timezone.utc)).total_seconds())) diff --git a/bridge/test_bridge_commands.py b/bridge/test_bridge_commands.py index d9bd460..7d0130a 100644 --- a/bridge/test_bridge_commands.py +++ b/bridge/test_bridge_commands.py @@ -236,8 +236,8 @@ check("boost mai avviato: zero secondi", b.boost_restanti({}) == 0) # che ha fatto rispondere 502 a /summary: la sottrazione con "adesso" (che il # fuso ce l'ha) solleva TypeError, e l'app resta senza dati ("Nessun dato"). # Il conto alla rovescia deve reggere entrambe le forme. -_fine_naive = (datetime.now(b.PLANT_TZ) + timedelta(seconds=1200)).strftime("%Y-%m-%dT%H:%M:%S") -check("boost con fine senza fuso (ora dell'impianto)", +_fine_naive = (datetime.now(timezone.utc) + timedelta(seconds=1200)).replace(tzinfo=None).isoformat() +check("boost con fine senza fuso (forma dell'impianto: naive UTC)", abs(b.boost_restanti({"hot_water_boost": {"end_time": _fine_naive}}) - 1200) <= 3) check("riassunto con fine senza fuso (la forma che dava 502)", (b.summarize({"hot_water_boost": {"end_time": _fine_naive}}) or {}).get("boost_active") is True) diff --git a/translations/harbour-aira-it.ts b/translations/harbour-aira-it.ts index b888b8b..0a27ec9 100644 --- a/translations/harbour-aira-it.ts +++ b/translations/harbour-aira-it.ts @@ -578,32 +578,32 @@ Azioni rapide - + Boost Boost - + Home Torna - + Away Assenza - + Away mode off Assenza disattivata - + More Altro - + Outside %1 °C · Thermostat %2 °C · Zones %3 Esterno %1 °C · Termostato %2 °C · Zone %3 @@ -618,7 +618,7 @@ Bridge non configurato. Apri le impostazioni e inserisci l'indirizzo del server e il token. - + Starting DHW boost Avvio del boost ACS diff --git a/translations/harbour-aira.ts b/translations/harbour-aira.ts index 9ec3335..8899089 100644 --- a/translations/harbour-aira.ts +++ b/translations/harbour-aira.ts @@ -593,37 +593,37 @@ - + Boost - + Starting DHW boost - + Home - + Away - + More - + Away mode off - + Outside %1 °C · Thermostat %2 °C · Zones %3