reptilex / tesla-style-solar-power-card

Home assistant power card mimicking the one tesla provides for the powerwall app.
210 stars 59 forks source link

Feature Request: House bubble - more than 1 color/source #165

Open mkanet opened 8 months ago

mkanet commented 8 months ago

Currently, the house bubble flow only shows the color of the highest flow.

Is it possible to change the house bubble to visualize percentages of each source (in respect to each other) just like the Home Assistant's Energy Dashboard house bubble?

image

It could use the templates below to calculate the percentage of each piece of the bubble above.


template:
  - sensor:
    - name: 'Solar Power Percentage'
    unit_of_measurement: '%'
    state: >
      {% set total = states('sensor.powerwall_solar_export')|float + states('sensor.powerwall_site_import')|float + states('sensor.powerwall_battery_import')|float %}
      {{ ((states('sensor.powerwall_solar_export')|float / total) * 100)|round(2) if total > 0 else 0 }}
    - name: 'Grid Power Percentage'
    unit_of_measurement: '%'
    state: >
      {% set total = states('sensor.powerwall_solar_export')|float + states('sensor.powerwall_site_import')|float + states('sensor.powerwall_battery_import')|float %}
      {{ ((states('sensor.powerwall_site_import')|float / total) * 100)|round(2) if total > 0 else 0 }}
    - name: 'Battery Power Percentage'
    unit_of_measurement: '%'
    state: >
      {% set total = states('sensor.powerwall_solar_export')|float + states('sensor.powerwall_site_import')|float + states('sensor.powerwall_battery_import')|float %}
      {{ ((states('sensor.powerwall_battery_import')|float / total) * 100)|round(2) if total > 0 else 0 }}
`