feat(services): add average indicator for hourly resolution in charts

Add visual indicators to distinguish hourly aggregated data from
original 15-minute interval data in ApexCharts output.

Changes:
- Chart title: Append localized suffix like "(Ø hourly)" / "(Ø stündlich)"
- Y-axis label: Append "(Ø)" suffix, e.g., "øre/kWh (Ø)"

The suffix pattern avoids confusion with Scandinavian currency symbols
(øre/öre) which look similar to the average symbol (Ø) when used as prefix.

Added hourly_suffix translations for all 5 languages (en, de, sv, nb, nl).

Impact: Users can now clearly see when a chart displays averaged hourly
data rather than original 15-minute prices.
This commit is contained in:
Julian Pawlowski 2026-01-20 16:44:18 +00:00
parent b541f7b15e
commit cc75bc53ee
6 changed files with 17 additions and 3 deletions

View file

@ -2,6 +2,7 @@
"apexcharts": {
"title_rating_level": "Preisphasen Tagesverlauf",
"title_level": "Preisniveau",
"hourly_suffix": "(Ø stündlich)",
"best_price_period_name": "Bestpreis-Zeitraum",
"peak_price_period_name": "Spitzenpreis-Zeitraum",
"notification": {

View file

@ -2,6 +2,7 @@
"apexcharts": {
"title_rating_level": "Price Phases Daily Progress",
"title_level": "Price Level",
"hourly_suffix": "(Ø hourly)",
"best_price_period_name": "Best Price Period",
"peak_price_period_name": "Peak Price Period",
"notification": {

View file

@ -2,6 +2,7 @@
"apexcharts": {
"title_rating_level": "Prisfaser dagsfremdrift",
"title_level": "Prisnivå",
"hourly_suffix": "(Ø per time)",
"best_price_period_name": "Beste prisperiode",
"peak_price_period_name": "Toppprisperiode",
"notification": {
@ -505,4 +506,4 @@
"now": "nå"
},
"attribution": "Data levert av Tibber"
}
}

View file

@ -2,6 +2,7 @@
"apexcharts": {
"title_rating_level": "Prijsfasen dagverloop",
"title_level": "Prijsniveau",
"hourly_suffix": "(Ø per uur)",
"best_price_period_name": "Beste prijsperiode",
"peak_price_period_name": "Piekprijsperiode",
"notification": {
@ -505,4 +506,4 @@
"now": "nu"
},
"attribution": "Gegevens geleverd door Tibber"
}
}

View file

@ -2,6 +2,7 @@
"apexcharts": {
"title_rating_level": "Prisfaser dagsprogress",
"title_level": "Prisnivå",
"hourly_suffix": "(Ø per timme)",
"best_price_period_name": "Bästa prisperiod",
"peak_price_period_name": "Toppprisperiod",
"notification": {
@ -505,4 +506,4 @@
"now": "nu"
},
"attribution": "Data tillhandahålls av Tibber"
}
}

View file

@ -314,6 +314,10 @@ async def handle_apexcharts_yaml(call: ServiceCall) -> dict[str, Any]: # noqa:
use_subunit = display_mode == DISPLAY_MODE_SUBUNIT
price_unit = get_display_unit_string(config_entry, currency)
# Add average symbol suffix for hourly resolution (suffix to avoid confusion with øre/öre)
if resolution == "hourly":
price_unit = f"{price_unit} (Ø)"
# Get entity registry for mapping
entity_registry = async_get_entity_registry(hass)
@ -532,6 +536,11 @@ async def handle_apexcharts_yaml(call: ServiceCall) -> dict[str, Any]: # noqa:
day_translated = get_translation(["selector", "day", "options", day], user_language) or day.capitalize()
title = f"{title} - {day_translated}"
# Add hourly suffix to title when using hourly resolution
if resolution == "hourly":
hourly_suffix = get_translation(["apexcharts", "hourly_suffix"], user_language) or "(Ø hourly)"
title = f"{title} {hourly_suffix}"
# Configure span based on selected day
# For rolling window modes, use config-template-card for dynamic config
if day == "yesterday":