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:
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}
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…
Fixed my previous issue using remaining child state
.
Browsing through this topic, I noticed some things on ‘ordering’ are still open, nevertheless I’d like to check if I’m doing anything wrong here:
The smallest of the purple flows ( sensor.smart_display_energy_energy ) seems to go at the bottom from Living, where I would like to have it on top from the left as well.
Anything I can do about it?
this was new to me so I immediately tried it. would be a great feature indeed. However, my fully configured yaml config, with all entities, only shows a single entity when this is used.
Ive made sure recorder includes these entities, but other than that, what could be wrong?
( I take it this has nothing to do with the actual HA energy dashboard? and relies solely on the config of this chart in the card at hand)
Use this only for accumulated data sensors (energy/water/gas)
would mean we need ‘lifetime’ sensors here, and can not use the daily energy sensors… would make sense ofc, and have the date selector do its jib. Otoh, I dont understand why this single entity would display, as that too is a day counter.
I use the date selection directly with the energy sensors of the relevant elements (e.g. energy sensors are created when Shelly Plugs are integrated), so no specific ‘daily’ sensors.
Also, the date selection covers the entire card as you can see.
So for now, it works for the sensors themselves. Any helpers I’ve made to group sensor data for instance have not been successful. I understood from @MindFreeze that indeed historical data is needed, but haven’t figured out which sensors do collect that and which don’t.
Hence, the use of remaining child state as that seems to work with the data selection.
The only thing (as mentioned before) that I seemingly haven’t gotten control of, is the order there
sure, thx.
why would this solve the orientation issue? I mean, we can swipe, but the portrait orientation of the snaky chart still does not make any sense on a phone…
besides, I am a bit careful implementing the swiper card, as it is no longer maintained, and has been in that state for some time (even while being created by one of the frontend devs…)
it’s the best solution i have found for a mobile view of sankey chart. it’s not perfect but it works.
so far i have no issues at all with the swiper card and i use it for other energy charts and stats as well.
(I’ve reduced the swiper config to a minimum to rule out any setting)
guess this is one of those situation swiper creates trouble in combination with the embracing config-template-card… there are a few of those in the repo.
However, there’s a huge issue with the complete view becoming unstable, as it moves left and right in the app. The Frontend has an issue there, I reported it before, when cards scroll outside the fixed width.
So, though initially this might seem a nice solution, I feel its not a long term one.
probly should change that to show a markdown with
- type: entities
entities:
- input_select.sankey_min_state
- type: custom:state-switch
entity: mediaquery
states:
"(min-width: 800px)":
!include /config/dashboard/includes/include_sankey_energie_verbruik.yaml
all:
type: markdown
content: >
## Change screen
To display the Energie Verbruik Sankey that should be here, change to
landscape orientation or widen the screen
the !include inside the state-switch, is the full entities card I commented below it, (and can thus easily be amended for future changes)
anything bigger than the landscape phone will show the regular card, below that the swiper kicks in