Anyone using the Sankey Chart Card?

You seem to have a custom font with an increased size. The card adjusts the font size dynamically but it can’t know that you changed the base font size.

Thanks for the answer, I was able to arrange it.

I am trying to understand now how to apply what in the picture. Do you have an idea?

Hi Homeotte41, how did you manage to have all the entities represented with same final height independently from the power draw? (eg. Metekast 106W as big as Deurbel 7W)
Thank you in advance
Regards from Italy

Looks good :slight_smile: Would you mind sharing your code?

It is probably min_box_height parameter set to larger value to match text height, so smaller values are stretched to similar size as larger one. If you look carefully on the chart you will see that left side and middle boxes of around +300W are already bigger…, so not really the same size.

I don’t think it is too interesting, but here it is, I use sum sensors for the totals of rooms:

YAML
type: custom:sankey-chart
show_names: true
show_icons: true
height: 700
round: 0
min_state: 1
sections:
  - entities:
      - entity_id: sensor.meterkast_slimme_meter_active_power_import
        name: Import
        color: green
        children:
          - sensor.basis_stroommeters_totaal_power
          - mysterie
  - entities:
      - entity_id: sensor.basis_stroommeters_totaal_power
        name: Gemeten
        children:
          - sensor.badkamer_totaal_power
          - sensor.berging_totaal_power
          - sensor.eettafel_totaal_power
          - sensor.gang_totaal_power
          - sensor.kamertje_totaal_power
          - sensor.kantoor_totaal_power
          - sensor.keuken_totaal_power
          - sensor.living_totaal_power
          - sensor.meterkast_stekker_ups_power
          - sensor.wc_totaal_power
      - entity_id: mysterie
        type: remaining_parent_state
        name: Mysterie
        color: grey
        icon: mdi:help-network
  - entities:
      - entity_id: sensor.badkamer_totaal_power
        name: Badkamer
        children:
          - sensor.badkamer_stekker_stereo_power
          - sensor.badkamer_fan_power
          - sensor.badkamer_schakelaar_licht_power
          - sensor.badkamer_schakelaar_fan_switch_0_power
          - sensor.badkamer_schakelaar_stopcontact_boven_power
      - entity_id: sensor.berging_totaal_power
        name: Berging
        children:
          - sensor.berging_stekker_cv_power
          - sensor.berging_stekker_droger_power
          - sensor.berging_stekker_wasmachine_power
      - entity_id: sensor.gang_totaal_power
        name: Gang
        children:
          - sensor.gang_kapstok_schakelaar_licht_power
          - sensor.gang_kapstok_schakelaar_stopcontact_power
      - entity_id: sensor.eettafel_totaal_power
        name: Eettafel
        children:
          - sensor.eettafel_schakelaar_power
      - entity_id: sensor.kamertje_totaal_power
        type: passthrough
        children:
          - sensor.kamertje_schakelaar_licht_power
      - entity_id: sensor.kantoor_totaal_power
        name: Kantoor
        children:
          - sensor.kantoor_stekker_bureaulift_en_usb_power
          - sensor.kantoor_stekker_laptop_power
          - sensor.kantoor_stekker_stereo_power
          - sensor.kantoor_stekker_scherm_power
          - sensor.kantoor_stekker_printer_power
      - entity_id: sensor.keuken_totaal_power
        name: Keuken
        children:
          - sensor.keuken_stekker_ijskast_power
          - sensor.keuken_stekker_airfryer_power
          - sensor.keuken_stekker_vaatwasser_power
          - sensor.keuken_schakelaar_stopcontact_aanrecht_power
          - sensor.living_schakelaar_schilderij_switch_1_power
          - living_remaining_power
      - entity_id: sensor.living_totaal_power
        name: Living
        children:
          - sensor.living_stekker_computer_power
          - sensor.living_stekker_fotoprinter_power
          - sensor.living_stekker_wifi_repeater_power
          - sensor.living_stekker_groot_scherm_power
          - sensor.living_stekker_stereo_power
          - sensor.living_stekker_subwoofer_links_power
          - sensor.living_stekker_subwoofer_rechts_power
          - sensor.living_stekker_lamp_zen_power
          - sensor.living_stekker_lamp_botta_power
          - sensor.living_stekker_lamp_laura_power
          - sensor.living_stekker_lamp_nesso_power
          - sensor.living_stekker_lamp_noce_power
          - living_remaining_power
      - entity_id: sensor.meterkast_stekker_ups_power
        name: Meterkast UPS
        color: purple
        children:
          - sensor.meterkast_stekker_server_power
          - sensor.meterkast_stekker_router_power
          - sensor.meterkast_stekker_harde_schijf_power
          - ups_remaining_power
      - entity_id: sensor.wc_totaal_power
        type: passthrough
        children:
          - sensor.wc_schakelaar_licht_power
  - entities:
      - entity_id: sensor.badkamer_stekker_stereo_power
        name: Stereo
        color: red
      - sensor.badkamer_fan_power
      - sensor.badkamer_schakelaar_licht_power
      - sensor.badkamer_schakelaar_fan_switch_0_power
      - sensor.badkamer_schakelaar_stopcontact_boven_power
      - entity_id: sensor.berging_stekker_cv_power
        name: CV
        color: red
      - entity_id: sensor.berging_stekker_droger_power
        name: Droger
        color: red
      - entity_id: sensor.berging_stekker_wasmachine_power
        name: Wasmachine
        color: red
      - entity_id: sensor.eettafel_schakelaar_power
        name: Eettafel
        color: yellow
      - entity_id: sensor.gang_kapstok_schakelaar_licht_power
        name: Gang licht
        color: yellow
      - entity_id: sensor.gang_kapstok_schakelaar_stopcontact_power
        name: Stopcontact
        color: purple
      - entity_id: sensor.kantoor_stekker_scherm_power
        name: Scherm
        color: red
      - entity_id: sensor.kantoor_stekker_bureaulift_en_usb_power
        name: Bureaulift en USB
        color: purple
      - entity_id: sensor.kantoor_stekker_laptop_power
        name: Laptop
        color: red
      - entity_id: sensor.kantoor_stekker_stereo_power
        name: Stereo
        color: red
      - entity_id: sensor.kantoor_stekker_printer_power
        name: Printer
        color: red
      - entity_id: sensor.kamertje_schakelaar_licht_power
        name: kamertje licht
        color: yellow
      - entity_id: sensor.keuken_stekker_ijskast_power
        name: Ÿskast
        color: red
      - entity_id: sensor.keuken_stekker_airfryer_power
        name: Airfryer
        color: red
      - entity_id: sensor.keuken_stekker_vaatwasser_power
        name: Vaatwasser
        color: red
      - entity_id: sensor.keuken_schakelaar_stopcontact_aanrecht_power
        name: Aanrecht
        color: purple
      - entity_id: sensor.living_schakelaar_schilderij_switch_1_power
        name: Licht
        color: yellow
      - entity_id: sensor.living_stekker_computer_power
        name: Computer
        color: red
      - entity_id: sensor.living_stekker_fotoprinter_power
        name: Fotoprinter
        color: red
      - entity_id: sensor.living_stekker_wifi_repeater_power
        name: Wifi repeater
        color: red
      - entity_id: sensor.living_stekker_groot_scherm_power
        name: Groot scherm
        color: red
      - entity_id: sensor.living_stekker_stereo_power
        name: Stereo
        color: red
      - entity_id: sensor.living_stekker_subwoofer_links_power
        name: Subwoofer links
        color: red
      - entity_id: sensor.living_stekker_subwoofer_rechts_power
        name: Subwoofer rechts
        color: red
      - entity_id: sensor.living_stekker_lamp_zen_power
        name: Zen
        color: yellow
      - entity_id: sensor.living_stekker_lamp_botta_power
        name: Botta
        color: yellow
      - entity_id: sensor.living_stekker_lamp_laura_power
        name: Laura
        color: yellow
      - entity_id: sensor.living_stekker_lamp_nesso_power
        name: Nesso
        color: yellow
      - entity_id: sensor.living_stekker_lamp_noce_power
        name: Noce
        color: yellow
      - entity_id: living_remaining_power
        type: remaining_parent_state
        name: Mysterie
        color: grey
      - entity_id: sensor.meterkast_stekker_server_power
        name: Server
        color: red
      - entity_id: sensor.meterkast_stekker_router_power
        name: Router
        color: red
      - entity_id: sensor.meterkast_stekker_harde_schijf_power
        name: Harde schijf
        color: red
      - entity_id: ups_remaining_power
        type: remaining_parent_state
        name: UPS
        color: grey
      - entity_id: sensor.wc_schakelaar_licht_power
        name: WC licht
        color: yellow

1 Like

Did you find a way out of this loop? I’m stuck in the same problem.

Hi,
Can anybody give any pointers? I just can’t figure out why it is showing like that. I’ve taken the simple example and modified it to display something. But as you can see the top edge gets cropped out.

The only cropping I see is on the smallest label. Looks you have a custom font that confuses the scaling of the label. Increasing min_box_height might help. Or changing the font

1 Like

It’s the fact that your work power is so narrow top to bottom compares to the other items. Op is building the line for the card proportional to the rest of the usage bars and stuffing the text inside - shrinking it to some minimum text pitch. At some point it just starts to cut stuff off. (the icon property there does the same thing)

It may be being aggrivated with the fact that particular entry is at the top of the list and getting cut off. What happens I you change sort order of that set with

- sort_by: state
  sort_direction: asc
1 Like

Right you are. Thank you very much. Indeed the work_power W value was very low. For the sake of mind just removed it and it displayed nicely. The sort_by is also nice.
Thanks again.

I have a strange problem for a few days now, Sankey shows very high values of consumed energy, only on the last few days (like 700 times more than normal).
In the energy panel, however, everything appears correctly.

I’ve been having a strange problem for a few days. The sankey chart is showing very high energy consumption values, only for the last few days (about 700/800 times the normal amount).
However, the energy panel shows everything correctly.

Example day when the data matches:


Example of when the data is completely different, in the energy panel, there are the usual 5 kWh of consumption, not 3211 kWh as indicated in Sankey :scream:


Has anyone else had this type of problem?

This is the configuration:

Riepilogo
  - title: Suddivisione energia
    path: suddivisione_energia
    type: sidebar
    badges: []
    cards:
      - type: energy-date-selection
      - height: 400
        unit_prefix: k
        round: 2
        min_box_height: 3
        min_box_distance: 5
        show_states: true
        show_units: true
        sections:
          - entities:
              - type: entity
                remaining:
                  name: Altro
                children:
                  - sensor.shellyem_055fbd_channel_2_energy
                  - sensor.potenza_istantanea_varie_utenze_energy
                entity_id: sensor.shellyem_055fbd_channel_1_energy
          - entities:
              - type: entity
                children: []
                name: Elettrodomestici cucina
                entity_id: sensor.shellyem_055fbd_channel_2_energy
              - type: entity
                remaining:
                  name: Altro
                children:
                  - sensor.interruttori_e_switch_iot_energy
                  - sensor.balcone_camera_energy
                  - sensor.balcone_cucina_energy
                  - sensor.balcone_salotto_energy
                  - sensor.balcone_soggiorno_energy
                  - sensor.luce_camera_destra_energy
                  - sensor.camera_ingresso_energy
                  - sensor.camera_pianoforte_energy
                  - sensor.luce_camera_sinistra_energy
                  - sensor.divano_destro_energy
                  - sensor.divano_sinistro_energy
                  - sensor.faretti_cucina_energy
                  - sensor.luce_soggiorno_energy
                  - sensor.scrivania_energy
                  - sensor.tavolo_cucina_energy
                entity_id: sensor.potenza_istantanea_varie_utenze_energy
          - entities:
              - type: entity
                children: []
                entity_id: sensor.interruttori_e_switch_iot_energy
              - sensor.balcone_camera_energy
              - sensor.balcone_cucina_energy
              - sensor.balcone_salotto_energy
              - sensor.balcone_soggiorno_energy
              - sensor.luce_camera_destra_energy
              - sensor.camera_ingresso_energy
              - sensor.camera_pianoforte_energy
              - sensor.luce_camera_sinistra_energy
              - sensor.divano_destro_energy
              - sensor.divano_sinistro_energy
              - sensor.faretti_cucina_energy
              - sensor.luce_soggiorno_energy
              - sensor.scrivania_energy
              - sensor.tavolo_cucina_energy
            sort_by: state
        type: custom:sankey-chart
        show_names: true
        min_state: 0
        wide: true
        energy_date_selection: true

I have exactly the same issue… But it’s only for today’s values. I have the chart connected to the energy period selector/date picker and previous days’ entries, or the weekly or monthly displays, are all OK

Same for me as well. Seem to happen to entities that have reset to been unavailable for a while. No way to fix it too. On the energy graph looks okay

1 Like

I have two utility meters monitoring my grid consumption because we switch to a higher tarrif after a certain consumption on high use months. (they’re both parents of the main meter so total consumption between the two should = total)

When mine switches between the two the energy graph gets completely jacked up like this for a day then stabilizes

Hey, folks.
I have grid connection with off-peak, part-peak and peak rated (created utility meters) and solar which contributes to power generation via grid-tie inverter - use solar and the remaining from the grid.

I’m trying to achieve something like this:
image

This is where I am at now …

  - type: custom:sankey-chart
    height: 200
    unit_prefix: k
    round: 2
    show_names: true
    wide: true
    min_state: 0
    min_box_height: 3
    min_box_distance: 5
    show_states: true
    show_units: true
    sections:
      - entities:
          - type: entity
            entity_id: sensor.grid_consumption_1d
            name: PG&E
            color: blue
            children:
              - sensor.daily_grid_utility_off_peak
              - sensor.daily_grid_utility_part_peak
              - sensor.daily_grid_utility_peak
          - type: entity
            entity_id: sensor.sonoff_1001d8c166_energy
            name: Solar
            color: var(--warning-color)
            children:
              - sensor.sonoff_1001d8c166_energy
      - entities:
          - type: entity
            entity_id: sensor.daily_grid_utility_peak
            color: red
            name: Peak
            children:
              - sensor.sonoff_1001640d33_energy
              - sensor.sonoff_1001640d17_energy
              - sensor.sonoff_1001641b02_energy
              - sensor.sonoff_1001640d19_energy
              - sensor.sonoff_1001640e98_energy
              - sensor.sonoff_100147e66e_energy
              - sensor.daily_tesla_home_charging
              - sensor.daily_wall_light
          - type: entity
            entity_id: sensor.daily_grid_utility_part_peak
            color: pink
            name: Park-Peak
            children:
              - sensor.sonoff_1001640d33_energy
              - sensor.sonoff_1001640d17_energy
              - sensor.sonoff_1001641b02_energy
              - sensor.sonoff_1001640d19_energy
              - sensor.sonoff_1001640e98_energy
              - sensor.sonoff_100147e66e_energy
              - sensor.daily_tesla_home_charging
              - sensor.daily_wall_light
          - type: entity
            entity_id: sensor.daily_grid_utility_off_peak
            color: purple
            name: Off-Peak
            children:
              - sensor.sonoff_1001640d33_energy
              - sensor.sonoff_1001640d17_energy
              - sensor.sonoff_1001641b02_energy
              - sensor.sonoff_1001640d19_energy
              - sensor.sonoff_1001640e98_energy
              - sensor.sonoff_100147e66e_energy
              - sensor.daily_tesla_home_charging
              - sensor.daily_wall_light
          - type: passthrough
            entity_id: sensor.sonoff_1001d8c166_energy
            name: Solar
            color: var(--warning-color)
            children:
              - sensor.sonoff_1001640d33_energy
              - sensor.sonoff_1001640d17_energy
              - sensor.sonoff_1001641b02_energy
              - sensor.sonoff_1001640d19_energy
              - sensor.sonoff_1001640e98_energy
              - sensor.sonoff_100147e66e_energy
              - sensor.daily_tesla_home_charging
              - sensor.daily_wall_light
      - entities:
          - type: entity
            entity_id: sensor.sonoff_1001640d33_energy
            name: Dishwasher
            color: grey
          - type: entity
            entity_id: sensor.sonoff_1001640d17_energy
            name: Fridge
            color: grey
          - type: entity
            entity_id: sensor.sonoff_1001641b02_energy
            name: Microwave
            color: grey
          - type: entity
            entity_id: sensor.sonoff_1001640d19_energy
            name: Instant Boiler
            color: grey
          - type: entity
            entity_id: sensor.sonoff_1001640e98_energy
            name: Projector
            color: grey
          - type: entity
            entity_id: sensor.sonoff_100147e66e_energy
            name: Washer
            color: grey
          - type: entity
            entity_id: sensor.daily_tesla_home_charging
            name: Tesla
            color: grey
          - type: entity
            entity_id: sensor.daily_wall_light
            name: Wall Light
            color: grey
          - type: remaining_parent_state
            entity_id: sensor.blank_blank
            name: Other
            color: grey

At the end of the day I see the off-peak, part-peak and peak lines going to the fridge only.
Others are only showing off-peak.
No connections to solar.
Any suggestion on how to fix it?
Thanks in advance.

What you want is strange. You don’t know exactly which devices use peak vs offpeak vs solar, so connecting them directly would show false connections.
See the examples in the Readme. You want to combine all the sources first in something like ‘consumption’ and connect that to the various consumers.

Yes, it looks like the problem is when a sensor becomes unavailable for a while. I’ve noticed that the problem always happens when I turn off Home Assistant at night (usually from 11:00 PM to 6:00 AM). If it stays on all night, the problem doesn’t happen.

Mine runs 24/7. :thinking:

Off-peak, part-peak and peak are based on time of the day. So if the device runs at specific time of the day, the graph should capture kWh belonging to that time of the day and hence the tariff… Same goes for the solar.
At least that’s my take on it.