mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
Fix ApexCharts header N/A display by removing trailing nulls from data
Co-authored-by: jpawlowski <75446+jpawlowski@users.noreply.github.com>
This commit is contained in:
parent
735ff2cc62
commit
789a9cd2f1
1 changed files with 5 additions and 1 deletions
|
|
@ -131,6 +131,8 @@ async def handle_apexcharts_yaml(call: ServiceCall) -> dict[str, Any]:
|
|||
else:
|
||||
filter_param = f"level_filter: ['{level_key}']"
|
||||
|
||||
# Data generator fetches chart data and removes trailing nulls for proper header display
|
||||
# (ApexCharts in_header shows last value, so trailing nulls cause "N/A")
|
||||
data_generator = (
|
||||
f"const response = await hass.callWS({{ "
|
||||
f"type: 'call_service', "
|
||||
|
|
@ -139,7 +141,9 @@ async def handle_apexcharts_yaml(call: ServiceCall) -> dict[str, Any]:
|
|||
f"return_response: true, "
|
||||
f"service_data: {{ entry_id: '{entry_id}', day: ['{day}'], {filter_param}, "
|
||||
f"output_format: 'array_of_arrays', insert_nulls: 'segments', minor_currency: true }} }}); "
|
||||
f"return response.response.data;"
|
||||
f"const data = response.response.data; "
|
||||
f"while (data.length > 0 && data[data.length - 1][1] === null) data.pop(); "
|
||||
f"return data;"
|
||||
)
|
||||
# Only show extremas for HIGH and LOW levels (not NORMAL)
|
||||
show_extremas = level_key != "NORMAL"
|
||||
|
|
|
|||
Loading…
Reference in a new issue