Anyone using the Sankey Chart Card?

thanks for the heads up, that was alot easier than trying to work out the add_entites or subtract_entities options.

Would you mind sharing your config please, that’s what I’m trying to achieve

Sure this the code for my dashboard. This is for a GivEnergy battery system, so might be quite different for another manufacturer.

GivEnergy gives the following sensors:
Grid to Battery
Grid to House
Solar to House
Solar to Battery
Solar to Grid
Battery to House
Battery to Grid

I then had to create the following summed entities:
GridAll
- Grid to Battery
- Grid to House
SolarAll
- Solar to House
- Solar to Battery
- Solar to Grid
BatteryAll
- Battery to House
- Battery to Grid

MyGrid
- Solar to Grid
- Battery to Grid
MyHouse
- Grid to House
- Solar to House
- Battery to House
MyBattery
- Grid to Battery
- Solar to Battery

height: 500
unit_prefix: k
round: 1
min_box_height: 10
min_box_distance: 5
show_states: true
show_units: true
sections:
  - entities:
      - type: entity
        children:
          - sensor.ma9_um_solar2house
          - sensor.ma9_um_solar2battery
          - sensor.ma9_um_solar2grid
        entity_id: sensor.ma9_um_solarall
        name: Solar
        color: orange
      - type: entity
        children:
          - sensor.ma9_um_grid2battery
          - sensor.ma9_um_grid2house
        entity_id: sensor.ma9_um_gridall
        name: Grid
        color: red
  - entities:
      - type: entity
        entity_id: sensor.ma9_um_solar2house
        children:
          - sensor.ma9_um_myhouse
        name: To House
        color: orange
      - type: entity
        entity_id: sensor.ma9_um_solar2battery
        children:
          - sensor.ma9_um_mybattery
        name: To Battery
        color: orange
      - type: entity
        entity_id: sensor.ma9_um_solar2grid
        children: []
        color: green
        name: Export
      - type: entity
        entity_id: sensor.ma9_um_grid2house
        children:
          - sensor.ma9_um_myhouse
        name: To House
        color: red
      - type: entity
        entity_id: sensor.ma9_um_grid2battery
        children:
          - sensor.ma9_um_mybattery
        name: To Battery
        color: red
  - entities:
      - type: passthrough
        children:
          - sensor.ma9_um_myhouse
        entity_id: sensor.ma9_um_myhouse
        name: House
      - type: entity
        children:
          - sensor.ma9_um_myhouse
          - sensor.ma9_um_battery2grid
          - BatteryLeft
        entity_id: sensor.ma9_um_mybattery
        name: Battery
        color: purple
  - entities:
      - type: entity
        children:
          - office_today
          - kitchen_today
          - house_other
          - sensor.tv_master_today_s_consumption
          - sensor.tv_speakers_today_s_consumption
          - sensor.myenergi_eddi_xxxxxxxx_energy_used_today
          - sensor.ma9_um_givenergy_losses
        entity_id: sensor.ma9_um_myhouse
        name: House
      - type: remaining_parent_state
        children: []
        entity_id: BatteryLeft
        name: Battery Left
        color: purple
      - type: entity
        entity_id: sensor.ma9_um_battery2grid
        children: []
        color: Green
        name: Export
    sort_by: state
  - entities:
      - type: remaining_child_state
        children:
          - sensor.office_computers_monitors_xbox_today_s_consumption
          - sensor.office_2_today_s_consumption
        entity_id: office_today
        name: Office
      - type: remaining_child_state
        children:
          - sensor.fridge_today_s_consumption
          - sensor.dishwasher_today_s_consumption
          - sensor.washing_machine_today_s_consumption
        entity_id: kitchen_today
        name: Kitchen
      - type: passthrough
        children:
          - sensor.tv_master_today_s_consumption
        entity_id: sensor.tv_master_today_s_consumption
        name: TV Master
      - type: passthrough
        children:
          - sensor.tv_speakers_today_s_consumption
        entity_id: sensor.tv_speakers_today_s_consumption
        name: TV Lounge
      - type: passthrough
        children:
          - sensor.myenergi_eddi_xxxxxxxx_energy_used_today
        entity_id: sensor.myenergi_eddi_xxxxxxxx_energy_used_today
        name: Eddi
      - type: remaining_parent_state
        children: []
        entity_id: house_other
        name: Other
      - type: Entity
        children: []
        entity_id: sensor.ma9_um_givenergy_losses
        name: System Losses
        color: red
    sort_by: state
  - entities:
      - type: entity
        children: []
        entity_id: sensor.office_computers_monitors_xbox_today_s_consumption
        name: Monitors
      - type: entity
        children: []
        entity_id: sensor.office_2_today_s_consumption
        name: Computers
      - type: entity
        children: []
        entity_id: sensor.fridge_today_s_consumption
        name: Fridge
      - type: entity
        children: []
        entity_id: sensor.dishwasher_today_s_consumption
        name: Dishwasher
      - type: entity
        children: []
        entity_id: sensor.washing_machine_today_s_consumption
        name: Washing Machine
      - type: entity
        children: []
        entity_id: sensor.tv_master_today_s_consumption
        name: TV Master
      - type: entity
        children: []
        entity_id: sensor.tv_speakers_today_s_consumption
        name: TV Lounge
      - type: entity
        children: []
        entity_id: sensor.myenergi_eddi_xxxxxxxx_energy_used_today
        name: Eddi
    sort_by: state
type: custom:sankey-chart
show_names: true
wide: true
min_state: 0.1
show_icons: false
energy_date_selection: false
1 Like

Thanks, that works great

Hello, who can help me fix the error?
I’ve tried everything but I keep having problems.
This error:
RangeError: Maximum call stack size exceeded

height: 400
unit_prefix: k
round: 1
min_box_height: 7
min_box_distance: 5
show_states: true
show_units: true
sections:
  - entities:
      - type: entity
        children:
          - sensor.p1_meter_total_power_export
          - totaal
        entity_id: sensor.envoy_122241000712_today_s_energy_production
        color: var(--warning-color)
        name: Totaal zon
      - type: entity
        children:
          - totaal
        entity_id: sensor.p1_meter_total_power_import_t1
        add_entities:
          - sensor.p1_meter_total_power_import_t2
        name: Total import
    sort_group_by_parent: false
  - entities:
      - type: remaining_parent_state
        children:
          - keuken
          - was & droger
          - warmtepomp
          - kantoor voor
          - onbekend
        entity_id: totaal
        name: Totaal gebruikt
      - type: entity
        children: []
        entity_id: sensor.p1_meter_total_power_export
    sort_group_by_parent: false
  - entities:
      - type: remaining_parent_state
        children:
          - sensor.quooker_energy
        entity_id: keuken
      - type: remaining_parent_state
        children:
          - sensor.3d_printer_energy
        entity_id: kantoor voor
      - type: remaining_parent_state
        children:
          - sensor.energie_warmtepomp_buitendeel_energy
          - sensor.energie_warmtepomp_element_energy
        entity_id: warmtepomp
      - type: remaining_parent_state
        children:
          - sensor.droger_switch_0_current
        entity_id: was & droger
      - type: remaining_parent_state
        entity_id: onbekend
    sort_group_by_parent: false
  - entities:
      - type: entity
        children: []
        entity_id: sensor.quooker_energy
      - type: entity
        children: []
        entity_id: sensor.3d_printer_energy
      - type: entity
        children: []
        entity_id: sensor.energie_warmtepomp_buitendeel_energy
      - type: entity
        children: []
        entity_id: sensor.energie_warmtepomp_element_energy
      - type: entity
        children: []
        entity_id: sensor.droger_switch_0_current
    sort_group_by_parent: false
energy_date_selection: true
type: custom:sankey-chart
show_names: true
wide: true
min_state: 0
show_icons: false

Has anyone experimented with using this card together with auto-entities?

In your third section you have 5 remaining_parent_state entities. This doesn’t make sense. You probably want them to be remaining_child_state

1 Like

One thing I fell foul of here is using the min/max helper to do this. It won’t work with the energy dashboard connection, so had to create them with template sensors, they had to have state_class: total, the min/max helper set it to measurement

LE: Sorry, figured it out myself after doing some more reading of the documentation.

Hi all. It’s been discussed a few posts above, but I am still trying to figure out if there’s a way to avoid creating additional entities/helpers. Basically I am trying something like this:

  - entities:
      - type: entity
        children:
          - sensor.1
          - sensor.2
        entity_id: sensor.1
        add_entities:
          - sensor.2
        name: Energy

So trying to sum two sensors and then split them back into the two components. I was expecting it won’t work to put a sensor as it’s own child, but is there any workaround? Thanks.

New question, couldn’t figure it out by myself this time.


Any explanation about why at the top the gradient is reverted? All the other below are transitioning from blue to the ‘destination’ color. For the fist one, it’s exactly the opposite. Thanks!

This is a bug that I haven’t been able to reproduce. If you can help with that, please add any info you can to Parent/Child colors reversed · Issue #96 · MindFreeze/ha-sankey-chart · GitHub

Hi. Is it possible to set the height to change according to total amount of watt? I have screenroom for a long chart on height. But that means that it doesnt show well if 1000w is going through the system or 5000w, its still as long filling the entire card.

Is it possible to have it scale to a set watt for height? So 8000w will max out the size at around 700px

There is no option for static scale but you can kind of hack it. The biggest section dictates the scale. So if you create a template sensor with 8000w and put it in a dedicated section (probably first or last section) then all the smaller entities in the other sections will scale relative to these 8000w.
This fake sensor doesn’t need to be connected to any others and has take up a section.
You can put it in the last section with color: tranparent and no name. If you also set the card to wide: true you might not notice it.

1 Like

Clever! Could create a helper in watts perhaps. Ill try it out. Thx

It kind of works, but i cant hide name and value or make it transparent?

The color value is straight CSS so you should be able to make it transparent. Maybe try rgba(0,0,0,0).
The name is completely under your control in HA since it is a template sensor. You can set it to an empty spqce or something.
There is no easy way to hide the state though. The only thing I can think of is using card-mod and hiding it with CSS. :first-child ....
You can also submit a feature request for fixed scale in GitHub. I don’t have much time to work on this card but this should be easy

1 Like

Ill try. I made a request on GitHub. Would love the feature because this chart is amazing visualization

Yes, I found the same issue after I had posted that note. Took me awhile to work out why it wasn’t working.

Hi Mirek, do you have separate sensors for all 3 phases, or do you somehow calculate it? I only have a total power consumption from my meter but I do have instantaneous voltage and current for each phase. I’m trying to calculate it but it’s a bit tricky. Thanks. Awesome chart.

Kuba, I use Shelly 3EM, so I have 3 separate readings for power consumption per phase. The only calculated part is small part marked as External on the chart; this one is for separate garage building, that is connected to main power source before I can measure consumption. So it is calculated based on consumption of individual devices and their states, using Powercalc integration.