Anyone using the Sankey Chart Card?

I finally figured out what I did wrong: under children I had - entity_id: sensor.idrac_host1_powerconsumption when I really should have had just - sensor.idrac_host1_powerconsumption. It’s working now that I’ve fixed that.

Here’s the fixed version (still a work in progress though):

type: custom:sankey-chart
title: Power
show_names: true
min_box_height: 20
sections:
  - entities:
      - entity_id: sensor.breaker_panel_power_meter
        name: Total
        remaining:
          name: Other
        children:
          - sensor.pool_pump_power_meter
          - sensor.washing_machine_power_meter_meter
  - entities:
      - entity_id: sensor.washing_machine_power_meter
        name: Washer
      - entity_id: sensor.pool_pump_power_meter
        name: Network Rack
        children:
          - sensor.idrac_host1_powerconsumption
          - sensor.idrac_host2_powerconsumption
          - sensor.idrac_host3_powerconsumption
        remaining:
          name: Other
  - entities:
      - entity_id: sensor.idrac_host1_powerconsumption
        name: Host 1
      - entity_id: sensor.idrac_host2_powerconsumption
        name: Host 2
      - entity_id: sensor.idrac_host3_powerconsumption
        name: Host 3

After update to 0.11.0 card stopped to display any chart and in editor view I get error:
image
No clue what is might mean… Any help, please?
EDIT: OK, I found a clue. Now children needs to be specified in separate line. E.g. instead of

children: sensor.some_device

It has to be:

children:
  - sensor.some_device

It worked fine in previous versions.

This has not changed, it was always a list:

The only thing that changed was the description: https://github.com/MindFreeze/ha-sankey-chart/commit/089c319775a03cd297d9c9f04c9957ee9d9baf12

The requirement just became stricter I guess.

OK, i played with new skip section function and it is nice… though not always working as expected. Here are my observations and few screenshots where representing different outcomes. So, I made some section skip on the very bottom part of card, making it stright from section 1 to 5. Not exactly what I expected. While I understand some ‘waviness’ as card is trying to redistribute available space between connections on each level (and this is fine), more troublesome result is visible in section 4, where connections are unnecessarily crossing each other. I guess that is because card is somehow randomly building dummy entries to supplement missing data on specific section level, perhaps starting from the very first section (so later on these are showing higher on the list)…

Adding intermediate step solves this issue, but at the expense of having this additional block strictly defined.

Strangely moving this skip block one section further causes issue to reapear. Again card drawing first strictly defined blocks and then adding dummy one:

So definitely this requires some play to have it done properly :slight_smile:

Another question, would it be possible to implement somehow section skip funtionality for remaining values? As you can see on my screenshots I have in section 3 quite significant element with remaining and woul dbe nice to display it directly in the very last section. Now to make it it would be necessary to create another virtual sensor that would calculate this value and to place it last section… just an idea…
Otherwise; I really love this card! It adds so much spark to data visualization in HA!

1 Like

You’re asking in the wrong place. The developer is not here.

Try asking here Issues · MindFreeze/ha-sankey-chart · GitHub

Also how are your external loads not powered from one of your three phases?

I’m using Sheely 3EM to measure energy consumption, but unfortunatelly I did not have enough space to install it next to main grid connection (or rather I have not enough space to install clamps), instead it is installed in main fuses box inside the house. That means that connection to garage (which is other building) is made before place where I can make measurements. So external represents everything that is installed in garage or powered from garage building. Technically it is one of these 3 phases, but Im just not capturing consumption on this part of installation. As such I’m using Powercalc to estimate consumption there.

2 Likes

Just installed the card and I have an issue with the child entities:
The code used is as follows:

       - type: custom:sankey-chart
         show_names: true
         sections:
           - entities:
             - entity_id: sensor.counter_appt_overall_power_l2
               children:
                 - sensor.bw_br_washer_power
                 - sensor.bw_corridor_meas_power
           - entities:
             - sensor.bw_kitchen_coffeemachine_power
             - sensor.bw_kitchen_dishwasher_power

What is shows is only the parent entity like on screenshot, others are ignored. Maybe somebody can advice what can cause this?
зображення

@tom_I Would you like to share your code for your card? It looks really nice.

Because your level 2 section entities are different than one specified as children in section 1…
Though it is a biot strange, as they SHOULD show, but disconnected from section one sensor…
:man_shrugging:

I use the Sidebar view option for the extra width and I also use the Sankey chart card inside an entities card (using custom hui-element) so that the theme matches my other cards. Otherwise the native title option of the Sankey card would require extensive card-mod work as it does not follow the same structure as the core cards.

Power:

type: entities
title: Power Distribution
entities:
  - type: custom:hui-element
    card_type: custom:sankey-chart
    show_names: true
    height: 300
    round: 2
    unit_prefix: k
    wide: true
    sections:
      - entities:
          - entity_id: sensor.grid_power
            name: Solar Power
            color: '#e0b400'
            children:
              - sensor.metering_power_supplied
              - sensor.solar_power_consumed
      - entities:
          - entity_id: sensor.solar_power_consumed
            name: Solar Power Consumption
            color: '#e0b400'
            children:
              - sensor.total_power_consumed
          - entity_id: sensor.metering_power_supplied
            name: Solar Power to Grid
            color: '#8353d1'
          - entity_id: sensor.metering_power_absorbed
            name: Grid Power Consumption
            children:
              - sensor.total_power_consumed
            color: '#e45e65'
      - entities:
          - entity_id: sensor.total_power_consumed
            name: Total Power Consumption
            remaining:
              name: Unmonitored
            children:
              - sensor.known_loads
            color: '#ff8000'
      - entities:
          - entity_id: sensor.known_loads
            name: Monitored Loads
            children:
              - sensor.bar_fridge_power
              - sensor.cinema_av_power
              - sensor.cinema_subwoofer_power
              - sensor.comms_rack_power
              - sensor.dishwasher_power
              - sensor.downstairs_heat_pump_power
              - sensor.electric_blanket_power
              - sensor.electronics_bench_power
              - sensor.fridge_power
              - sensor.hot_water_power
              - sensor.led_table_power
              - sensor.lounge_av_power
              - sensor.lounge_dehumidifier_power
              - sensor.mechanical_bench_power
              - sensor.pc_monitor_power
              - sensor.pi3b_power
              - sensor.rack_fan_power
              - sensor.rumpus_dehumidifier_power
              - sensor.spb_electric_blanket_power
              - sensor.upstairs_heat_pump_power
              - sensor.washing_machine_power
              - sensor.workshop_chargers_power
            color: '#039BE5'
      - entities:
          - sensor.bar_fridge_power
          - sensor.cinema_av_power
          - sensor.cinema_subwoofer_power
          - sensor.comms_rack_power
          - sensor.dishwasher_power
          - sensor.downstairs_heat_pump_power
          - sensor.electric_blanket_power
          - sensor.electronics_bench_power
          - sensor.fridge_power
          - sensor.hot_water_power
          - sensor.led_table_power
          - sensor.lounge_av_power
          - sensor.lounge_dehumidifier_power
          - sensor.mechanical_bench_power
          - sensor.pc_monitor_power
          - sensor.pi3b_power
          - sensor.rack_fan_power
          - sensor.rumpus_dehumidifier_power
          - sensor.spb_electric_blanket_power
          - sensor.upstairs_heat_pump_power
          - sensor.washing_machine_power
          - sensor.workshop_chargers_power

Energy:

type: entities
title: Daily Energy Distribution
entities:
  - type: custom:hui-element
    card_type: custom:sankey-chart
    show_names: true
    height: 300
    round: 2
    unit_prefix: k
    wide: true
    sections:
      - entities:
          - entity_id: sensor.energy_from_grid_daily_peak
            name: Grid Peak Energy Used
            color: '#488fc2'
            children:
              - sensor.energy_imported_daily_total
          - entity_id: sensor.energy_from_grid_daily_offpeak
            name: Grid Offpeak Energy Used
            color: '#2f5f82'
            children:
              - sensor.energy_imported_daily_total
          - entity_id: sensor.energy_inverter_daily
            name: Solar Energy Produced
            color: '#ff9800'
            children:
              - sensor.energy_to_grid_daily
              - sensor.self_solar_consumption_daily
      - entities:
          - entity_id: sensor.energy_imported_daily_total
            name: Daily Imported Total
            children:
              - sensor.energy_consumed_daily_total
          - entity_id: sensor.self_solar_consumption_daily
            name: Self Consumed Solar
            color: '#ff9800'
            children:
              - sensor.energy_consumed_daily_total
          - entity_id: sensor.energy_to_grid_daily
            name: Solar Energy Exported
            color: '#8353d1'
      - entities:
          - entity_id: sensor.energy_consumed_daily_total
            name: Total Energy Used
            color: '#488FC2'
            remaining:
              name: Unmonitored
            children:
              - sensor.bar_fridge_daily_energy
              - sensor.cinema_av_daily_energy
              - sensor.comms_rack_daily_energy
              - sensor.dishwasher_daily_energy
              - sensor.electronics_bench_daily_energy
              - sensor.fridge_daily_energy
              - sensor.energy_downstairs_heat_pump_daily
              - sensor.energy_hot_water_daily_peak
              - sensor.energy_hot_water_daily_offpeak
              - sensor.led_table_daily_energy
              - sensor.lounge_av_daily_energy
              - sensor.lounge_dehumidifier_daily_energy
              - sensor.electric_blanket_daily_energy
              - sensor.mechanical_bench_daily_energy
              - sensor.pc_monitor_daily_energy
              - sensor.rack_fan_daily_energy
              - sensor.rumpus_dehumidifier_daily_energy
              - sensor.spb_electric_blanket_daily_energy
              - sensor.cinema_subwoofer_daily_energy
              - sensor.energy_upstairs_heat_pump_daily_peak
              - sensor.energy_upstairs_heat_pump_daily_offpeak
              - sensor.washing_machine_daily_energy
              - sensor.workshop_chargers_daily_energy
      - entities:
          - entity_id: sensor.bar_fridge_daily_energy
            name: Bar Fridge
            color: '#039BE5'
          - entity_id: sensor.cinema_av_daily_energy
            name: Cinema AV Gear
            color: '#039BE5'
          - entity_id: sensor.comms_rack_daily_energy
            name: Comms Rack
            color: '#039BE5'
          - entity_id: sensor.dishwasher_daily_energy
            name: Dishwasher
            color: '#039BE5'
          - entity_id: sensor.electronics_bench_daily_energy
            name: Electronics Bench
            color: '#039BE5'
          - entity_id: sensor.fridge_daily_energy
            name: Fridge
            color: '#039BE5'
          - entity_id: sensor.energy_downstairs_heat_pump_daily
            name: Downstairs Heat Pump
            color: '#039BE5'
          - entity_id: sensor.energy_hot_water_daily_peak
            name: Hot Water (Peak)
            color: '#039BE5'
          - entity_id: sensor.energy_hot_water_daily_offpeak
            name: Hot Water (Offpeak)
            color: '#039BE5'
          - entity_id: sensor.led_table_daily_energy
            name: LED Table
            color: '#039BE5'
          - entity_id: sensor.lounge_av_daily_energy
            name: Lounge AV Gear
            color: '#039BE5'
          - entity_id: sensor.lounge_dehumidifier_daily_energy
            name: Lounge Dehumidifier
            color: '#039BE5'
          - entity_id: sensor.electric_blanket_daily_energy
            name: Master Bedroom Elect Blanket
            color: '#039BE5'
          - entity_id: sensor.mechanical_bench_daily_energy
            name: Mechanical Bench
            color: '#039BE5'
          - entity_id: sensor.pc_monitor_daily_energy
            name: PC Monitor
            color: '#039BE5'
          - entity_id: sensor.rack_fan_daily_energy
            name: Rack Fan
            color: '#039BE5'
          - entity_id: sensor.rumpus_dehumidifier_daily_energy
            name: Rumpus Dehumidifier
            color: '#039BE5'
          - entity_id: sensor.spb_electric_blanket_daily_energy
            name: Spare Bedroom Elec Blanket
            color: '#039BE5'
          - entity_id: sensor.cinema_subwoofer_daily_energy
            name: Subwoofer
            color: '#039BE5'
          - entity_id: sensor.energy_upstairs_heat_pump_daily_peak
            name: Upstairs Heat Pump (Peak)
            color: '#039BE5'
          - entity_id: sensor.energy_upstairs_heat_pump_daily_offpeak
            name: Upstairs Heat Pump (Offpeak)
            color: '#039BE5'
          - entity_id: sensor.washing_machine_daily_energy
            name: Washing Machine
            color: '#039BE5'
          - entity_id: sensor.workshop_chargers_daily_energy
            name: Workshop Chargers
            color: '#039BE5'
4 Likes

Thanks, that provided sufficient clues on the card code structure. Now it works!

@tom_l Thanks

1 Like

2 new questions:

  1. can we name children? Didn’t find anything
  2. this is my config:
type: custom:sankey-chart
show_names: true
height: 400
round: 2
wide: true
sections:
  - entities:
      - entity_id: sensor.shelly_3em_power_total
        name: Watt_total
        remaining:
          name: Other
        children:
          - sensor.espressomaschine_power
          - sensor.server_power
          - sensor.heizung_strom_power
          - sensor.studio_power_2
          - sensor.kuhlmess_power
          - sensor.freezer_power
          - sensor.tv_power
          - sensor.trockner_power
          - sensor.spulmaschine_power
          - sensor.wallbox_watt
  - entities:
      - entity_id: sensor.server_power
        name: Server
        remaining:
          name: Other
        children:
          - sensor.ups_watt
  - entities:
      - sensor.espressomaschine_power
      - sensor.server_power
      - sensor.heizung_strom_power
      - sensor.studio_power_2
      - sensor.kuhlmess_power
      - sensor.freezer_power
      - sensor.tv_power
      - sensor.trockner_power
      - sensor.spulmaschine_power
      - sensor.wallbox_watt

works fine in general, but not the children part. sensor.ups_watt should be a child of sensor.server_power, but the “remaining” “other” part is never shown. Instead it looks like this

.

Is it because sensor.ups_watt is not a sensor, but a template? (excuse me if using the wrong nomenclature). Everywhere else sensor.ups_watt works fine.
in configuration.yaml it is defines like this:

  - sensor:
    - name: "UPS_Watt"
      unique_id: UPS_Watt
      state: >-
        {{ (states('sensor.myups_output_voltage')|float(0) * states('sensor.myups_output_current')|float(0))}}
      unit_of_measurement: W
      device_class: power
      state_class: measurement

I think everything that is listed under children needs to also be listed again later under an - entities. That should also let you name the children.

3 Likes

Really like this card as well!
Only thing I am struggling is with the coulouring scheme. Could anyone give me a hint how to use it?
I am used to Hex, RGB or CMYK, but never encountered this (var--xyz) scheme…

You don’t have to use that format for the color - you can stick to the simpler color: blue type settings. If you want a more specific color or only colors in certain circumstances then you can get fancier with it.

1 Like

Those are color variables defined in the theme.yaml. Here is example f this file content:

  dark-background: "#1C1E2E"        #var(--dark-background)
  medium-background: "#242635"      #var(--medium-background)
  light-background: "#2C2E3C"       #var(--light-background)
  components-background: "#242635"  #var(--components-background)
  bright-text: "#ffffff"            #var(--bright-text)
  dimmed-text: "#A4A7B4"            #var(--dimmed-text)
  dark-text: "#444856"              #var(--dark-text)
  cyan-text: "#1bbfff"              #var(--cyan-text)
  alert-text: "#CD1015"             #var(--alert-text)

The first column shows actual definitions of different interface components, the second one displays as comment variable to be used to use specific color in the UI. For this matter you can define in your theme additional colors, that are not specific to UI elements, but also can be used same way. Here is sample of color palette I’m using in my theme:

  orange1: "#F5A624"
  orange2: "#DBBC09"
  orange3: "#AB6D09"
  orange4: "#784E07"
  orange5: "#452F05"
  orange6: "#121003"

Please note that not all cards accpt variables as color definition, though…

2 Likes

Thanks a lot! Now I understand the sysstem.

Did anyone got it working with the children naming?
Tried it with different options via the children part or in the entities part, but nothing seems to work (or is miss something).

For example:

children:
          - sensor.shellyplug01_power
            name: test plug
          - sensor.shellyplug02_power
          - sensor.shellyplug03_power
          - sensor.shellyplug04_power
          - sensor.shellyplug05_power
  - entities:
      - sensor.shellyplug01_power
        name: test plug
      - sensor.shellyplug02_power
      - sensor.shellyplug03_power
      - sensor.shellyplug04_power
      - sensor.shellyplug05_power

The names will always go under the - entity_id: sensor.my_sensor.

Here’s my current config, hopefully it’ll be a bit clearer:

type: custom:sankey-chart
title: Realtime Power
show_names: true
min_box_height: 8
sections:
  - entities:
      - entity_id: sensor.breaker_panel_electric_consumption_w
        name: Total
        children:
          - sensor.network_rack_electric_consumption_w
          - sensor.cam_plug_power
          - sensor.washer_electric_consumption_w
          - sensor.smart_bulbs_power
        remaining:
          name: All Others
  - entities:
      - entity_id: sensor.washer_electric_consumption_w
        name: Washer
      - entity_id: sensor.network_rack_electric_consumption_w
        name: Network Rack
        children:
          - sensor.idrac_host1_powerconsumption
          - sensor.idrac_host2_powerconsumption
          - sensor.idrac_host3_powerconsumption
        remaining:
          name: Other Network
      - entity_id: sensor.cam_plug_power
        name: Driveway Cam
      - entity_id: sensor.smart_bulbs_power
  - entities:
      - entity_id: sensor.idrac_host1_powerconsumption
        name: Host 1
      - entity_id: sensor.idrac_host2_powerconsumption
        name: Host 2
      - entity_id: sensor.idrac_host3_powerconsumption
        name: Host 3

3 Likes