flixlix / power-flow-card-plus

A power distribution card inspired by the official Energy Distribution card for Home Assistant
553 stars 67 forks source link

Fossil fuel percentage keeps showing import percentage when actually exporting #55

Closed stijnpiron closed 1 year ago

stijnpiron commented 1 year ago

When setting state_type: percentage for fossil_fuel_percentage, the percentage value is still visible from when there was actual import from the grid. This feels wrong, not really sure what value should be displayed when exporting to the grid, feels like I would prefer no value in that case...

image
flixlix commented 1 year ago

Can you please share the code of your card so I can somewhat debug the issue?

stijnpiron commented 1 year ago

here you go:

title: Current Status
entities:
  home:
    entity: sensor.solis_solar_plant_total_consumption_power
    color_icon: true
  fossil_fuel_percentage:
    entity: sensor.co2_signal_grid_fossil_fuel_percentage
    icon: mdi:pine-tree
    color_icon: true
    display_zero: true
    state_type: percentage
  battery:
    entity: sensor.battery_energy_flow
    state_of_charge: sensor.solis_solar_plant_remaining_battery_capacity
    color_icon: true
  grid:
    entity:
      consumption: sensor.dsmr_reading_electricity_currently_delivered
      production: sensor.dsmr_reading_electricity_currently_returned
    color_icon: true
  solar:
    icon: mdi:solar-power-variant-outline
    entity: sensor.solis_solar_plant_ac_output_total_power
    color_icon: true
w_decimals: 0
kw_decimals: 3
min_flow_rate: 2.5
max_flow_rate: 5
watt_threshold: 1000
clickable_entities: true
flixlix commented 1 year ago

The reason for this is that you have set display_zero to true and so the Non-Fossil Circle always appears. I would suggest you remove that line, so that the circle disappears in case your are returning to the grid. I decided to not have the percentage at 0 when exporting, since this is not really the case. In this scenario, you are exporting to the grid but that doesn't mean that the grid has 0% non Fossil Energy. I think in either case / scenario, there will be tradeoffs... So I'll close this issue for now, but if you have other suggestions, feel free to open a PR with a new behaviour.