flixlix / power-flow-card-plus

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

[BUG] showing W not Kw #149

Closed rossbate closed 1 year ago

rossbate commented 1 year ago

Describe the bug Card is displaying W instead of Kw after W threshold is reached

To Reproduce Steps to reproduce the behavior:

  1. Open Conpanion App
  2. view card

Expected behavior To see Kw displayed and not W after the W threshold is reached

Screenshots Added Screenshot_20230505_081518_Home Assistant

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Please make sure all of this applies and check the checkboxes, by writing "X" inside of them.

flixlix commented 1 year ago

Please post the relevant code

rossbate commented 1 year ago
type: custom:power-flow-card-plus
entities:
  home:
    entity: sensor.givtcp_ce2209g224_load_power
    color_icon: solar
  fossil_fuel_percentage:
    entity: sensor.grid_fossil_fuel_percentage
    icon: mdi:pine-tree
    color_icon: true
    display_zero: true
    name: Non Fossil
    state_type: power
  grid:
    icon: mdi:transmission-tower
    name: Octopus
    entity:
      production: sensor.givtcp_ce2209g224_export_energy_today_kwh
      consumption: sensor.givtcp_ce2209g224_import_energy_today_kwh
  solar:
    icon: mdi:solar-power-variant
    entity: sensor.givtcp_ce2209g224_pv_energy_today_kwh
  battery:
    name: Battery
    icon: mdi:battery-charging
    entity:
      consumption: sensor.givtcp_ce2209g224_battery_discharge_energy_today_kwh
      production: sensor.givtcp_ce2209g224_battery_charge_energy_today_kwh
  individual1:
    entity: sensor.livingroom_tv_power
    icon: mdi:television
    color: '#80b8ff'
    name: TV
    color_icon: true
    display_zero: true
w_decimals: 0
kw_decimals: 2
min_flow_rate: 0.9
max_flow_rate: 6
watt_threshold: 1000
clickable_entities: true
title: Home
flixlix commented 1 year ago

Your threshold is set to 1000. That threshold was not reached in the card screenshot you provided

rossbate commented 1 year ago

That should of been Kw, it was show Kw just before I updated the card now it shows W, have cleared cache but not restated HA

flixlix commented 1 year ago

No, it doesn't show kW, because your states are all below 1000. If you want to always have a unit of kW, set the threshold to 0. Your entities should provide a state in a unit_of_measurement of W, not kW

rossbate commented 1 year ago

I'm sorry if I'm not making it clear but in the initial screenshot all those values should be Kw., for instance it it 4kw from the grid but it is showing 4W, 3Kw into the battery but showing 3W and 1Kw from the battery but it is showing 1W, as I said nothing has changed except I upgraded the card to new release. I will try a restart of HA

flixlix commented 1 year ago

Going by the entity_ids, your sensors are energy sensors and not power sensors. You should only use this card with power sensors. If your sensor reports the states in kilowatt unit, make sure you have unit_of_measurement: kWh for the entity (not the card, but the entity attribute) setup

rossbate commented 1 year ago

image The sensors have been working fine, always showed W under 1000w, then showed Kw over 1000w, but since the update this morning the card is showing W instead of Kw. This screenshot is of the battery sensors showing in Kw and their unit of measudement is Kwh. I have restarted HA but still showing W

flixlix commented 1 year ago

Once again, you have energy sensors with the unit of kWh, which is not supported with this card. I understand that it worked before with energy, but now it doesn't. I can't help you further with this, since energy is not supported. The checks in the new version were reversed, meaning, only if the unit_of_measurement is kW (**not kWh), does it get interpreted as 1000W. Use power sensors for this card or expect breaking changes

rossbate commented 1 year ago

It worked before the update, i will roll back. Thanks for your support

flixlix commented 1 year ago

Although this card doesn't support energy, a lot of people have been using it in that way, so I feel obligated to allow that usage, this #152 gives you that opportunity. Will be available in the next version