Anyone using the Sankey Chart Card?

Hi, unfortunately without success

Thanks for your fast reply and for considering the idea.
And yes it’s either a 2nd method which needs to be supported, or it’s a breaking change.

Or what do you think about adding code modifications to achieve the above, the card does already e.g. add code for passthrough entities, perhaps it could add parents and remove children? :wink:

Cheers and thanks again

1 Like

Hi,
I have read this topic multiple times but can’t seem to fix this crossing/displaying error.
How do I prevent this crossing of the entities and the bottom?

If you use sorting, add sort_group_by_parent. If you don’t use sorting, just manually order the entities in the config however you want

2 Likes

Never thought that it was sorted by the order in the coding…
sorry, I am not a developer…
It works!

1 Like

can you explain that template calculation?

Hi,

I try to make it work but I got Missing child entity sensor.total_saltwater but the children is there in the config.

Thank

type: custom:sankey-chart
title: Power
show_names: true
min_box_height: 20
round: 1
sections:
  - entities:
      - entity_id: sensor.maison_123_1min
        name: Total
        remaining:
          name: Other
        children:
          - sensor.total_saltwater
          - sensor.aquarium_total_power_usage_eau_douce
  - entities:
      - entity_id: sensor.total_aquarium_power
        name: Washer
      - entity_id: sensor.total_server_room_newone
        name: Server Room
        children:
          - sensor.poweredge_r740xdpoweredge_current_power_usage
          - sensor.poweredge_r330poweredge_current_power_usage
          - sensor.r730xd_live_powers_11_0_0_2
          - sensor.nas_server
          - sensor.sonoff_10020b8ac9_power
          - sensor.sonoff_10017fe353_power
        remaining:
          name: Other
  - entities:
      - entity_id: sensor.poweredge_r740xdpoweredge_current_power_usage
        name: Host 1
      - entity_id: sensor.poweredge_r330poweredge_current_power_usage
        name: Host 2
      - entity_id: sensor.r730xd_live_powers_11_0_0_2
        name: Host 3

It’s really not there. You have it it listed in the children but not where to render it. It should be in one lf the next sections

Hello All.

I trying figured out how show water consumption in property what I managed. There is main water meter from water supply and many end water meters. Additional there is (but not integrated yet but will soon) for garden, fire hydrant and sub water meter for all heat water before boiling room.

So at this moment have one input water meter and end 24 water meters (12 cold + 12 hot water), hence 2 sections.

UoM in HA is m³ for all water meters and idea is show daily consumption. After some time I have

The code is:

layout: horizontal
height: 500
unit_prefix: ''
round: 0
convert_units_to: 'm³'
co2_intensity_entity: 
gas_co2_intensity: 
min_box_size: 10
min_box_distance: 5
show_states: true
show_units: true
sections:
  - entities:
      - type: entity
        children:
          - sensor.1_zw
          - sensor.2_zw
          - sensor.2_cwu
          - sensor.3_zw
          - sensor.3_cwu
          - sensor.4_zw
          - sensor.4_cwu
          - sensor.5_zw
          - sensor.5_cwu
          - sensor.6_zw
          - sensor.7_zw
          - sensor.7_cwu
          - sensor.8_zw
          - sensor.8_cwu
          - sensor.9_zw
          - sensor.9_cwu
          - sensor.10_zw
          - sensor.10_cwu
          - sensor.11_zw
          - sensor.11_cwu
          - sensor.12_zw
          - sensor.12_cwu
          - sensor.12a_zw
          - sensor.12a_cwu
          - sensor.adm_cwu
          - sensor.adm_zw 
        entity_id: sensor.adapr_na_1_licznik_glowny
        color_on_state: true
        unit_of_measurement: m³
        name: Main water meter
        icon: mdi:account
  - entities:
      - type: entity
        children: []
        entity_id: sensor.1_zw
        color: var
        color_on_state: true
      - type: entity
        children: []
        entity_id: sensor.2_zw
        color: var
      - type: entity
        children: []
        entity_id: sensor.2_cwu
      - type: entity
        children: []
        entity_id: sensor.3_zw
      - type: entity
        children: []
        entity_id: sensor.3_cwu
      - type: entity
        children: []
        entity_id: sensor.4_zw
      - type: entity
        children: []
        entity_id: sensor.4_cwu
      - type: entity
        children: []
        entity_id: sensor.5_zw
      - type: entity
        children: []
        entity_id: sensor.5_cwu
      - type: entity
        children: []
        entity_id: sensor.6_zw
      - type: entity
        children: []
        entity_id: sensor.7_zw
      - type: entity
        children: []
        entity_id: sensor.7_cwu
      - type: entity
        children: []
        entity_id: sensor.8_zw
      - type: entity
        children: []
        entity_id: sensor.8_cwu
      - type: entity
        children: []
        entity_id: sensor.9_zw
      - type: entity
        children: []
        entity_id: sensor.9_cwu
      - type: entity
        children: []
        entity_id: sensor.10_zw
      - type: entity
        children: []
        entity_id: sensor.10_cwu
      - type: entity
        children: []
        entity_id: sensor.11_zw
      - type: entity
        children: []
        entity_id: sensor.11_cwu
      - type: entity
        children: []
        entity_id: sensor.12_zw
      - type: entity
        children: []
        entity_id: sensor.12_cwu
      - type: entity
        children: []
        entity_id: sensor.12a_zw
      - type: entity
        children: []
        entity_id: sensor.12a_cwu
      - type: entity
        children: []
        entity_id: sensor.adm_zw
      - type: entity
        children: []
        entity_id: sensor.adm_cwu
energy_date_selection: true
type: custom:sankey-chart
min_state: 0
show_names: true
show_icons: false
title: Wodociągi
wide: true

My problem and issue are:

  1. Why showing 0.001³ or 0.002³ ? General state of each end water meter is many m³ and main input water meter have almost 600 m³. Please note HA entity UoM=m³ for all my water meters, but Sankey chart not show “m” only ³ with wrong value.
    Because water meters has been changed at different date then sum of end waters <> main water.

  2. There is easy way to set colors for 24 end water meters? General there is no definition what colors I can use in documentation (or I wrong search), also in visual editor is not possible choose color from pallet of colors hence I have big problem how to pretty good assign nice colors. Maybe is possible set color for 1st and last one and Sankey Chart will automatically assign gradient colors of end devices in the 2nd section?

  3. Is possible show Sankey chart for values for current day, for relatives values counted from 0:00 to “now” (max 24:00) only daily consumption of water, not total? Like below hourly chart from energy dashboard for my end water meters (BTW the dashboard should be named utilities or media, not energy)?

BR, Krzysiek

Oof thats a lot of questions.

  1. Don’t use convert_units_to . This is used to convert it to something else like price.
  2. CSS color values are allowed. Examples: #ff00ff, rgb(255,0,128) or just a color name like “red”
  3. You’ve already set energy_date_selection:true but you also need to add another card of type: energy-date-selection in order to select the displayed period

Thank you for your answers, for your work and support.

A1. I used convert_units_to because without this it was not working too. Please look charts after made changes and the code. Maybe my entities configurations is wrong?

Input water meter

One of end water meters (all configured the same):

Ad2. Understood, however :
a) for non-web developers like me nice to update documentation about it:slight_smile:
b) maybe consider add feature to chose color from pallet in web config ??

Ad3. Probably working but cannot confirm due to Ad1.


layout: horizontal
type: custom:sankey-chart
height: 500
unit_prefix: ''
round: 0
convert_units_to: ''
min_box_size: 10
min_box_distance: 5
show_states: true
show_units: true
energy_date_selection: true
min_state: 0
show_names: true
show_icons: false
title: Wodociągi
wide: true
sections:
  - entities:
      - type: entity
        children:
          - sensor.2_zw
          - sensor.2_cwu
          - sensor.3_zw
          - sensor.3_cwu
          - sensor.4_zw
          - sensor.4_cwu
          - sensor.5_zw
          - sensor.5_cwu
          - sensor.6_zw
          - sensor.7_zw
          - sensor.7_cwu
          - sensor.8_zw
          - sensor.8_cwu
          - sensor.9_zw
          - sensor.9_cwu
          - sensor.10_zw
          - sensor.10_cwu
          - sensor.11_zw
          - sensor.11_cwu
          - sensor.12_zw
          - sensor.12_cwu
          - sensor.12a_zw
          - sensor.12a_cwu
          - sensor.adm_cwu
          - sensor.adm_zw
          - sensor.1_zw
        entity_id: sensor.adapr_na_1_licznik_glowny
        color_on_state: true
        unit_of_measurement: m³
        name: Main water meter
        icon: mdi:account
  - entities:
      - type: entity
        children: []
        entity_id: sensor.1_zw
        color: var
        color_on_state: true
      - type: entity
        children: []
        entity_id: sensor.2_zw
        color: var
      - type: entity
        children: []
        entity_id: sensor.2_cwu
      - type: entity
        children: []
        entity_id: sensor.3_zw
      - type: entity
        children: []
        entity_id: sensor.3_cwu
      - type: entity
        children: []
        entity_id: sensor.4_zw
      - type: entity
        children: []
        entity_id: sensor.4_cwu
      - type: entity
        children: []
        entity_id: sensor.5_zw
      - type: entity
        children: []
        entity_id: sensor.5_cwu
      - type: entity
        children: []
        entity_id: sensor.6_zw
      - type: entity
        children: []
        entity_id: sensor.7_zw
      - type: entity
        children: []
        entity_id: sensor.7_cwu
      - type: entity
        children: []
        entity_id: sensor.8_zw
      - type: entity
        children: []
        entity_id: sensor.8_cwu
      - type: entity
        children: []
        entity_id: sensor.9_zw
      - type: entity
        children: []
        entity_id: sensor.9_cwu
      - type: entity
        children: []
        entity_id: sensor.10_zw
      - type: entity
        children: []
        entity_id: sensor.10_cwu
      - type: entity
        children: []
        entity_id: sensor.11_zw
      - type: entity
        children: []
        entity_id: sensor.11_cwu
      - type: entity
        children: []
        entity_id: sensor.12_zw
      - type: entity
        children: []
        entity_id: sensor.12_cwu
      - type: entity
        children: []
        entity_id: sensor.12a_zw
      - type: entity
        children: []
        entity_id: sensor.12a_cwu
      - type: entity
        children: []
        entity_id: sensor.adm_zw
      - type: entity
        children: []
        entity_id: sensor.adm_cwu

There was a bug with m units because it’s the same as the prefix for milli. Fixed in v3.2.4 . It should work for you after the update

1 Like

Thank you again, working almost fine :slight_smile:

Only one setting not work for me:

  1. Horizontal mode + wide==true ==> not expand card.

And last question - is possible for each section make sum of all visible values and print summary bellow of section? In theory sum of each section should be the same, if not then:

  • there is a water leak somewhere
  • some of end water meters not measure /send values to HA

PS. Additional I see below enhancements but I will go to GitHub and create ticket, maybe will appear below functionalities:

A. Add to prefix space " " or as additional option to keep distance between value and UoM.
B. Option to keep fixed number of digits after decimal separation (eg. from 2.04 → 2.040) to keep better align for text labels.
C. Or allow choose order of display between “name” and “value” (so between on example “0,074 m3 8 ZW” and “8 ZW 0,074 m3”
D. Allow set wide in pixels or better % of screen, not bool 0/1 as now (what probably now work for me) to extend chart as you prefer for horizontal mode

BR, Krzysiek

The card expands as much as HA allows. You need a panel type view if you want to use the entire width.

Sum per section doesn’t make sense in this card. A sum would usually just be the previous section. If you want to see discrepancies, you can add remaining... type entities to show that

A. You can use card-mod to customise this with CSS. This is the accepted approach for such specific customisations
B,C. You can submit a request for these but seems rather niche so I doubt I’ll want to complicate the code with so much customisation. Also changing the order should be possible with CSS again.
D. This is determined by HA, not the card. See the different view types

Regarding panel type view after add type: panel appear below warning due to have 2nd card with date select:

But change into panel: sidebar look good for me.

Regarding type: remaining then good idea but cannot implement it :confused: When add to 2nd section as below nothing happened special:

Change to from remaining_parent_state to remaining_child_state no sense. Can you help please with implement remaining correctly. I’d like see remaining on 2nd section if appear descapency .

About PS section, if general rule is not complicate the code then will no force for the changes and I will learn CSS to adopt to myself.

Two more question.

I.

Because pairs of end water meters (ZW - cold water, CWU - hot water) is related to one flat hence trying implement phantom/virtual section and found passthrough but implementation cause error - this is bug and I should create issue on GitHub or I made something wrong?
Idea to have 12 sections (in middle 2nd or end 3rd section) combining each two water meters eg: for “flat 4=4 ZW + 4 CWU”. Is possible to achieve it ?

II.

Why for sensor “12A ZW” line is weak comparing to neighborhood and for “12A CWU” missing totally?

Thank you for your support.

layout: horizontal
height: 500
unit_prefix: ''
round: 3
convert_units_to: ''
#co2_intensity_entity: sensor.co2_signal_co2_intensity
#gas_co2_intensity: 2351.6459999999997
min_box_size: 10
min_box_distance: 6
show_states: true
show_units: true
sections:
  - entities:
      - entity_id: sensor.adapr_na_1_licznik_glowny
        type: entity
        color_on_state: true
        name: Main water meter
        icon: mdi:account
        children:
          - sensor.1_zw
          - sensor.2_zw
          - sensor.2_cwu
          - sensor.3_zw
          - sensor.3_cwu
          - sensor.4_zw
          - sensor.4_cwu
          - sensor.5_zw
          - sensor.5_cwu
          - sensor.6_zw
          - sensor.7_zw
          - sensor.7_cwu
          - sensor.8_zw
          - sensor.8_cwu
          - sensor.9_zw
          - sensor.9_cwu
          - sensor.10_zw
          - sensor.10_cwu
          - sensor.11_zw
          - sensor.11_cwu
          - sensor.12_zw
          - sensor.12_cwu
          - sensor.12a_zw
          - sensor.12a_cwu
          - sensor.adm_cwu
          - sensor.adm_zw
  - entities:
      - type: entity
        children: []
        entity_id: sensor.1_zw
        color_on_state: true
      - type: entity
        children: []
        entity_id: sensor.2_zw
      - type: entity
        children: []
        entity_id: sensor.2_cwu
      - type: entity
        children: []
        entity_id: sensor.3_zw
      - type: entity
        children: []
        entity_id: sensor.3_cwu
      - type: entity
        children: []
        entity_id: sensor.4_zw
      - type: entity
        children: []
        entity_id: sensor.4_cwu
      - type: entity
        children: []
        entity_id: sensor.5_zw
      - type: entity
        children: []
        entity_id: sensor.5_cwu
      - type: entity
        children: []
        entity_id: sensor.6_zw
      - type: entity
        children: []
        entity_id: sensor.7_zw
      - type: entity
        children: []
        entity_id: sensor.7_cwu
      - type: entity
        children: []
        entity_id: sensor.8_zw
      - type: entity
        children: []
        entity_id: sensor.8_cwu
      - type: entity
        children: []
        entity_id: sensor.9_zw
      - type: entity
        children: []
        entity_id: sensor.9_cwu
      - type: entity
        children: []
        entity_id: sensor.10_zw
      - type: entity
        children: []
        entity_id: sensor.10_cwu
      - type: entity
        children: []
        entity_id: sensor.11_zw
      - type: entity
        children: []
        entity_id: sensor.11_cwu
      - type: entity
        children: []
        entity_id: sensor.12_zw
      - type: entity
        children: []
        entity_id: sensor.12_cwu
      - type: entity
        children: []
        entity_id: sensor.12a_zw
      - type: entity
        children: []
        entity_id: sensor.12a_cwu
      - type: entity
        children: []
        entity_id: sensor.adm_zw
      - type: entity
        children: []
        entity_id: sensor.adm_cwu
      - type: remaining_child_state
        childern: []
        entity_id: sensor.adapr_na_1_licznik_glowny
        name: Discrepancy
type: custom:sankey-chart
energy_date_selection: true
min_state: 0
show_names: true
show_icons: false
title: Wodociągi
wide: false
sort_by: state

Lines are missing/incomplete because the main water meter is less than the sum of all. A remaining_child_state in the first section can show this. You can also group apartments in a middle section with a remaining_child_state for each. Passthrough is not what you want.
Check the examples in the README and earlier in this thread to learn how the remaining types work as they are not simple to explain.

Thank you, I think achieve what I want regarding discrapnecy.

Difference at source of 22 liters is on minus then assume no water leak and diff is due to speed of update, the main water is update every 10 sec and rest every 5 min therefore end water meters consumption can assign to next hours, data for HA energy is updated every 1h.

Questions:

No 1. Is possible show the same daily data but no need wait to whole hour for update energy data but display for "now? If now is is 16:35 then current data for today is showing from 0:00 to 16:00. Is possible show from 0:00 to now=16:35?

No 2. How achieve about what I wrote earlier (show each apartments water consumption on graph as total hot+cold in one section and in next section as is now so divided into hot and cold water separately?

layout: horizontal
height: 500
unit_prefix: ''
round: 3
convert_units_to: ''
min_box_size: 10
min_box_distance: 6
show_states: true
show_units: true
sections:
  - entities:
      - entity_id: sensor.adapr_na_1_licznik_glowny
        type: remaining_child_state
        childern: []
        name: Discrepancy
        color: red
        children:
          - sensor.1_zw
          - sensor.2_zw
          - sensor.2_cwu
          - sensor.3_zw
          - sensor.3_cwu
          - sensor.4_zw
          - sensor.4_cwu
          - sensor.5_zw
          - sensor.5_cwu
          - sensor.6_zw
          - sensor.7_zw
          - sensor.7_cwu
          - sensor.8_zw
          - sensor.8_cwu
          - sensor.9_zw
          - sensor.9_cwu
          - sensor.10_zw
          - sensor.10_cwu
          - sensor.11_zw
          - sensor.11_cwu
          - sensor.12_zw
          - sensor.12_cwu
          - sensor.12a_zw
          - sensor.12a_cwu
          - sensor.adm_cwu
          - sensor.adm_zw
      - entity_id: sensor.adapr_na_1_licznik_glowny
        type: entity
        color_on_state: true
        name: Main water meter
        icon: mdi:account
        children:
          - sensor.1_zw
          - sensor.2_zw
          - sensor.2_cwu
          - sensor.3_zw
          - sensor.3_cwu
          - sensor.4_zw
          - sensor.4_cwu
          - sensor.5_zw
          - sensor.5_cwu
          - sensor.6_zw
          - sensor.7_zw
          - sensor.7_cwu
          - sensor.8_zw
          - sensor.8_cwu
          - sensor.9_zw
          - sensor.9_cwu
          - sensor.10_zw
          - sensor.10_cwu
          - sensor.11_zw
          - sensor.11_cwu
          - sensor.12_zw
          - sensor.12_cwu
          - sensor.12a_zw
          - sensor.12a_cwu
          - sensor.adm_cwu
          - sensor.adm_zw
  - entities:
      - type: entity
        children: []
        entity_id: sensor.1_zw
        color_on_state: true
      - type: entity
        children: []
        entity_id: sensor.2_zw
      - type: entity
        children: []
        entity_id: sensor.2_cwu
      - type: entity
        children: []
        entity_id: sensor.3_zw
      - type: entity
        children: []
        entity_id: sensor.3_cwu
      - type: entity
        children: []
        entity_id: sensor.4_zw
      - type: entity
        children: []
        entity_id: sensor.4_cwu
      - type: entity
        children: []
        entity_id: sensor.5_zw
      - type: entity
        children: []
        entity_id: sensor.5_cwu
      - type: entity
        children: []
        entity_id: sensor.6_zw
      - type: entity
        children: []
        entity_id: sensor.7_zw
      - type: entity
        children: []
        entity_id: sensor.7_cwu
      - type: entity
        children: []
        entity_id: sensor.8_zw
      - type: entity
        children: []
        entity_id: sensor.8_cwu
      - type: entity
        children: []
        entity_id: sensor.9_zw
      - type: entity
        children: []
        entity_id: sensor.9_cwu
      - type: entity
        children: []
        entity_id: sensor.10_zw
      - type: entity
        children: []
        entity_id: sensor.10_cwu
      - type: entity
        children: []
        entity_id: sensor.11_zw
      - type: entity
        children: []
        entity_id: sensor.11_cwu
      - type: entity
        children: []
        entity_id: sensor.12_zw
      - type: entity
        children: []
        entity_id: sensor.12_cwu
      - type: entity
        children: []
        entity_id: sensor.12a_zw
      - type: entity
        children: []
        entity_id: sensor.12a_cwu
      - type: entity
        children: []
        entity_id: sensor.adm_zw
      - type: entity
        children: []
        entity_id: sensor.adm_cwu
      - type: remaining_child_state
        childern: []
        entity_id: sensor.adapr_na_1_licznik_glowny
        name: Discrepancy
type: custom:sankey-chart
energy_date_selection: true
min_state: 0
show_names: true
show_icons: false
title: Wodociągi
wide: false
sort_by: state

BR, Krzysiek

Very happy with my new dashboard :wink:

I’m trying to use the section min_width key to force my chart to go vertical when the total width is insufficient (e.g. mobile) and generally tighten up the entire layout. The following configuration works fine without the min_width:150 line, but I get this error with it:

    - type: custom:stack-in-card
      mode: vertical
      cards:
        - type: custom:sankey-chart
          energy_date_selection: true
          # layout: horizontal
          round: 1
          min_state: 0.05
          height: 400
          wide: true
          show_names: true
          show_states: true
          show_units: false
          unit_prefix: k # Displayed units and decimal placement
          sections:
            min_width: 150
            ### Energy Sources
            - entities:
.
.
.

I usually am able to figure out any .yaml shenanigans, but I cannot seem to get this one configured right. Anything standing out to anyone?

You have min_width on the wrong level. It should have the aame indentation as entities. And it should be after entities or take the dash from entities