Anyone using the Sankey Chart Card?

@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…

3 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

4 Likes

Awesome! thx. its working now.

1 Like

Just starting to play with this amazing looking card, but not getting the fill in effect and flow displaying. I’ve tweaked my sensors so that they’re all in a similar range of each other, in case the line couldn’t be drawn because of huge variation in value, but I can’t get it to display the flows.

type: custom:sankey-chart
show_names: true
unit_prefix: k
round: 1
wide: true
sections:
  - entities:
      - entity_id: sensor.givtcp_ce2209g009_pv_power
        name: Solar
        color: var(--warning-color)
        children:
          - sensor.givtcp_ce2209g009_pv_energy_today_kwh
      - entity_id: sensor.givtcp_ce2209g009_grid_power
        name: Grid
        children:
          - sensor.givtcp_ce2209g009_import_energy_today_kwh
      - entity_id: sensor.givtcp_ce2209g009_battery_power
        name: Battery
        colora: var(--success-color)
        children:
          - sensor.givtcp_ce2209g009_battery_throughput_today_kw
  - entities:
      - entity_id: sensor.kitchen_fridge_current_energy
        name: Kitchen Fridge
      - entity_id: sensor.garage_fridge_current_energy
        name: Kitchen Fridge

@Fayrewood wherever you have a sensor listed as a child, you also have to list it again under a subsequent -entities and - entity_id:. Also, it doesn’t look like you have your fridges listed as children anywhere, so you’ll need to add those in as children under one of the other entities.

2 Likes

Hi Tom.
This is a fantastic (!) layout and exactly what I’m trying to establish. Are each of the cards in the screenshot above a separate sankey card in the dashboard view, or is it a single sankey card with code?

One Sankey card and the others are mini-graph cards.

Has anyone worded out how to use the remaining_child/parent options in the recent update?

I’ve been banging my head against it for hours getting nowhere.

This used to work (3rd section):

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.self_solar_consumption_daily
              - sensor.energy_to_grid_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'

I found that I had to add the remaining_parent_state as an entity:

type: custom:sankey-chart
title: Strømforbruk denne måned
show_names: true
show_icons: false
unit_prefix: k
round: 1
wide: true
height: 300
min_box_height: 10
sections:
  - entities:
      - entity_id: sensor.monthly_net_consumption
        name: Totalforbruk
        color: var(--warning-color)
        children:
          - sensor.vvb_manedsforbruk
          - sensor.avfukter_manedsforbruk
          - sensor.vp_maned_kwh
          - sensor.elbillading_manedsforbruk
          - sensor.varmekabel_bad_maned
          - sensor.nettverk_manedsforbruk
          - sensor.tv_manedsforbruk
          - sensor.servere_manedsforbruk
          - Annet
  - entities:
      - entity_id: sensor.vvb_manedsforbruk
        name: Varmtvann
      - entity_id: sensor.avfukter_manedsforbruk
        name: Avfukter
      - entity_id: sensor.vp_maned_kwh
        name: Varmepumpe
      - entity_id: sensor.elbillading_manedsforbruk
        name: Elbillading
      - entity_id: sensor.varmekabel_bad_maned
        name: Varmekabel Bad
      - entity_id: sensor.nettverk_manedsforbruk
        name: Nettverk
      - entity_id: sensor.tv_manedsforbruk
        name: TV
      - entity_id: sensor.servere_manedsforbruk
        name: Servere
      - entity_id: Annet
        type: remaining_parent_state
        name: Annet

BTW, “Annet” is just Norwegian for “Other”

1.0.0 Live power consumption - remaining not working?

Hi, the new way of using “Other” is working fine for me in the Sankey charts where I use data mainly from Utility Meters.
However, I have one chart with live consumption where the remaining is always redicculously low. It’s the one named “Annet” in the attachment.
I have noticed the one from VP (heatpump) is in kWh/h while the rest are in kW, but I tried removing it and it did not change the others (“Annet”) bit.

Skjermbilde 2022-10-27 kl. 11.26.00

type: custom:sankey-chart
title: Strømforbruk live
show_names: true
show_icons: false
unit_prefix: k
round: 1
wide: true
height: 200
min_box_height: 10
sections:
  - entities:
      - entity_id: sensor.power
        name: Totalforbruk
        color: var(--warning-color)
        children:
          - sensor.varmtvannsbereder_switch_0_power
          - sensor.shellyplug_XXXX_power
          - sensor.varmepumpe_watt
          - sensor.YYYYY_power
          - sensor.bad_power
          - sensor.shellyplug_ZZZZZ_power
          - sensor.shellyplug_s_XYXY_power
          - sensor.shellyplug_s_XYZXYZ_power
          - Annet
  - entities:
      - entity_id: sensor.varmtvannsbereder_switch_0_power
        name: Varmtvann
      - entity_id: sensor.shellyplug_XXXX_power
        name: Avfukter
      - entity_id: sensor.varmepumpe_watt
        name: VP
      - entity_id: sensor.YYYYY_power
        name: Elbillading
      - entity_id: sensor.bad_power
        name: VK Bad
      - entity_id: sensor.shellyplug_ZZZZZ_power
        name: Nettverk
      - entity_id: sensor.shellyplug_s_XYXY_power
        name: TV
      - entity_id: sensor.shellyplug_s_XYZXYZ_power
        name: Servere
      - entity_id: Annet
        type: remaining_parent_state
        name: Annet

Actually, yeah that is what I am seeing too. I thought it was that only the last section worked but the common factor seems to be power:

Hi everyone. I am the creator of the card and just discovered this thread.
As expected there is some problem with the new calculations since v1 . I am working on reproducing it

12 Likes