diff --git a/custom_components/tibber_prices/config_flow_handlers/entity_check.py b/custom_components/tibber_prices/config_flow_handlers/entity_check.py new file mode 100644 index 0000000..4597bfd --- /dev/null +++ b/custom_components/tibber_prices/config_flow_handlers/entity_check.py @@ -0,0 +1,243 @@ +""" +Entity check utilities for options flow. + +This module provides functions to check if relevant entities are enabled +for specific options flow steps. If no relevant entities are enabled, +a warning can be displayed to users. +""" + +from __future__ import annotations + +import logging +from typing import TYPE_CHECKING + +from custom_components.tibber_prices.const import DOMAIN +from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry + +if TYPE_CHECKING: + from homeassistant.config_entries import ConfigEntry + from homeassistant.core import HomeAssistant + +_LOGGER = logging.getLogger(__name__) + +# Maximum number of example sensors to show in warning message +MAX_EXAMPLE_SENSORS = 3 +# Threshold for using "and" vs "," in formatted names +NAMES_SIMPLE_JOIN_THRESHOLD = 2 + +# Mapping of options flow steps to affected sensor keys +# These are the entity keys (from sensor/definitions.py and binary_sensor/definitions.py) +# that are affected by each settings page +STEP_TO_SENSOR_KEYS: dict[str, list[str]] = { + # Price Rating settings affect all rating sensors + "current_interval_price_rating": [ + # Interval rating sensors + "current_interval_price_rating", + "next_interval_price_rating", + "previous_interval_price_rating", + # Rolling hour rating sensors + "current_hour_price_rating", + "next_hour_price_rating", + # Daily rating sensors + "yesterday_price_rating", + "today_price_rating", + "tomorrow_price_rating", + ], + # Price Level settings affect level sensors and period binary sensors + "price_level": [ + # Interval level sensors + "current_interval_price_level", + "next_interval_price_level", + "previous_interval_price_level", + # Rolling hour level sensors + "current_hour_price_level", + "next_hour_price_level", + # Daily level sensors + "yesterday_price_level", + "today_price_level", + "tomorrow_price_level", + # Binary sensors that use level filtering + "best_price_period", + "peak_price_period", + ], + # Volatility settings affect volatility sensors + "volatility": [ + "today_volatility", + "tomorrow_volatility", + "next_24h_volatility", + "today_tomorrow_volatility", + # Also affects trend sensors (adaptive thresholds) + "current_price_trend", + "next_price_trend_change", + "price_trend_1h", + "price_trend_2h", + "price_trend_3h", + "price_trend_4h", + "price_trend_5h", + "price_trend_6h", + "price_trend_8h", + "price_trend_12h", + ], + # Best Price settings affect best price binary sensor and timing sensors + "best_price": [ + # Binary sensor + "best_price_period", + # Timing sensors + "best_price_end_time", + "best_price_period_duration", + "best_price_remaining_minutes", + "best_price_progress", + "best_price_next_start_time", + "best_price_next_in_minutes", + ], + # Peak Price settings affect peak price binary sensor and timing sensors + "peak_price": [ + # Binary sensor + "peak_price_period", + # Timing sensors + "peak_price_end_time", + "peak_price_period_duration", + "peak_price_remaining_minutes", + "peak_price_progress", + "peak_price_next_start_time", + "peak_price_next_in_minutes", + ], + # Price Trend settings affect trend sensors + "price_trend": [ + "current_price_trend", + "next_price_trend_change", + "price_trend_1h", + "price_trend_2h", + "price_trend_3h", + "price_trend_4h", + "price_trend_5h", + "price_trend_6h", + "price_trend_8h", + "price_trend_12h", + ], +} + + +def check_relevant_entities_enabled( + hass: HomeAssistant, + config_entry: ConfigEntry, + step_id: str, +) -> tuple[bool, list[str]]: + """ + Check if any relevant entities for a settings step are enabled. + + Args: + hass: Home Assistant instance + config_entry: Current config entry + step_id: The options flow step ID + + Returns: + Tuple of (has_enabled_entities, list_of_example_sensor_names) + - has_enabled_entities: True if at least one relevant entity is enabled + - list_of_example_sensor_names: List of example sensor keys for the warning message + + """ + sensor_keys = STEP_TO_SENSOR_KEYS.get(step_id) + if not sensor_keys: + # No mapping for this step - no check needed + return True, [] + + entity_registry = async_get_entity_registry(hass) + entry_id = config_entry.entry_id + + enabled_count = 0 + example_sensors: list[str] = [] + + for entity in entity_registry.entities.values(): + # Check if entity belongs to our integration and config entry + if entity.config_entry_id != entry_id: + continue + if entity.platform != DOMAIN: + continue + + # Extract the sensor key from unique_id + # unique_id format: "{home_id}_{sensor_key}" or "{entry_id}_{sensor_key}" + unique_id = entity.unique_id or "" + # The sensor key is after the last underscore that separates the ID prefix + # We check if any of our target keys is contained in the unique_id + for sensor_key in sensor_keys: + if unique_id.endswith(f"_{sensor_key}") or unique_id == sensor_key: + # Found a matching entity + if entity.disabled_by is None: + # Entity is enabled + enabled_count += 1 + break + # Entity is disabled - add to examples (max MAX_EXAMPLE_SENSORS) + if len(example_sensors) < MAX_EXAMPLE_SENSORS and sensor_key not in example_sensors: + example_sensors.append(sensor_key) + break + + # If we found enabled entities, return success + if enabled_count > 0: + return True, [] + + # No enabled entities - return the example sensors for the warning + # If we haven't collected any examples yet, use the first from the mapping + if not example_sensors: + example_sensors = sensor_keys[:MAX_EXAMPLE_SENSORS] + + return False, example_sensors + + +def format_sensor_names_for_warning(sensor_keys: list[str]) -> str: + """ + Format sensor keys into human-readable names for warning message. + + Args: + sensor_keys: List of sensor keys + + Returns: + Formatted string like "Best Price Period, Best Price End Time, ..." + + """ + # Convert snake_case keys to Title Case names + names = [] + for key in sensor_keys: + # Replace underscores with spaces and title case + name = key.replace("_", " ").title() + names.append(name) + + if len(names) <= NAMES_SIMPLE_JOIN_THRESHOLD: + return " and ".join(names) + + return ", ".join(names[:-1]) + ", and " + names[-1] + + +def check_chart_data_export_enabled( + hass: HomeAssistant, + config_entry: ConfigEntry, +) -> bool: + """ + Check if the Chart Data Export sensor is enabled. + + Args: + hass: Home Assistant instance + config_entry: Current config entry + + Returns: + True if the Chart Data Export sensor is enabled, False otherwise + + """ + entity_registry = async_get_entity_registry(hass) + entry_id = config_entry.entry_id + + for entity in entity_registry.entities.values(): + # Check if entity belongs to our integration and config entry + if entity.config_entry_id != entry_id: + continue + if entity.platform != DOMAIN: + continue + + # Check for chart_data_export sensor + unique_id = entity.unique_id or "" + if unique_id.endswith("_chart_data_export") or unique_id == "chart_data_export": + # Found the entity - check if enabled + return entity.disabled_by is None + + # Entity not found (shouldn't happen, but treat as disabled) + return False 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 f1981fd..74db36e 100644 --- a/custom_components/tibber_prices/config_flow_handlers/options_flow.py +++ b/custom_components/tibber_prices/config_flow_handlers/options_flow.py @@ -9,6 +9,11 @@ from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from collections.abc import Mapping +from custom_components.tibber_prices.config_flow_handlers.entity_check import ( + check_chart_data_export_enabled, + check_relevant_entities_enabled, + format_sensor_names_for_warning, +) from custom_components.tibber_prices.config_flow_handlers.schemas import ( get_best_price_schema, get_chart_data_export_schema, @@ -183,6 +188,34 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): return True return False + def _get_entity_warning_placeholders(self, step_id: str) -> dict[str, str]: + """ + Get description placeholders for entity availability warning. + + Checks if any relevant entities for the step are enabled. + If not, adds a warning placeholder to display in the form description. + + Args: + step_id: The options flow step ID + + Returns: + Dictionary with placeholder keys for the form description + + """ + has_enabled, example_sensors = check_relevant_entities_enabled(self.hass, self.config_entry, step_id) + + if has_enabled: + # No warning needed - return empty placeholder + return {"entity_warning": ""} + + # Build warning message with example sensor names + sensor_names = format_sensor_names_for_warning(example_sensors) + return { + "entity_warning": f"\n\n⚠️ **Note:** No sensors affected by these settings are currently enabled. " + f"To use these settings, first enable relevant sensors like *{sensor_names}* " + f"in **Settings → Devices & Services → Tibber Prices → Entities**." + } + async def async_step_init(self, _user_input: dict[str, Any] | None = None) -> ConfigFlowResult: """Manage the options - show menu.""" # Always reload options from config_entry to get latest saved state @@ -333,6 +366,7 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): step_id="current_interval_price_rating", data_schema=get_price_rating_schema(self.config_entry.options), errors=errors, + description_placeholders=self._get_entity_warning_placeholders("current_interval_price_rating"), ) async def async_step_price_level(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: @@ -352,6 +386,7 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): step_id="price_level", data_schema=get_price_level_schema(self.config_entry.options), errors=errors, + description_placeholders=self._get_entity_warning_placeholders("price_level"), ) async def async_step_best_price(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: @@ -415,6 +450,7 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): step_id="best_price", data_schema=get_best_price_schema(self.config_entry.options), errors=errors, + description_placeholders=self._get_entity_warning_placeholders("best_price"), ) async def async_step_peak_price(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: @@ -475,6 +511,7 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): step_id="peak_price", data_schema=get_peak_price_schema(self.config_entry.options), errors=errors, + description_placeholders=self._get_entity_warning_placeholders("peak_price"), ) async def async_step_price_trend(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: @@ -537,6 +574,7 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): step_id="price_trend", data_schema=get_price_trend_schema(self.config_entry.options), errors=errors, + description_placeholders=self._get_entity_warning_placeholders("price_trend"), ) async def async_step_chart_data_export(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: @@ -545,10 +583,44 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): # No changes to save - just return to menu return await self.async_step_init() - # Show info-only form (no input fields) + # Check if the chart data export sensor is enabled + is_enabled = check_chart_data_export_enabled(self.hass, self.config_entry) + + # Show info-only form with status-dependent description return self.async_show_form( step_id="chart_data_export", data_schema=get_chart_data_export_schema(self.config_entry.options), + description_placeholders={ + "sensor_status_info": self._get_chart_export_status_info(is_enabled=is_enabled), + }, + ) + + def _get_chart_export_status_info(self, *, is_enabled: bool) -> str: + """Get the status info block for chart data export sensor.""" + if is_enabled: + return ( + "✅ **Status: Sensor is enabled**\n\n" + "The Chart Data Export sensor is currently active and providing data as attributes.\n\n" + "**Configuration (optional):**\n\n" + "Default settings work out-of-the-box (today+tomorrow, 15-minute intervals, prices only).\n\n" + "For customization, add to **`configuration.yaml`**:\n\n" + "```yaml\n" + "tibber_prices:\n" + " chart_export:\n" + " day:\n" + " - today\n" + " - tomorrow\n" + " include_level: true\n" + " include_rating_level: true\n" + "```\n\n" + "**All parameters:** See `tibber_prices.get_chartdata` service documentation" + ) + return ( + "❌ **Status: Sensor is disabled**\n\n" + "**Enable the sensor:**\n\n" + "1. Open **Settings → Devices & Services → Tibber Prices**\n" + "2. Select your home → Find **'Chart Data Export'** (Diagnostic section)\n" + "3. **Enable the sensor** (disabled by default)" ) async def async_step_volatility(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: @@ -607,4 +679,5 @@ class TibberPricesOptionsFlowHandler(OptionsFlow): step_id="volatility", data_schema=get_volatility_schema(self.config_entry.options), errors=errors, + description_placeholders=self._get_entity_warning_placeholders("volatility"), ) diff --git a/custom_components/tibber_prices/translations/de.json b/custom_components/tibber_prices/translations/de.json index 7e56e3c..c7b0d3a 100644 --- a/custom_components/tibber_prices/translations/de.json +++ b/custom_components/tibber_prices/translations/de.json @@ -172,7 +172,7 @@ }, "current_interval_price_rating": { "title": "📊 Preisbewertungs-Einstellungen", - "description": "**Konfiguriere Schwellenwerte und Stabilisierung für Preisbewertungsstufen (niedrig/normal/hoch) basierend auf dem Vergleich mit dem nachlaufenden 24-Stunden-Durchschnitt.**", + "description": "**Konfiguriere Schwellenwerte und Stabilisierung für Preisbewertungsstufen (niedrig/normal/hoch) basierend auf dem Vergleich mit dem nachlaufenden 24-Stunden-Durchschnitt.**{entity_warning}", "data": { "price_rating_threshold_low": "Niedrig-Schwelle", "price_rating_threshold_high": "Hoch-Schwelle", @@ -189,7 +189,7 @@ }, "best_price": { "title": "💚 Bestpreis-Zeitraum Einstellungen", - "description": "**Konfiguration für den Bestpreis-Zeitraum mit den niedrigsten Strompreisen.**\n\n---", + "description": "**Konfiguration für den Bestpreis-Zeitraum mit den niedrigsten Strompreisen.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Zeitraumdauer & Preisniveaus", @@ -236,7 +236,7 @@ }, "peak_price": { "title": "🔴 Spitzenpreis-Zeitraum Einstellungen", - "description": "**Konfiguration für den Spitzenpreis-Zeitraum mit den höchsten Strompreisen.**\n\n---", + "description": "**Konfiguration für den Spitzenpreis-Zeitraum mit den höchsten Strompreisen.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Zeitraum-Einstellungen", @@ -283,7 +283,7 @@ }, "price_trend": { "title": "📈 Preistrend-Schwellenwerte", - "description": "**Konfiguriere Schwellenwerte für Preistrend-Sensoren.** Diese Sensoren vergleichen den aktuellen Preis mit dem Durchschnitt der nächsten N Stunden, um festzustellen, ob die Preise steigen, fallen oder stabil sind.\n\n**5-Stufen-Skala:** Nutzt stark_fallend (-2), fallend (-1), stabil (0), steigend (+1), stark_steigend (+2) für Automations-Vergleiche über das trend_value Attribut.", + "description": "**Konfiguriere Schwellenwerte für Preistrend-Sensoren.** Diese Sensoren vergleichen den aktuellen Preis mit dem Durchschnitt der nächsten N Stunden, um festzustellen, ob die Preise steigen, fallen oder stabil sind.\n\n**5-Stufen-Skala:** Nutzt stark_fallend (-2), fallend (-1), stabil (0), steigend (+1), stark_steigend (+2) für Automations-Vergleiche über das trend_value Attribut.{entity_warning}", "data": { "price_trend_threshold_rising": "Steigend-Schwelle", "price_trend_threshold_strongly_rising": "Stark steigend-Schwelle", @@ -300,7 +300,7 @@ }, "volatility": { "title": "💨 Volatilität Schwellenwerte", - "description": "**Konfiguriere Schwellenwerte für die Volatilitätsklassifizierung.** Volatilität misst relative Preisschwankungen anhand des Variationskoeffizienten (VK = Standardabweichung / Durchschnitt × 100%). Diese Schwellenwerte sind Prozentwerte, die für alle Preisniveaus funktionieren.\n\nVerwendet von:\n• Volatilitätssensoren (Klassifizierung)\n• Trend-Sensoren (adaptive Schwellenanpassung: <moderat = empfindlicher, ≥hoch = weniger empfindlich)", + "description": "**Konfiguriere Schwellenwerte für die Volatilitätsklassifizierung.** Volatilität misst relative Preisschwankungen anhand des Variationskoeffizienten (VK = Standardabweichung / Durchschnitt × 100%). Diese Schwellenwerte sind Prozentwerte, die für alle Preisniveaus funktionieren.\n\nVerwendet von:\n• Volatilitätssensoren (Klassifizierung)\n• Trend-Sensoren (adaptive Schwellenanpassung: <moderat = empfindlicher, ≥hoch = weniger empfindlich){entity_warning}", "data": { "volatility_threshold_moderate": "Moderat-Schwelle", "volatility_threshold_high": "Hoch-Schwelle", @@ -315,7 +315,7 @@ }, "chart_data_export": { "title": "📊 Chart Data Export Sensor", - "description": "Der Chart Data Export Sensor stellt Preisdaten als Sensor-Attribute zur Verfügung.\n\n⚠️ **Hinweis:** Dieser Sensor ist ein Legacy-Feature für Kompatibilität mit älteren Tools.\n\n**Für neue Setups empfohlen:** Nutze den `tibber_prices.get_chartdata` **Service direkt** - er ist flexibler, effizienter und der moderne Home Assistant-Ansatz.\n\n**Wann dieser Sensor sinnvoll ist:**\n\n✅ Dein Dashboard-Tool kann **nur** Attribute lesen (keine Service-Aufrufe)\n✅ Du brauchst statische Daten, die automatisch aktualisiert werden\n❌ **Nicht für Automationen:** Nutze dort direkt `tibber_prices.get_chartdata` - flexibler und effizienter!\n\n---\n\n**Sensor aktivieren:**\n\n1. Öffne **Einstellungen → Geräte & Dienste → Tibber Prices**\n2. Wähle dein Home → Finde **'Chart Data Export'** (Diagnose-Bereich)\n3. **Aktiviere den Sensor** (standardmäßig deaktiviert)\n\n**Konfiguration (optional):**\n\nStandardeinstellung funktioniert sofort (heute+morgen, 15-Minuten-Intervalle, reine Preise).\n\nFür Anpassungen füge in **`configuration.yaml`** ein:\n\n```yaml\ntibber_prices:\n chart_export:\n day:\n - today\n - tomorrow\n include_level: true\n include_rating_level: true\n```\n\n**Alle Parameter:** Siehe `tibber_prices.get_chartdata` Service-Dokumentation", + "description": "Der Chart Data Export Sensor stellt Preisdaten als Sensor-Attribute zur Verfügung.\n\n⚠️ **Hinweis:** Dieser Sensor ist ein Legacy-Feature für Kompatibilität mit älteren Tools.\n\n**Für neue Setups empfohlen:** Nutze den `tibber_prices.get_chartdata` **Service direkt** - er ist flexibler, effizienter und der moderne Home Assistant-Ansatz.\n\n**Wann dieser Sensor sinnvoll ist:**\n\n✅ Dein Dashboard-Tool kann **nur** Attribute lesen (keine Service-Aufrufe)\n✅ Du brauchst statische Daten, die automatisch aktualisiert werden\n❌ **Nicht für Automationen:** Nutze dort direkt `tibber_prices.get_chartdata` - flexibler und effizienter!\n\n---\n\n{sensor_status_info}", "submit": "↩ Ok & Zurück" }, "reset_to_defaults": { @@ -328,7 +328,7 @@ }, "price_level": { "title": "🏷️ Preisniveau-Einstellungen (von Tibber API)", - "description": "**Konfiguriere die Stabilisierung für Tibbers Preisniveau-Klassifizierung (sehr günstig/günstig/normal/teuer/sehr teuer).**\n\nTibbers API liefert ein Preisniveau-Feld für jedes Intervall. Diese Einstellung glättet kurze Schwankungen, um Instabilität in Automatisierungen zu verhindern.", + "description": "**Konfiguriere die Stabilisierung für Tibbers Preisniveau-Klassifizierung (sehr günstig/günstig/normal/teuer/sehr teuer).**\n\nTibbers API liefert ein Preisniveau-Feld für jedes Intervall. Diese Einstellung glättet kurze Schwankungen, um Instabilität in Automatisierungen zu verhindern.{entity_warning}", "data": { "price_level_gap_tolerance": "Gap-Toleranz" }, diff --git a/custom_components/tibber_prices/translations/en.json b/custom_components/tibber_prices/translations/en.json index 0375f38..2c5a5d6 100644 --- a/custom_components/tibber_prices/translations/en.json +++ b/custom_components/tibber_prices/translations/en.json @@ -172,7 +172,7 @@ }, "current_interval_price_rating": { "title": "📊 Price Rating Settings", - "description": "**Configure thresholds and stabilization for price rating levels (low/normal/high) based on comparison with trailing 24-hour average.**", + "description": "**Configure thresholds and stabilization for price rating levels (low/normal/high) based on comparison with trailing 24-hour average.**{entity_warning}", "data": { "price_rating_threshold_low": "Low Threshold", "price_rating_threshold_high": "High Threshold", @@ -189,7 +189,7 @@ }, "price_level": { "title": "🏷️ Price Level Settings", - "description": "**Configure stabilization for Tibber's price level classification (very cheap/cheap/normal/expensive/very expensive).**\n\nTibber's API provides a price level field for each interval. This setting smooths out brief fluctuations to prevent automation instability.", + "description": "**Configure stabilization for Tibber's price level classification (very cheap/cheap/normal/expensive/very expensive).**\n\nTibber's API provides a price level field for each interval. This setting smooths out brief fluctuations to prevent automation instability.{entity_warning}", "data": { "price_level_gap_tolerance": "Gap Tolerance" }, @@ -200,7 +200,7 @@ }, "best_price": { "title": "💚 Best Price Period Settings", - "description": "**Configure settings for the Best Price Period binary sensor. This sensor is active during periods with the lowest electricity prices.**\n\n---", + "description": "**Configure settings for the Best Price Period binary sensor. This sensor is active during periods with the lowest electricity prices.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Period Duration & Levels", @@ -247,7 +247,7 @@ }, "peak_price": { "title": "🔴 Peak Price Period Settings", - "description": "**Configure settings for the Peak Price Period binary sensor. This sensor is active during periods with the highest electricity prices.**\n\n---", + "description": "**Configure settings for the Peak Price Period binary sensor. This sensor is active during periods with the highest electricity prices.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Period Settings", @@ -294,7 +294,7 @@ }, "price_trend": { "title": "📈 Price Trend Thresholds", - "description": "**Configure thresholds for price trend sensors.** These sensors compare current price with the average of the next N hours to determine if prices are rising, falling, or stable.\n\n**5-Level Scale:** Uses strongly_falling (-2), falling (-1), stable (0), rising (+1), strongly_rising (+2) for automation comparisons via trend_value attribute.", + "description": "**Configure thresholds for price trend sensors.** These sensors compare current price with the average of the next N hours to determine if prices are rising, falling, or stable.\n\n**5-Level Scale:** Uses strongly_falling (-2), falling (-1), stable (0), rising (+1), strongly_rising (+2) for automation comparisons via trend_value attribute.{entity_warning}", "data": { "price_trend_threshold_rising": "Rising Threshold", "price_trend_threshold_strongly_rising": "Strongly Rising Threshold", @@ -311,7 +311,7 @@ }, "volatility": { "title": "💨 Price Volatility Thresholds", - "description": "**Configure thresholds for volatility classification.** Volatility measures relative price variation using the coefficient of variation (CV = standard deviation / mean × 100%). These thresholds are percentage values that work across all price levels.\n\nUsed by:\n• Volatility sensors (classification)\n• Trend sensors (adaptive threshold adjustment: <moderate = more sensitive, ≥high = less sensitive)", + "description": "**Configure thresholds for volatility classification.** Volatility measures relative price variation using the coefficient of variation (CV = standard deviation / mean × 100%). These thresholds are percentage values that work across all price levels.\n\nUsed by:\n• Volatility sensors (classification)\n• Trend sensors (adaptive threshold adjustment: <moderate = more sensitive, ≥high = less sensitive){entity_warning}", "data": { "volatility_threshold_moderate": "Moderate Threshold", "volatility_threshold_high": "High Threshold", @@ -326,7 +326,7 @@ }, "chart_data_export": { "title": "📊 Chart Data Export Sensor", - "description": "The Chart Data Export Sensor provides price data as sensor attributes.\n\n⚠️ **Note:** This sensor is a legacy feature for compatibility with older tools.\n\n**Recommended for new setups:** Use the `tibber_prices.get_chartdata` **service directly** - it's more flexible, efficient, and the modern Home Assistant approach.\n\n**When this sensor makes sense:**\n\n✅ Your dashboard tool can **only** read attributes (no service calls)\n✅ You need static data that updates automatically\n❌ **Not for automations:** Use `tibber_prices.get_chartdata` directly there - more flexible and efficient!\n\n---\n\n**Enable the sensor:**\n\n1. Open **Settings → Devices & Services → Tibber Prices**\n2. Select your home → Find **'Chart Data Export'** (Diagnostic section)\n3. **Enable the sensor** (disabled by default)\n\n**Configuration (optional):**\n\nDefault settings work out-of-the-box (today+tomorrow, 15-minute intervals, prices only).\n\nFor customization, add to **`configuration.yaml`**:\n\n```yaml\ntibber_prices:\n chart_export:\n day:\n - today\n - tomorrow\n include_level: true\n include_rating_level: true\n```\n\n**All parameters:** See `tibber_prices.get_chartdata` service documentation", + "description": "The Chart Data Export Sensor provides price data as sensor attributes.\n\n⚠️ **Note:** This sensor is a legacy feature for compatibility with older tools.\n\n**Recommended for new setups:** Use the `tibber_prices.get_chartdata` **service directly** - it's more flexible, efficient, and the modern Home Assistant approach.\n\n**When this sensor makes sense:**\n\n✅ Your dashboard tool can **only** read attributes (no service calls)\n✅ You need static data that updates automatically\n❌ **Not for automations:** Use `tibber_prices.get_chartdata` directly there - more flexible and efficient!\n\n---\n\n{sensor_status_info}", "submit": "↩ Ok & Back" }, "reset_to_defaults": { diff --git a/custom_components/tibber_prices/translations/nb.json b/custom_components/tibber_prices/translations/nb.json index be73459..6f332c2 100644 --- a/custom_components/tibber_prices/translations/nb.json +++ b/custom_components/tibber_prices/translations/nb.json @@ -172,7 +172,7 @@ }, "current_interval_price_rating": { "title": "📊 Prisvurderingsinnstillinger", - "description": "**Konfigurer terskler og stabilisering for prisvurderingsnivåer (lav/normal/høy) basert på sammenligning med etterfølgende 24-timers gjennomsnitt.**", + "description": "**Konfigurer terskler og stabilisering for prisvurderingsnivåer (lav/normal/høy) basert på sammenligning med etterfølgende 24-timers gjennomsnitt.**{entity_warning}", "data": { "price_rating_threshold_low": "Lav-terskel", "price_rating_threshold_high": "Høy-terskel", @@ -189,7 +189,7 @@ }, "best_price": { "title": "💚 Beste Prisperiode Innstillinger", - "description": "**Konfigurer innstillinger for Beste Prisperiode binærsensor. Denne sensoren er aktiv i perioder med de laveste strømprisene.**\n\n---", + "description": "**Konfigurer innstillinger for Beste Prisperiode binærsensor. Denne sensoren er aktiv i perioder med de laveste strømprisene.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Periodeinnstillinger", @@ -236,7 +236,7 @@ }, "peak_price": { "title": "🔴 Toppprisperiode Innstillinger", - "description": "**Konfigurer innstillinger for Toppprisperiode binærsensor. Denne sensoren er aktiv i perioder med de høyeste strømprisene.**\n\n---", + "description": "**Konfigurer innstillinger for Toppprisperiode binærsensor. Denne sensoren er aktiv i perioder med de høyeste strømprisene.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Periodeinnstillinger", @@ -283,7 +283,7 @@ }, "price_trend": { "title": "📈 Pristrendterskler", - "description": "**Konfigurer terskler for pristrendsensorer. Disse sensorene sammenligner nåværende pris med gjennomsnittet av de neste N timene for å bestemme om prisene stiger sterkt, stiger, er stabile, faller eller faller sterkt.**", + "description": "**Konfigurer terskler for pristrendsensorer. Disse sensorene sammenligner nåværende pris med gjennomsnittet av de neste N timene for å bestemme om prisene stiger sterkt, stiger, er stabile, faller eller faller sterkt.**{entity_warning}", "data": { "price_trend_threshold_rising": "Stigende terskel", "price_trend_threshold_strongly_rising": "Sterkt stigende terskel", @@ -300,7 +300,7 @@ }, "volatility": { "title": "💨 Volatilitets-terskler", - "description": "**Konfigurer terskler for volatilitetsklassifisering.** Volatilitet måler relativ prisvariation ved hjelp av variasjonskoeffisienten (VK = standardavvik / gjennomsnitt × 100%). Disse tersklene er prosentverdier som fungerer på tvers av alle prisnivåer.\n\nBrukes av:\n• Volatilitetssensorer (klassifisering)\n• Trendsensorer (adaptiv terskel justering: <moderat = mer følsom, ≥høy = mindre følsom)", + "description": "**Konfigurer terskler for volatilitetsklassifisering.** Volatilitet måler relativ prisvariation ved hjelp av variasjonskoeffisienten (VK = standardavvik / gjennomsnitt × 100%). Disse tersklene er prosentverdier som fungerer på tvers av alle prisnivåer.\n\nBrukes av:\n• Volatilitetssensorer (klassifisering)\n• Trendsensorer (adaptiv terskel justering: <moderat = mer følsom, ≥høy = mindre følsom){entity_warning}", "data": { "volatility_threshold_moderate": "Moderat terskel", "volatility_threshold_high": "Høy terskel", @@ -315,7 +315,7 @@ }, "chart_data_export": { "title": "📊 Diagram-dataeksport Sensor", - "description": "Diagram-dataeksport-sensoren gir prisdata som sensorattributter.\n\n⚠️ **Merk:** Denne sensoren er en legacy-funksjon for kompatibilitet med eldre verktøy.\n\n**Anbefalt for nye oppsett:** Bruk `tibber_prices.get_chartdata` **tjenesten direkte** - den er mer fleksibel, effektiv og den moderne Home Assistant-tilnærmingen.\n\n**Når denne sensoren gir mening:**\n\n✅ Dashboardverktøyet ditt kan **kun** lese attributter (ingen tjenestekall)\n✅ Du trenger statiske data som oppdateres automatisk\n❌ **Ikke for automatiseringer:** Bruk `tibber_prices.get_chartdata` direkte der - mer fleksibel og effektiv!\n\n---\n\n**Aktiver sensoren:**\n\n1. Åpne **Innstillinger → Enheter og tjenester → Tibber Prices**\n2. Velg ditt hjem → Finn **'Diagramdataeksport'** (Diagnostikk-seksjonen)\n3. **Aktiver sensoren** (deaktivert som standard)\n\n**Konfigurasjon (valgfritt):**\n\nStandardinnstillinger fungerer umiddelbart (i dag+i morgen, 15-minutters intervaller, bare priser).\n\nFor tilpasning, legg til i **`configuration.yaml`**:\n\n```yaml\ntibber_prices:\n chart_export:\n day:\n - today\n - tomorrow\n include_level: true\n include_rating_level: true\n```\n\n**Alle parametere:** Se `tibber_prices.get_chartdata` tjenestens dokumentasjon", + "description": "Diagram-dataeksport-sensoren gir prisdata som sensorattributter.\n\n⚠️ **Merk:** Denne sensoren er en legacy-funksjon for kompatibilitet med eldre verktøy.\n\n**Anbefalt for nye oppsett:** Bruk `tibber_prices.get_chartdata` **tjenesten direkte** - den er mer fleksibel, effektiv og den moderne Home Assistant-tilnærmingen.\n\n**Når denne sensoren gir mening:**\n\n✅ Dashboardverktøyet ditt kan **kun** lese attributter (ingen tjenestekall)\n✅ Du trenger statiske data som oppdateres automatisk\n❌ **Ikke for automatiseringer:** Bruk `tibber_prices.get_chartdata` direkte der - mer fleksibel og effektiv!\n\n---\n\n{sensor_status_info}", "submit": "↩ Ok & tilbake" }, "reset_to_defaults": { @@ -328,7 +328,7 @@ }, "price_level": { "title": "🏷️ Prisnivå-innstillinger", - "description": "**Konfigurer stabilisering for Tibbers prisnivå-klassifisering (veldig billig/billig/normal/dyr/veldig dyr).**\n\nTibbers API gir et prisnivå-felt for hvert intervall. Denne innstillingen jevner ut korte svingninger for å forhindre ustabilitet i automatiseringer.", + "description": "**Konfigurer stabilisering for Tibbers prisnivå-klassifisering (veldig billig/billig/normal/dyr/veldig dyr).**\n\nTibbers API gir et prisnivå-felt for hvert intervall. Denne innstillingen jevner ut korte svingninger for å forhindre ustabilitet i automatiseringer.{entity_warning}", "data": { "price_level_gap_tolerance": "Gap-toleranse" }, diff --git a/custom_components/tibber_prices/translations/nl.json b/custom_components/tibber_prices/translations/nl.json index ca4841b..c0f41d9 100644 --- a/custom_components/tibber_prices/translations/nl.json +++ b/custom_components/tibber_prices/translations/nl.json @@ -172,7 +172,7 @@ }, "current_interval_price_rating": { "title": "📊 Instellingen Prijsbeoordeling", - "description": "**Configureer drempelwaarden en stabilisatie voor prijsbeoordelingsniveaus (laag/normaal/hoog) gebaseerd op vergelijking met het voortschrijdende 24-uurs gemiddelde.**", + "description": "**Configureer drempelwaarden en stabilisatie voor prijsbeoordelingsniveaus (laag/normaal/hoog) gebaseerd op vergelijking met het voortschrijdende 24-uurs gemiddelde.**{entity_warning}", "data": { "price_rating_threshold_low": "Lage Drempel", "price_rating_threshold_high": "Hoge Drempel", @@ -189,7 +189,7 @@ }, "best_price": { "title": "💚 Beste Prijs Periode Instellingen", - "description": "**Configureer instellingen voor de Beste Prijs Periode binaire sensor. Deze sensor is actief tijdens periodes met de laagste elektriciteitsprijzen.**\n\n---", + "description": "**Configureer instellingen voor de Beste Prijs Periode binaire sensor. Deze sensor is actief tijdens periodes met de laagste elektriciteitsprijzen.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Periode Duur & Niveaus", @@ -236,7 +236,7 @@ }, "peak_price": { "title": "🔴 Piekprijs Periode Instellingen", - "description": "**Configureer instellingen voor de Piekprijs Periode binaire sensor. Deze sensor is actief tijdens periodes met de hoogste elektriciteitsprijzen.**\n\n---", + "description": "**Configureer instellingen voor de Piekprijs Periode binaire sensor. Deze sensor is actief tijdens periodes met de hoogste elektriciteitsprijzen.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Periode Instellingen", @@ -283,7 +283,7 @@ }, "price_trend": { "title": "📈 Prijstrend Drempelwaarden", - "description": "**Configureer drempelwaarden voor prijstrend sensoren. Deze sensoren vergelijken de huidige prijs met het gemiddelde van de volgende N uur om te bepalen of prijzen sterk stijgen, stijgen, stabiel zijn, dalen of sterk dalen.**", + "description": "**Configureer drempelwaarden voor prijstrend sensoren. Deze sensoren vergelijken de huidige prijs met het gemiddelde van de volgende N uur om te bepalen of prijzen sterk stijgen, stijgen, stabiel zijn, dalen of sterk dalen.**{entity_warning}", "data": { "price_trend_threshold_rising": "Stijgende Drempel", "price_trend_threshold_strongly_rising": "Sterk Stijgende Drempel", @@ -300,7 +300,7 @@ }, "volatility": { "title": "💨 Prijsvolatiliteit Drempelwaarden", - "description": "**Configureer drempelwaarden voor volatiliteitsclassificatie.** Volatiliteit meet relatieve prijsvariatie met de variëfficcïnt (CV = standaarddeviatie / gemiddelde × 100%). Deze drempelwaarden zijn percentagewaarden die werken over alle prijsniveaus.\n\nGebruikt door:\n• Volatiliteit sensoren (classificatie)\n• Trend sensoren (adaptieve drempelaanpassing: <gematigd = gevoeliger, ≥hoog = minder gevoelig)", + "description": "**Configureer drempelwaarden voor volatiliteitsclassificatie.** Volatiliteit meet relatieve prijsvariatie met de variëfficcïnt (CV = standaarddeviatie / gemiddelde × 100%). Deze drempelwaarden zijn percentagewaarden die werken over alle prijsniveaus.\n\nGebruikt door:\n• Volatiliteit sensoren (classificatie)\n• Trend sensoren (adaptieve drempelaanpassing: <gematigd = gevoeliger, ≥hoog = minder gevoelig){entity_warning}", "data": { "volatility_threshold_moderate": "Gematigde Drempel", "volatility_threshold_high": "Hoge Drempel", @@ -315,7 +315,7 @@ }, "chart_data_export": { "title": "📊 Grafiekdata Export Sensor", - "description": "De Grafiekdata Export Sensor biedt prijsgegevens als sensor attributen.\n\n⚠️ **Let op:** Deze sensor is een legacy functie voor compatibiliteit met oudere tools.\n\n**Aanbevolen voor nieuwe setups:** Gebruik de `tibber_prices.get_chartdata` **service direct** - het is flexibeler, efficïnter, en de moderne Home Assistant aanpak.\n\n**Wanneer deze sensor zinvol is:**\n\n✅ Je dashboardtool kan **alleen** attributen lezen (geen service calls)\n✅ Je hebt statische data nodig die automatisch update\n❌ **Niet voor automatiseringen:** Gebruik `tibber_prices.get_chartdata` daar direct - flexibeler en efficïnter!\n\n---\n\n**De sensor inschakelen:**\n\n1. Open **Instellingen → Apparaten & Services → Tibber Prices**\n2. Selecteer je huis → Vind **'Chart Data Export'** (Diagnose sectie)\n3. **Schakel de sensor in** (standaard uitgeschakeld)\n\n**Configuratie (optioneel):**\n\nStandaard instellingen werken out-of-the-box (vandaag+morgen, 15-minuten intervallen, alleen prijzen).\n\nVoor aanpassing, voeg toe aan **`configuration.yaml`**:\n\n```yaml\ntibber_prices:\n chart_export:\n day:\n - today\n - tomorrow\n include_level: true\n include_rating_level: true\n```\n\n**Alle parameters:** Zie `tibber_prices.get_chartdata` service documentatie", + "description": "De Grafiekdata Export Sensor biedt prijsgegevens als sensor attributen.\n\n⚠️ **Let op:** Deze sensor is een legacy functie voor compatibiliteit met oudere tools.\n\n**Aanbevolen voor nieuwe setups:** Gebruik de `tibber_prices.get_chartdata` **service direct** - het is flexibeler, efficïnter, en de moderne Home Assistant aanpak.\n\n**Wanneer deze sensor zinvol is:**\n\n✅ Je dashboardtool kan **alleen** attributen lezen (geen service calls)\n✅ Je hebt statische data nodig die automatisch update\n❌ **Niet voor automatiseringen:** Gebruik `tibber_prices.get_chartdata` daar direct - flexibeler en efficïnter!\n\n---\n\n{sensor_status_info}", "submit": "↩ Ok & Terug" }, "reset_to_defaults": { @@ -328,7 +328,7 @@ }, "price_level": { "title": "🏷️ Prijsniveau-instellingen", - "description": "**Configureer stabilisatie voor Tibbers prijsniveau-classificatie (zeer goedkoop/goedkoop/normaal/duur/zeer duur).**\n\nTibbers API levert een prijsniveau-veld voor elk interval. Deze instelling egaliseer korte fluctuaties om instabiliteit in automatiseringen te voorkomen.", + "description": "**Configureer stabilisatie voor Tibbers prijsniveau-classificatie (zeer goedkoop/goedkoop/normaal/duur/zeer duur).**\n\nTibbers API levert een prijsniveau-veld voor elk interval. Deze instelling egaliseer korte fluctuaties om instabiliteit in automatiseringen te voorkomen.{entity_warning}", "data": { "price_level_gap_tolerance": "Gap-tolerantie" }, diff --git a/custom_components/tibber_prices/translations/sv.json b/custom_components/tibber_prices/translations/sv.json index 78dab82..9c301fe 100644 --- a/custom_components/tibber_prices/translations/sv.json +++ b/custom_components/tibber_prices/translations/sv.json @@ -172,7 +172,7 @@ }, "current_interval_price_rating": { "title": "📊 Prisbetyginställningar", - "description": "**Konfigurera tröskelvärden och stabilisering för prisbetygsnivåer (låg/normal/hög) baserat på jämförelse med glidande 24-timmars genomsnitt.**", + "description": "**Konfigurera tröskelvärden och stabilisering för prisbetygsnivåer (låg/normal/hög) baserat på jämförelse med glidande 24-timmars genomsnitt.**{entity_warning}", "data": { "price_rating_threshold_low": "Låg tröskel", "price_rating_threshold_high": "Hög tröskel", @@ -189,7 +189,7 @@ }, "best_price": { "title": "💚 Bästa Prisperiod-inställningar", - "description": "**Konfigurera inställningar för binärsensorn Bästa Prisperiod. Denna sensor är aktiv under perioder med lägsta elpriserna.**\n\n---", + "description": "**Konfigurera inställningar för binärsensorn Bästa Prisperiod. Denna sensor är aktiv under perioder med lägsta elpriserna.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Periodlängd & Nivåer", @@ -236,7 +236,7 @@ }, "peak_price": { "title": "🔴 Topprisperiod-inställningar", - "description": "**Konfigurera inställningar för binärsensorn Topprisperiod. Denna sensor är aktiv under perioder med högsta elpriserna.**\n\n---", + "description": "**Konfigurera inställningar för binärsensorn Topprisperiod. Denna sensor är aktiv under perioder med högsta elpriserna.**{entity_warning}\n\n---", "sections": { "period_settings": { "name": "Periodinställningar", @@ -283,7 +283,7 @@ }, "price_trend": { "title": "📈 Pristrendtrösklar", - "description": "**Konfigurera tröskelvärden för pristrendsensorer. Dessa sensorer jämför aktuellt pris med genomsnittet av de nästa N timmarna för att bestämma om priserna stiger kraftigt, stiger, är stabila, faller eller faller kraftigt.**", + "description": "**Konfigurera tröskelvärden för pristrendsensorer. Dessa sensorer jämför aktuellt pris med genomsnittet av de nästa N timmarna för att bestämma om priserna stiger kraftigt, stiger, är stabila, faller eller faller kraftigt.**{entity_warning}", "data": { "price_trend_threshold_rising": "Stigande tröskel", "price_trend_threshold_strongly_rising": "Kraftigt stigande tröskel", @@ -300,7 +300,7 @@ }, "volatility": { "title": "💨 Prisvolatilitetströsklar", - "description": "**Konfigurera tröskelvärden för volatilitetsklassificering.** Volatilitet mäter relativ prisvariation med variationskoefficienten (CV = standardavvikelse / medelvärde × 100%). Dessa tröskelvärden är procentvärden som fungerar över alla prisnivåer.\n\nAnvänds av:\n• Volatilitetssensorer (klassificering)\n• Trendsensorer (adaptiv tröskeljustering: <måttlig = mer känslig, ≥hög = mindre känslig)", + "description": "**Konfigurera tröskelvärden för volatilitetsklassificering.** Volatilitet mäter relativ prisvariation med variationskoefficienten (CV = standardavvikelse / medelvärde × 100%). Dessa tröskelvärden är procentvärden som fungerar över alla prisnivåer.\n\nAnvänds av:\n• Volatilitetssensorer (klassificering)\n• Trendsensorer (adaptiv tröskeljustering: <måttlig = mer känslig, ≥hög = mindre känslig){entity_warning}", "data": { "volatility_threshold_moderate": "Måttlig tröskel", "volatility_threshold_high": "Hög tröskel", @@ -315,7 +315,7 @@ }, "chart_data_export": { "title": "📊 Diagramdataexport-sensor", - "description": "Diagramdataexport-sensorn tillhandahåller prisdata som sensorattribut.\n\n⚠️ **Obs:** Denna sensor är en äldre funktion för kompatibilitet med äldre verktyg.\n\n**Rekommenderat för nya konfigurationer:** Använd `tibber_prices.get_chartdata` **tjänsten direkt** - den är mer flexibel, effektiv och det moderna Home Assistant-sättet.\n\n**När denna sensor är meningsfull:**\n\n✅ Ditt instrumentpanelverktyg kan **endast** läsa attribut (inga tjänsteanrop)\n✅ Du behöver statisk data som uppdateras automatiskt\n❌ **Inte för automationer:** Använd `tibber_prices.get_chartdata` direkt där - mer flexibelt och effektivt!\n\n---\n\n**Aktivera sensorn:**\n\n1. Öppna **Inställningar → Enheter & Tjänster → Tibber-priser**\n2. Välj ditt hem → Hitta **'Diagramdataexport'** (Diagnostiksektion)\n3. **Aktivera sensorn** (inaktiverad som standard)\n\n**Konfiguration (valfritt):**\n\nStandardinställningar fungerar direkt (idag+imorgon, 15-minutersintervall, endast priser).\n\nFör anpassning, lägg till i **`configuration.yaml`**:\n\n```yaml\ntibber_prices:\n chart_export:\n day:\n - today\n - tomorrow\n include_level: true\n include_rating_level: true\n```\n\n**Alla parametrar:** Se `tibber_prices.get_chartdata` tjänstdokumentation", + "description": "Diagramdataexport-sensorn tillhandahåller prisdata som sensorattribut.\n\n⚠️ **Obs:** Denna sensor är en äldre funktion för kompatibilitet med äldre verktyg.\n\n**Rekommenderat för nya konfigurationer:** Använd `tibber_prices.get_chartdata` **tjänsten direkt** - den är mer flexibel, effektiv och det moderna Home Assistant-sättet.\n\n**När denna sensor är meningsfull:**\n\n✅ Ditt instrumentpanelverktyg kan **endast** läsa attribut (inga tjänsteanrop)\n✅ Du behöver statisk data som uppdateras automatiskt\n❌ **Inte för automationer:** Använd `tibber_prices.get_chartdata` direkt där - mer flexibelt och effektivt!\n\n---\n\n{sensor_status_info}", "submit": "↩ Ok & tillbaka" }, "reset_to_defaults": { @@ -327,8 +327,8 @@ "submit": "Återställ nu" }, "price_level": { - "title": "��️ Prisnivå-inställningar", - "description": "**Konfigurera stabilisering för Tibbers prisnivå-klassificering (mycket billig/billig/normal/dyr/mycket dyr).**\n\nTibbers API tillhandahåller ett prisnivå-fält för varje intervall. Denna inställning jämnar ut korta fluktuationer för att förhindra instabilitet i automatiseringar.", + "title": "🏷️ Prisnivå-inställningar", + "description": "**Konfigurera stabilisering för Tibbers prisnivå-klassificering (mycket billig/billig/normal/dyr/mycket dyr).**\n\nTibbers API tillhandahåller ett prisnivå-fält för varje intervall. Denna inställning jämnar ut korta fluktuationer för att förhindra instabilitet i automatiseringar.{entity_warning}", "data": { "price_level_gap_tolerance": "Gap-tolerans" },