not sure it’s that tbh, the chart is simply not very transparent when it comes to showing several connections concerning the same number. anyways, I’ve decided to split this bigger chart up in 2 smaller sections:
note the odd swirl I the middle…
also note the top right entity: 3.9kWh Saldo. I’ve added a template sensor there to always give me a positive value (|abs), and change name when changing polarity.
- unique_id: saldo_totaal_dag_energie_afname_of_levering
name: >
{% set saldo = this.attributes.get('saldo',0) %}
{% set phrase = 'levering' if saldo < 0 else 'afname' %}
Saldo: {{phrase}} vandaag
state: >
{% set saldo = this.attributes.get('saldo',0) %}
{{saldo if saldo > 0 else saldo|abs}}
attributes:
saldo: >
{% set saldo = expand('sensor.grid_energy_teller_1','sensor.grid_energy_teller_2')
|selectattr('state','is_number')
|map(attribute='state')
|map('float')|sum %}
{{saldo}}
icon: mdi:counter
<<: *energy_total
also, I now change the color of that entity using another template:
- unique_id: grid_energy_total_color
name: Grid energy total color
state: >
{% set saldo = expand('sensor.grid_energy_teller_1','sensor.grid_energy_teller_2')
|selectattr('state','is_number')
|map(attribute='state')
|map('float')|sum %}
{{'green' if saldo < 0 else 'crimson'}}
and use that by means of the custom:config-template-card embedding the sankey-chart config:
- type: custom:config-template-card
entities:
- input_select.sankey_min_state
- sensor.grid_energy_total_color
variables:
min_state: states['input_select.sankey_min_state'].state
saldo_color : states['sensor.grid_energy_total_color'].state
card:
type: custom:sankey-chart
title: Energie verbruik
min_state: ${min_state}
##snip
- entities:
- entity_id: sensor.saldo_totaal_dag_energie_afname_of_levering
# name: Saldo # now set in the template sensor name
color: ${saldo_color}
and the detailed consumption
the bottom pics shows another ‘issue’. the heights of the last column are not adjusted to remain readable… Even though there is plenty space (these are ordered on value, so that might interfere here)
Maybe it’s also caused by the fact this is now inside a vertical-stack.
Still I would feel there is room for improvement considering the line heights…