mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
Add resolution parameter to get_chartdata and get_apexcharts_yaml services, allowing users to choose between original 15-minute intervals or aggregated hourly values for chart visualization. Implementation uses rolling 5-interval window aggregation (-2, -1, 0, +1, +2 around :00 of each hour = 60 minutes total), matching the sensor rolling hour methodology. Respects user's CONF_AVERAGE_SENSOR_DISPLAY setting for mean vs median calculation. Changes: - formatters.py: Add aggregate_to_hourly() function preserving original field names (startsAt, total, level, rating_level) for unified processing - get_chartdata.py: Pre-aggregate data before processing when resolution is 'hourly', enabling same code path for filters/insert_nulls/connect_segments - get_apexcharts_yaml.py: Add resolution parameter, pass to all 4 get_chartdata service calls in generated JavaScript - services.yaml: Add resolution field with interval/hourly selector - icons.json: Add section icons for get_apexcharts_yaml fields - translations: Add highlight_peak_price and resolution field translations for all 5 languages (en, de, sv, nb, nl) Impact: Users can now generate cleaner charts with 24 hourly data points instead of 96 quarter-hourly intervals. The unified processing approach ensures all chart features (filters, null insertion, segment connection) work identically for both resolutions.
33 lines
1.1 KiB
JSON
33 lines
1.1 KiB
JSON
{
|
|
"services": {
|
|
"get_price": {
|
|
"service": "mdi:table-search"
|
|
},
|
|
"get_chartdata": {
|
|
"service": "mdi:chart-bar",
|
|
"sections": {
|
|
"general": "mdi:identifier",
|
|
"selection": "mdi:calendar-range",
|
|
"filters": "mdi:filter-variant",
|
|
"transformation": "mdi:tune",
|
|
"format": "mdi:file-table",
|
|
"arrays_of_objects": "mdi:code-json",
|
|
"arrays_of_arrays": "mdi:code-brackets"
|
|
}
|
|
},
|
|
"get_apexcharts_yaml": {
|
|
"service": "mdi:chart-line",
|
|
"sections": {
|
|
"entry_id": "mdi:identifier",
|
|
"day": "mdi:calendar-range",
|
|
"level_type": "mdi:format-list-bulleted-type",
|
|
"resolution": "mdi:timer-sand",
|
|
"highlight_best_price": "mdi:battery-charging-low",
|
|
"highlight_peak_price": "mdi:battery-alert"
|
|
}
|
|
},
|
|
"refresh_user_data": {
|
|
"service": "mdi:refresh"
|
|
}
|
|
}
|
|
}
|