GithubHelp home page GithubHelp logo

mindfreeze / ha-sankey-chart Goto Github PK

View Code? Open in Web Editor NEW
348.0 4.0 15.0 2.26 MB

A Home Assistant lovelace card to display a sankey chart. For example for power consumption

License: MIT License

JavaScript 2.70% TypeScript 97.30%
lovelace-card home-assistant energy-consumption

ha-sankey-chart's People

Contributors

amaximus avatar emufan avatar github-actions[bot] avatar madsciencetist avatar mindfreeze avatar misa1515 avatar ngommers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ha-sankey-chart's Issues

Manage total_increasing energy sensor

Is your feature request related to a problem? Please describe.
I managed energy consumption with different sensors which value is increasing, no daily reset. This works fine with Energy dashboard but not with the card.

Describe the solution you'd like
By able to manage delta of the value between to time that could be defined. Remaining could highlight rest of energy not identified (I don't have smartplug everywhere)

Describe alternatives you've considered
Create for each sensor a related utiliy_meter sensor but it's like duplicate data, which I don't like

Add example configuration to readme

Is your feature request related to a problem? Please describe.
I was playing around with this card and it took me some time before I got the configuration right.

Describe the solution you'd like
I think it would have helped there was an example to reference. For example the configuration of the card used to get the image in the readme. That way I could see the configuration and relate to how it looks in the picture.

Describe alternatives you've considered
I just kept trying and it worked out in the end

Additional context
Nothing else to add.

Alignment and sorting of entities

Thanks for the great work on this card, found it today and it can really provide some cool insights.

Is your feature request related to a problem? Please describe.
I put together a chart with it as a mock, and there's a couple of enchancements I'd like to see:

  1. Ability to autosort entities based on value(say, highest to lowest) instead of the current discrete order, for a given level. Say, if I have a chart with Grid/Power source -> Rooms -> categories -> individual items, I might want to keep the sources and rooms in the same order, but i might want the categories or individual items to be sorted by value instead.

  2. Have the abiliy to display an entity on a lower level, if that makes sense?
    Going with the previous example:
    Grid/Power source -> Rooms -> categories -> individual items

Within a room I have categories "Electronics" , and then have 2 individual devices, "steambox" and "light". "steambox" is a child of "electronics", but "light" is orphan within Rooms.
I would like to have the option to display the "light" entity at the same level as "steambox", without having to create an additional sensor for the category.

Describe the solution you'd like
It could be a good idea to have the option to autosort the entities by their value within a specific level of the chart.

Additional context
screenshot example for point 2.
https://i.imgur.com/WUwhICp.png

Thanks!

Show missing parent state

Spin off from #2

Similar to remaining/unaccounted state in children, it would be useful to see unaccounted parent state.

Ok to use for real-time statistics?

I just implemented your really great card to show real-time Power Usage and it works great! So thank you!
But that got me thinking: Is it ok to use it for that? Or am I gonna end with a messed up system? Pretty new to HA
image
Or would it be better to wait for the throttling feature?

Add space between number and unit

Hey,

first of all - awesome card! Just found it yesterday and already in love with it!

One little thing would make it perfect for me - could you add a space between the numbers and the units? Would be cleaner to read for me, e.g. "1287 kWh" instead of "1287kWh".

Kind regards,
Klaus

Option to Hide Unit of Measurement

Is your feature request related to a problem? Please describe.
I don't believe this is currently supported. It would be awesome if you could chose to supress the display of the unit of measurement label.

Currently....

[value] [unit of measurement] [entity name] e.g. 10W Light

becomes...

[value] [entity name] e.g. 10 Light

My rationale for this is two fold:

  1. All the same unit; if I'm displaying things of the same type they all have the same units, therefore I'm happy to know what the unit is and don't need to display it on each entity
    For example, I've got 40+ zigbee devices and want to use their link quality, don't see why I need to repeat the words "link quality" on each line
  2. I've got mixed descriptions of unit but are essentially the same thing so displaying the unit of measurement can be confusing
    For example, the PiHole integration provides entities dns cached (expressed as "queries"), dns forwarded (expressed as "queries") and blocked (expressed as "ads") - these sum to the of total dns queries (expressed as "queries"). So I have unit of measurements of queries and ads representing the same thing

Describe the solution you'd like
A new option in the configuration of:
Name hide_unit
Type boolean
Requirement Optional
Default false
Description Hide the units of measurements

Describe alternatives you've considered
I could create template sensors to replicate those I wish to display without a unit of measurement. This obviously increases the maintenance and number of sensors etc. etc.

Additional context
Add any other context or screenshots about the feature request here.

Entity more info pop-up no longer available

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
0.6.4
Last working release (if known):

Browser and Operating System:
Firefox 93.0 Windows 10
Safari (HA Companion App), iOS 15.5

Description of problem:

I can no longer click on entity names in the Sankey graph to get the more info pop-up for the entity.

Javascript errors shown in the web inspector (if applicable):


Additional information:

Prefix/space + font size

Would be great to set a real prefix in front of the unit. I would like to set a blank, because for me it is hard to read, if the unit is directly after the number.

And it would be great if I can set the font size of the descriptions as well. Same for font-color and font-decoration. I would like to unset italic, but have it e.g. in grey and smaller. ๐Ÿ˜Ž

Not all branch connectors get rendered

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
0.6.3

Last working release (if known):

Browser and Operating System:
Chrome 101.0.4951.67 on Windows 10

Description of problem:
Not all branch connectors get rendered.

The config does not show branch connector between RF433 and Wemo1:

      - type: custom:sankey-chart
        show_names: true
        show_icons: true
        min_box_height: 40
        wide: true
        height: 300
        sections:
          - entities:
              - entity_id: sensor.mqtt
                children:
                  - sensor.dep_wemo_d1_1
                  - sensor.dep_nodemcu
              - entity_id: sensor.dep_sonoff_rf433
                children:
                  - sensor.dep_wemo_d1_1
          - entities:
              - entity_id: sensor.dep_nodemcu
                children:
                  - sensor.dep_garage_door
                  - sensor.dep_sonoff_zigbee
              - entity_id: sensor.dep_wemo_d1_1
                children:
                  - sensor.dep_lifting_pump
                  - sensor.dep_irrigation_control
          - entities:
              - sensor.dep_garage_door
              - sensor.dep_sonoff_zigbee
              - sensor.dep_lifting_pump
              - sensor.dep_irrigation_control

tree

Javascript errors shown in the web inspector (if applicable):


Additional information:

Auto config for energy dashboard

In theory the card can be auto configured for energy with the data from the energy dashboard.

The most basic resulting config would be ${energy sources} -> ${individual consumers} with probably a sum in the middle.

An even better config would group the consumers by area as well. So:
${energy sources} -> ${total consumed} -> ${areas from HA} -> ${individual consumers}

  • config sources and devices
  • add areas
  • output generated config
  • unit tests

Minimal Font Size

Is your feature request related to a problem? Please describe.
Hi, it's possible to set the minimal font size?
I love your Sankey Graph, but i can't read everything

Describe the solution you'd like
Set minimal font size or a custom parameter in each entity
Additional context
Add any other context or screenshots about the feature request here.
image

Connecting lines across columns appear incorrectly sorted.

  • [Y] I updated to the latest version available
  • [Y] I cleared the cache of my browser

Release with the issue: 0.11.0
Browser and Operating System: Windows 11, Chrome and Edge

This could be my configuration but I am unable to figure out why the connecting lines of the children of lounge power jump above items in the 4th column when their entries are after and only present in the 5th column.

The 4 children (AV Left, AV Right, Rear Sonos, Sub) of Lounge power are the last entities in the 5th column and thier parent is the last in the 2nd column.

II also note that the Remaining Switches amount has duplicated it's self magically to the 5th column, which is actually awesome but for some reason The Remaining Misc does not. Perhaps the Switches behavior is a bug, but it would be great to configure this.

Here is my configuration:

`type: custom:sankey-chart
show_names: true
round: 1
height: 400
wide: true
sections:

  • entities:
    • entity_id: sensor.sockets_power
      name: Sockets
      children:
      • sensor.office_power
      • sensor.lounge_power
      • sensor.outlet_outside_power_meter
  • entities:
    • entity_id: sensor.office_power
      name: Office
      children:
      • sensor.outlet_office_bookcase_power_meter
      • sensor.outlet_office_power_meter
      • sensor.outlet_front_xmas_power_meter
      • sensor.outlet_network_current_consumption
    • entity_id: sensor.lounge_power
      children:
      • sensor.outlet_av_left_power_meter
      • sensor.outlet_av_right_power_meter
      • sensor.tapo_2_current_energy
      • sensor.outlet_dining_wall_power_meter
    • entity_id: sensor.outlet_outside_power_meter
      name: Outside
  • entities:
    • entity_id: sensor.outlet_office_bookcase_power_meter
      name: Bookcase
      remaining: Misc
      children:
      • sensor.outlet_window_ups_current_consumption
      • sensor.outlet_dep_pc_current_energy
    • entity_id: sensor.outlet_network_current_consumption
      name: Network
      remaining: Switches
      children:
      • sensor.outlet_office_av_power_meter
  • entities:
    • entity_id: sensor.outlet_window_ups_current_consumption
      name: UPS
      remaining: Modems ?
      children:
      • sensor.outlet_stacker_current_energy
      • sensor.outlet_monitors_current_consumption
  • entities:
    • entity_id: sensor.outlet_stacker_current_energy
      name: PC
    • entity_id: sensor.outlet_monitors_current_consumption
      name: Monitors
    • entity_id: sensor.outlet_dep_pc_current_energy
      name: Desk
    • entity_id: sensor.outlet_office_av_power_meter
      name: NUC
    • entity_id: sensor.outlet_office_power_meter
      name: Office AV
    • entity_id: sensor.outlet_front_xmas_power_meter
      name: Mac Desk
    • entity_id: sensor.outlet_av_left_power_meter
      name: AV Left
    • entity_id: sensor.outlet_av_right_power_meter
      name: AV Right
    • entity_id: sensor.tapo_2_current_energy
      name: Rear Sonos
    • entity_id: sensor.outlet_dining_wall_power_meter
      name: Sub
      `

image

Component overwrites global hass state

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:

Last working release (if known):

Browser and Operating System:

Description of problem:

The component overwrites global hass object state cause wrong values to be displayed in all dialogs.

I think this lone is the (or one of) culprit.

states[id].state = String(stats[id]);

Javascript errors shown in the web inspector (if applicable):


Additional information:

Ability to highlight the connectors related to the entity under the mouse cursor

When I mouseover an entity, it will be nice to see the paths connected to its parent and children in a brighter color. This will be useful for charts with lots of entities with low values, which make it hard to see what its parents and children are.

A second iteration of this feature would be the ability to highlight not just the parent and children, but also its grandparents and grandchildren, so that we can trace what affects the entity and what the entity affects all the way down the line.

For example, mouseover on my Fridge entity will highlight the following:

image

Not enough documentaion detail for child / parent remaining configuration

I've had to revert to the last version as I have no idea how this (3rd section) should now be configured. Not for the lack of trying.

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'
    card_mod:
      class: inline-card-no-border
card_mod:
  class: top-level-card

manually set location for children

Describe the solution you'd like
Possible to set box distance for children
If the first child have same position as parent it could maybe solve it

sankey
sankeynew

Rounding to 0 decimals?

Hi,

I have my set up with round: 0, however I have some entities showing with a single decimal.

Some of my lights will report sometimes a residual 0.4W or 0.1W, I was hoping to dismiss them by using "round: 0", however it does not seem to be working? Ie, them keep showing on my chart despite the rounding being set to 0.

Thanks,

allow custom icons in sankey-chart

The sankey-chart can show icons (option "show_icons: yes"), but it uses the default ones from the entity. I'd like to use different icons with the chart, configuration could look like the following:

sections:
  - entities:
      - entity_id: sensor.total_dc_power
        name: PV
        icon: mdi:solar-power      <----
        color: yellow
        children:
          - sensor.load

Would it please be possible to integrate this?
Regards, Uli

Set height size in percent

Is your feature request related to a problem? Please describe.
There are issues using it on mobile, where the screen height is different.

Describe the solution you'd like
the diagram will scale vertically depending on the size of the screen

Describe alternatives you've considered
Instead of using absolute pixel size, it would be nice to have a percent. allow for either absolute or relative heights in the configuration.

Additional context

Ability to show Discrepancies / Unknown / Unaccounted entities

When there are two sets of values in two columns sourced from separate sensors, it is inevitable that there will be discrepancies.

For example, if I have my own calculations of the estimated total energy use and also have the smart meter reading from my electric company, the two values will likely not add up. It will be helpful sometimes to have the ability to show that discrepancy as a branch without the need to create another template sensor for that discrepancy.

Describe the solution you'd like
It would be probably be something along the lines of...

sections:
  - entities:
      - entity_id: sensor.total_energy_use_on_fossil_fuel
        name: Fossil Fuel
        children:
          - sensor.total_energy_use
      - entity_id: sensor.total_energy_use_on_renewables
        name: Renewables
        children:
          - sensor.total_energy_use
  - entities:
      - entity_id: sensor.total_energy_use
        name: Est. Total
        children:
          - sensor.a_plug_smartenergy_metering
          - sensor.d_plug_smartenergy_metering
      show_discrepancies: true
      discrepancies_name: Unknown Appliances
  - entities:
      - entity_id: sensor.a_plug_smartenergy_metering
      - entity_id: sensor.d_plug_smartenergy_metering

Describe alternatives you've considered
The alternative is to create template sensors of all the discrepancy values, which is a workable solution, but sometimes feel redundant. Besides, it wouldn't work if the discrepancy is sometimes a negative number.

Thank you! The chart looks awesome๐Ÿ˜

Connections are somehow randomly drawn

I'm not sure, if it is a bug or working as designed, but the connections are somehow with random high on target side

image

Some are too thin, some not there in total and it seems, that it is thinner and thinner per section from top to bottom. (each color is here a group of child's from entities before.

Feature Request: Card title

Is your feature request related to a problem? Please describe.
No problem

Describe the solution you'd like
Can we have a card title?

Describe alternatives you've considered
Nil.

Additional context
Please use the standard Lovelace styling for the title.

Is possible to change COLOR in if else condition?

I want to change colour of entity depending on condition.
For example:
- entity_id: sensor.power_fv2grid
name: FV to Grid
color: >-
{% if (states('sensor.power_fv2grid')|float > 0) %} green
{% else %} red
{% endif %}
children:
- sensor.power_house

Tried this code, no errors, but not working.
Any suggestions?

Make section width configurable

Is your feature request related to a problem? Please describe.
Currently sections are evenly divided over the available width. This doesn't always produce the best results, because some sections need more space than others.

Describe the solution you'd like
I would like sections to get a width property where width can be configured as a percentage.

Describe alternatives you've considered
I do not this there is another way to achieve this.

Wide option didn't effect

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue: v0.11.0

Last working release (if known):

Browser and Operating System: Chrome Version 104.0.5112.101 @win10 / HA official client @iOS 15.4.1

Description of problem:
Wide option didn't effect, empty space still in the right side (purple area).
https://imgur.com/a/jmTBOWD

Javascript errors shown in the web inspector (if applicable):


Additional information:

Support for battery

Our house is equipped with multiple (small) solar inverters as well as a central battery and I'm having trouble integrating the battery power in the chart.
When the battery is loading the entity values are positive. If it's discharging the values are negative.
Since the sun was kind enough to reveal itself for some minutes in the last days, I noticed the chart does not seem to handle negative values; and even if, I'm not sure how to integrate the battery in the chart.
Current state:
If I put the consumers as children behind the battery, it seems like the power is flowing into the battery and directly leaves it again. If the battery is discharged (negative values) it's not visible at all.

Expected state:
I put children behind the battery. If the value for battery is positive, the energy only flows into the battery pretends it has no children. If the value for the battery is negative, the children get energy from the battery, but no energy is flowing into the battery.

Color based on entity state

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Support for coloring entiies based on their state. This could be set on entity object level.

Describe the solution you'd like
A clear and concise description of what you want to happen.
I was thinking of creating a dependency graph (if possible, otherwise a tree) between the different entities.
E.g. heating in a room depends on the Zigbee temperature sensor that depends on the Zigbee-wifi bridge that depends on MQTT. Other sensors also depend on the zigbe-mqtt, etc.:

mqtt - device_tracker.zigbee_bridge - sensor.zb_temp ----- climate.heat
                                 \ \ sensor.zb_door_window /
                                  \ sensor.zb_water_leak

So if a device/entity in this dependency graph fails this card could be used to make it visible what other entities are affected. Most visibly the color based on state could do that.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
none yet, I just found this card today.

Additional context
Add any other context or screenshots about the feature request here.

Wildcard and filter support

Is your feature request related to a problem? Please describe.
Not a problem. It would just be nice to be able to use wildcards, similar to auto-entities.

e.g.
sensor.*_power

Describe the solution you'd like
Support for wildcards such as
entities: sensor.*_power

and filters such as
area: garden

Describe alternatives you've considered
Using auto-entities card, but not sure if that even works with Sankey card and it would be nicer to have this as an integrated feature.

Additional context

Remaining object does not show when one of the entities has a value of 0

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
core-2022.8.0
Last working release (if known):
n/a
Browser and Operating System:
Firefox & Chrome on Windows 10, HA mobile app

Description of problem:
The remaining object does not show when one of the child entities has a value of 0. In the following example, the entity sensor.washing_machine_power_meter_meter has a value of 0w. The remaining object does not show. If that particular entity is either commented out, or made to have a value above 0, the remaining object will appear.

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: All Others
        children:
          - sensor.pool_pump_power_meter
          - sensor.office_big_light_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 Network
      - entity_id: sensor.office_big_light_power_meter
        name: Driveway Cam
  - 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

Screenshot of the Sankey chart with child sensor.washing_machine_power_meter_meter having a value of 0, note the 'All Others' remaining object is missing:
image
Screenshot of the Saneky chart with child sensor.washing_machine_power_meter_meter removed/commented out, note the 'All Others' remaining object is present:
image

Javascript errors shown in the web inspector (if applicable):


Additional information:

Graph messed up

Checklist:

  • [ x] I updated to the latest version available
  • [ x] I cleared the cache of my browser

Release with the issue:
v1.5.2

Last working release (if known):

Browser and Operating System:
Latest Chrome on latest MacOS

Description of problem:

Graph is messed up. The lights part in section 3

Screenshot 2023-01-02 at 16 34 32

lovelace yaml:

type: custom:sankey-chart
show_names: true
energy_date_selection: null
height: 500
unit_prefix: k
sections:
  - entities:
      - entity_id: sensor.total_main_energy_1
        children:
          - sensor.phase_1_energy
          - sensor.phase_2_energy
          - sensor.phase_3_energy
        name: Total Grid
        remaining:
          name: Other
  - entities:
      - entity_id: sensor.phase_1_energy
        name: Phase 1
        children:
          - sensor.heat_pump_phase_1_energy
          - sensor.downstairs_wc_mirror_lights_energy
          - sensor.downstairs_wc_ceiling_lights_energy
          - sensor.sauna_wahing_room_lights_energy
          - sensor.sauna_lights_energy
          - sensor.bathroom_lights_energy
          - sensor.bathroom_lights_energy_2
          - sensor.matu_s_room_lights_dimmer_energy
          - sensor.bedroom_lights_energy
          - sensor.marlon_s_room_lights_energy
          - sensor.pergola_lightning_energy
          - sensor.outdoor_kitchen_lights_energy
          - sensor.washing_machine_energy
          - sensor.dryer_energy
          - sensor.ev_charger_energy_3
          - sensor.stair_hallway_ceiling_lights_energy
          - sensor.2nd_floor_lobby_lights_energy
          - sensor.stair_lights_energy
          - sensor.wardrobe_lights_switch_0_energy
          - sensor.wardrobe_lights_switch_1_energy
        remaining:
          name: Other
      - entity_id: sensor.phase_2_energy
        name: Phase 2
        children:
          - sensor.heat_pump_phase_2_energy
          - sensor.garage_lights_energy
          - sensor.front_entrance_outdoor_lights_energy
          - sensor.majaesine_ouevalgus_energy
          - sensor.back_yard_outdoor_lightning_energy
          - sensor.balcony_lights_energy
          - sensor.hw_circulation_pump_device_energy
        remaining:
          name: Other
      - entity_id: sensor.phase_3_energy
        name: Phase 3
        children:
          - sensor.heat_pump_phase_3_energy
          - sensor.living_room_lights_energy
          - sensor.kitchen_ceiling_lights_electric_consumption_kwh
          - sensor.kitchen_island_lights_energy
          - sensor.dining_table_lights_electric_consumption_kwh_3
          - sensor.pool_pump_energy
          - sensor.home_dc_energy
          - sensor.hallway_lights_energy
        remaining:
          name: Other
  - entities:
      - entity_id: sensor.heat_pump_phase_1_energy
        name: Heat Pump Phase 1
        children:
          - sensor.heat_pump_energy
      - entity_id: sensor.heat_pump_phase_2_energy
        name: Heat Pump Phase 2
        children:
          - sensor.heat_pump_energy
      - entity_id: sensor.heat_pump_phase_3_energy
        name: Heat Pump Phase 3
        children:
          - sensor.heat_pump_energy
  - entities:
      - entity_id: sensor.heat_pump_energy
        type: passthrough
        children:
          - sensor.heat_pump_energy
      - entity_id: sensor.heat_pump_energy
        name: Heat Pump
      - entity_id: sensor.downstairs_wc_mirror_lights_energy
        name: WC Mirror Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.downstairs_wc_ceiling_lights_energy
        name: WC Ceiling Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.sauna_wahing_room_lights_energy
        name: Sauna Wahsing Room Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.sauna_lights_energy
        name: Sauna Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.bathroom_lights_energy
        name: Bathroom Ceiling Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.bathroom_lights_energy_2
        name: Bathroom Mirror Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.matu_s_room_lights_dimmer_energy
        name: Matu's Room Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.bedroom_lights_energy
        name: Bedroom Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.marlon_s_room_lights_energy
        name: Marlon's Room Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.pergola_lightning_energy
        name: Pergola Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.outdoor_kitchen_lights_energy
        name: Outdoor Kitchen Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.garage_lights_energy
        name: Garage Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.front_entrance_outdoor_lights_energy
        name: Outdoor Entrance Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.majaesine_ouevalgus_energy
        name: Outoor Front Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.back_yard_outdoor_lightning_energy
        name: Outdoor Backyard Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.balcony_lights_energy
        name: Outdoor Balcony Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.living_room_lights_energy
        name: Living Room Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.kitchen_ceiling_lights_electric_consumption_kwh
        name: Kitchen Ceiling Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.kitchen_island_lights_energy
        name: Kitchen Island Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.dining_table_lights_electric_consumption_kwh_3
        name: Dining Table Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.sauna_lobby_lights_energy
        name: Sauna Lobby Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.stair_hallway_ceiling_lights_energy
        name: Stair Hallway Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.2nd_floor_lobby_lights_energy
        name: 2nd Floor Lobby Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.stair_lights_energy
        name: Stair Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.wardrobe_lights_switch_0_energy
        name: Wardrobe Ceiling Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.wardrobe_lights_switch_1_energy
        name: Wardrobe Cupboard Lights
        children:
          - sensor.total_lights_energy
      - entity_id: sensor.hallway_lights_energy
        name: Hallway Lights
        children:
          - sensor.total_lights_energy
  - entities:
      - entity_id: sensor.heat_pump_energy
        name: Heat Pump
      - entity_id: sensor.ev_charger_energy_3
        name: EV Charger
      - entity_id: sensor.washing_machine_energy
        name: Washing Machine
      - entity_id: sensor.dryer_energy
        name: Dryer
      - entity_id: sensor.total_lights_energy
        name: Total Lights
      - entity_id: sensor.hw_circulation_pump_device_energy
        name: HW Pump
      - entity_id: sensor.pool_pump_energy
        name: Dish Washer
      - entity_id: sensor.home_dc_energy
        name: Home DC

-->

Javascript errors shown in the web inspector (if applicable):


Additional information:

Use entity attribute as optional

Hi,

Thanks for an amazing card, this is really what I've been looking for! I'd love the opportunity to optionally choose an entity attribute instead of only the entity id. Forgive me if this is already a feature, if so I couldn't find it.

An example, using HA utility meter: They keep the attribute last_period showing exactly that, the previous number. For instance having a daily, weekly, monthly or yearly energy sensor it would be nice to be able to display yesterday's energy consumption by using the attribute in addition to todays consumption by using the entity state.

Keep up the good work, loved the card!

Missing flow

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
0.11.0
Browser and Operating System:
Windows 11, Edge, Chrome

Description of problem:
missing "flow" to last entity

image

Render errormessage on error instead of nothing

Is your feature request related to a problem? Please describe.
I noticed that the card was not showing up anymore, just empty space. Turns out this was due to me renaming some entities, which made the configuration invalid. It is understandable that it fails to render in this case, but it would have been nice to have an error message to get an indication something is wrong in the configuration.

Describe the solution you'd like
Render an error message when failing to render the card.

Describe alternatives you've considered
Not really an alternative, but now I looked at the JS console and remembered I just changed some entity names.

Additional context
No other context.

Version displayed in console does not match HACS version

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:

0.10.0

Last working release (if known):

don't know

Browser and Operating System:

Windows 10, Chrome

Description of problem:

I had the devtools console open and noticed the version for this card does not match the version displayed in HACS.
According to HACS I have 0.10.0, but the console shows version 1.4.1

image

Javascript errors shown in the web inspector (if applicable):

Probably unrelated, but this warning shows for the ha-sankey-chart.js in the console

The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.

Additional information:

Text overlaps when boxes are too short

Release with the issue: v0.3.2

Description of problem:

When the value of a box is too low, there is not enough space to display the text, causing them to overlap with each other. Perhaps there should be an option to hide text if box height is less than a certain value?

(Thanks a lot again for the add-on! Sorry for sending so many issues in ๐Ÿ˜…)

calculate low carbon energy when using energy_date_selection

When using the Sankey Chart to display historic energy values which are selected by energy_date_selection, we have no easy way to display the low carbon energy part from the total energy. Since the carbon intensity varies depending on the timeframe selected, a static calculation does not help.

It would be highly appreciated if the carbon values would be extracted for the period selected and the low carbon energy would be calculated from the total.

grafik

Padding and show_icons

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:

latest

Last working release (if known):

  1. If you set show_icons: false it shows false instead of no icons.

image

  1. Can you perhaps set the padding around the container and not around the ha-card and set it to the standard padding 16px instead of 12px?

image

image

Currently, the padding differs to other standard cards (see above) and as you are using standard h1, it is currently added again, which differs even more.

image
image

Of yourse, I can set this all via card_mod, but prefer to have the HA standard natvie in cards and only change it, if I want to see it different. And the standard is 16 px below header (instead of 12) and header has its own separate padding.

Sankey flow not rendering correctly?

I'm sure it's me, but trying to do the simplest sankey flow and it's just not rendering correctly. Following the examples to the letter as far as I can see, but the Grid import isn't linking to the consumption sensor.

It's possible it's a bug, but almost certainly something I'm not grasping!

Capture

Graphical bug

Hi i have found this bug if the passthrough are on top of list

Checklist:

  • [ x] I updated to the latest version available
  • [ x] I cleared the cache of my browser

my card code:

type: custom:sankey-chart
title: Energia mensile
show_names: true
round: 1
unit_prefix: k
wide: true
min_box_distance: 5
min_box_height: 3
sections:
  - entities:
      - entity_id: sensor.monthly_pvenergy
        name: FV1
        color: rgb(255,215,0)
        children:
          - sensor.monthly_inverter
          - sensor.monthly_dc_energy
          - sensor.monthly_battenergycharged
      - entity_id: sensor.monthly_fvenergy
        name: FV2
        color: rgb(255,105,0)
        children:
          - sensor.monthly_inverter
          - sensor.monthly_dc_energy
          - sensor.monthly_battenergycharged
      - entity_id: sensor.monthly_battenelenergycharged
        name: ENEL IN
        color: purple
        children:
          - sensor.monthly_battenergycharged
  - entities:
      - entity_id: sensor.monthly_inverter
        type: passthrough
        children:
          - sensor.monthly_inverter
      - entity_id: sensor.monthly_dc_energy
        type: passthrough
        children:
          - sensor.monthly_dc_energy
      - entity_id: sensor.monthly_battenergydischarged
        name: OUT
        color: rgb(225,25,0)
        children:
          - sensor.monthly_dc_energy
          - sensor.monthly_inverter
      - entity_id: sensor.monthly_battenergycharged
        name: IN
        color: rgb(155,215,0)
  - entities:
      - entity_id: sensor.monthly_inverter
        name: INV
        color: var(--success-color)
        children:
          - sensor.monthly_energiatot
      - entity_id: sensor.monthly_dc_energy
        name: DC
        color: var(--warning-color)
        children:
          - sensor.monthly_energiatot
      - entity_id: sensor.monthly_energy
        color: PURPLE
        name: ENEL
        children:
          - sensor.monthly_energiatot
  - entities:
      - entity_id: sensor.monthly_energiatot
        name: TOT
card_mod:
  style:
    $: |
      h1.card-header {
          
          font-size: 18px;
          font-weight: normal;
          padding-bottom: 2px;
          padding-top: 2px;
          padding-left: 12px;
          padding-right: 12px;
        }
      ha-card{
         
         font-weight: 400;
         font-size: 13px;
         color: var(--text-color-off);
         padding: 0px 0px;
         margin: 0px 0px 0px 0px;
         }

image

other exemple

type: custom:sankey-chart
title: Energia giornaliera
show_names: true
round: 1
unit_prefix: k
wide: true
min_box_distance: 2
min_box_height: 5
sections:
  - entities:
      - entity_id: sensor.daily_pvenergy
        name: FV1
        color: rgb(255,215,0)
        children:
          - sensor.daily_inverter

          - sensor.daily_dc_energy
          - sensor.daily_battenergycharged
#          - sensor.daily_battenergycharged
#          - sensor.daily_dc_energy
#          - sensor.daily_inverter
      - entity_id: sensor.daily_fvenergy
        name: FV2
        color: rgb(255,105,0)
        children:
          - sensor.daily_inverter

          - sensor.daily_dc_energy
          - sensor.daily_battenergycharged
      - entity_id: sensor.daily_battenelenergycharged
        name: ENEL IN
        color: purple
        children:
          - sensor.daily_battenergycharged
  - entities:
      - entity_id: sensor.daily_inverter
        type: passthrough
        children:
          - sensor.daily_inverter
      - entity_id: sensor.daily_dc_energy
        type: passthrough
        children:
          - sensor.daily_dc_energy
      - entity_id: sensor.daily_battenergydischarged
        name: OUT
        color: rgb(225,25,0)
        children:
          - sensor.daily_dc_energy
          - sensor.daily_inverter
      - entity_id: sensor.daily_battenergycharged
        name: IN
        color: rgb(155,215,0)
  - entities:
      - entity_id: sensor.daily_inverter
        name: INV
        color: var(--success-color)
        children:
          - sensor.energiatot
      - entity_id: sensor.daily_dc_energy
        name: DC
        color: var(--warning-color)
        children:
          - sensor.energiatot
      - entity_id: sensor.daily_energy
        color: PURPLE
        name: ENEL
        children:
          - sensor.energiatot
  - entities:
      - entity_id: sensor.energiatot
        name: TOT


image

if i change the orther of first child entities there aren t any graphical issue

type: custom:sankey-chart
title: Energia giornaliera
show_names: true
round: 1
unit_prefix: k
wide: true
min_box_distance: 2
min_box_height: 5
sections:
  - entities:
      - entity_id: sensor.daily_pvenergy
        name: FV1
        color: rgb(255,215,0)
        children:
          - sensor.daily_battenergycharged
          - sensor.daily_dc_energy
          - sensor.daily_inverter
      - entity_id: sensor.daily_fvenergy
        name: FV2
        color: rgb(255,105,0)
        children:
          - sensor.daily_battenergycharged
          - sensor.daily_dc_energy
          - sensor.daily_inverter
      - entity_id: sensor.daily_battenelenergycharged
        name: ENEL IN
        color: purple
        children:
          - sensor.daily_battenergycharged
  - entities:
      - entity_id: sensor.daily_inverter
        type: passthrough
        children:
          - sensor.daily_inverter
      - entity_id: sensor.daily_dc_energy
        type: passthrough
        children:
          - sensor.daily_dc_energy
      - entity_id: sensor.daily_battenergydischarged
        name: OUT
        color: rgb(225,25,0)
        children:
          - sensor.daily_dc_energy
          - sensor.daily_inverter
      - entity_id: sensor.daily_battenergycharged
        name: IN
        color: rgb(155,215,0)
  - entities:
      - entity_id: sensor.daily_inverter
        name: INV
        color: var(--success-color)
        children:
          - sensor.energiatot
      - entity_id: sensor.daily_dc_energy
        name: DC
        color: var(--warning-color)
        children:
          - sensor.energiatot
      - entity_id: sensor.daily_energy
        color: PURPLE
        name: ENEL
        children:
          - sensor.energiatot
  - entities:
      - entity_id: sensor.energiatot
        name: TOT
card_mod:
  style:
    $: |
      h1.card-header {
          
          font-size: 18px;
          font-weight: normal;
          padding-bottom: 2px;
          padding-top: 2px;
          padding-left: 12px;
          padding-right: 12px;
        }
      ha-card{
         
         font-weight: 400;
         font-size: 13px;
         color: var(--text-color-off);
         padding: 0px 0px;
         margin: 0px 0px 0px 0px;
         }

image

Allow for 'Virtual' Entities

Creating a detailed Sankey Chart requires making template sensors with the sum of the values of its children. It would be nice to not having such requirement, as I end up having to create a ton of templates that are only used for this chart but nowhere else.

Describe the solution you'd like
It will be nice to have the ability to point to a node without an entity_id:

sections:
  - entities:
    - entity_id: sensor.house_total
      children:
        - node.floor1
        - node.floor2
        - node.outdoors
  - entities:
    - node: floor1
      children:
        - sensor.airconditioner
        - sensor.stove
    - node: floor2
      children:
        - sensor.computer
        - sensor.bedlight
    - node: outdoors
      children:
        - sensor.floodlights
  - entities:
    - sensor.airconditioner
    - sensor.stove
    - sensor.computer
    - sensor.bedlight
    - sensor.floodlights

Describe alternatives you've considered
I created a dozen template entities that are sum of the values of various sensors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.