From 9e1ba10f0b2e3e691df711382810a7dc7e268275 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Sun, 12 Apr 2026 08:54:41 +0000 Subject: [PATCH] refactor(options_flow): optimize loading of override translations based on active overrides --- .../tibber_prices/config_flow_handlers/options_flow.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/custom_components/tibber_prices/config_flow_handlers/options_flow.py b/custom_components/tibber_prices/config_flow_handlers/options_flow.py index fb53fba..fe224a6 100644 --- a/custom_components/tibber_prices/config_flow_handlers/options_flow.py +++ b/custom_components/tibber_prices/config_flow_handlers/options_flow.py @@ -378,7 +378,6 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): # Load template and connector from common section template = await async_get_translation(self.hass, ["common", "override_warning_template"], language) - _LOGGER.debug("Loaded template: %s", template) if template: translations["override_warning_template"] = template @@ -645,8 +644,8 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): placeholders = self._get_entity_warning_placeholders("best_price") placeholders.update(self._get_override_warning_placeholder("best_price", overrides)) - # Load translations for override warnings - override_translations = await self._get_override_translations() + # Load translations for override warnings only when overrides are active + override_translations = await self._get_override_translations() if overrides else {} return self.async_show_form( step_id="best_price", @@ -717,8 +716,8 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): placeholders = self._get_entity_warning_placeholders("peak_price") placeholders.update(self._get_override_warning_placeholder("peak_price", overrides)) - # Load translations for override warnings - override_translations = await self._get_override_translations() + # Load translations for override warnings only when overrides are active + override_translations = await self._get_override_translations() if overrides else {} return self.async_show_form( step_id="peak_price",