flixlix / power-flow-card-plus

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

[BUG] v0.2.1: Individual doesn't show secondary info #567

Closed ma9mwah closed 2 months ago

ma9mwah commented 2 months ago

Describe the bug when adding a secondary info to a individual circle it doesn't appear.

image

This is the code the GUI created:

individual:
    - entity: sensor.myenergi_eddi_xxxxxx_power_ct_internal_load
      name: Eddi
      color:
        - 255
        - 255
        - 0
      display_zero: true
      secondary_info:
        entity: sensor.myenergi_eddi_xxxxxx_energy_used_today
        unit_of_measurement: kWh
        decimals: 1
        unit_white_space: true
        display_zero: true
        color_value: false
        accept_negative: false
        icon: ''
      show_direction: false
      color_value: false
      color_icon: true
      display_zero_state: true
      calculate_flow_rate: false
      use_metadata: false
      icon: mdi:water
cpohli commented 2 months ago

I can confirm that behaviour, although it seems to only affect the first individual. i have a second individual configured and it shows the secondary info.

fhrbek commented 2 months ago

I can confirm the same. It does not seem to work for any individual (even if I duplicate my individual to create a second one).

Notes:

ma9mwah commented 2 months ago

a few more tests.

I tried adding a second individual to see if it worked like @cpohli said, and it didn't image

But I thought I'd test another entity (which is none zero) and it worked, even though on the above it has 'Display Zero' ticked image

Works in individual1 as well image

so it feels like its the 'Display Zero' is somehow broken.

cpohli commented 2 months ago

Tried that to and it seems @ma9mwah is on the right track with his testing. My secondary on individual2 seems to work, as it is always not 0. So it seems, that indeed the 'display zero' is not doing it's job on individuals with a Zero :-) ...

fhrbek commented 2 months ago

Tried that to and it seems @ma9mwah is on the right track with his testing. My secondary on individual2 seems to work, as it is always not 0. So it seems, that indeed the 'display zero' is not doing it's job on individuals with a Zero :-) ...

And what about string values? How is "Display zero" supposed to work there? (it does not currently show up with either setting) With the older version, it worked with streams seamlessly.

aminorjourney commented 2 months ago

Can confirm this is an issue for me too - Just came here to report the bug and see it's already been noted.

Included my config for info:

Screenshot 2024-04-16 at 9 04 47 PM
type: custom:power-flow-card-plus
full_size: true
entities:
  battery:
    entity:
      consumption: sensor.f150_feed_in_power
      production: sensor.emporia_vue2b_ford_charge_station_pro_power
    name: Ortegas
    color_icon: true
    color_circle: true
    state_of_charge_decimals: 1
    display_zero_tolerance: 50
    use_metadata: false
    color_value: false
    display_state: one_way
    invert_state: true
    icon: mdi:battery-high
    state_of_charge_unit_white_space: true
    color_state_of_charge_value: true
    state_of_charge: sensor.battery_percent_template
  grid:
    entity:
      consumption: sensor.house_grid_energy_total
      production: sensor.calculated_solar_export_to_grid
    use_metadata: true
    name: Grid
    icon: mdi:transmission-tower
    color_icon: true
    color_circle: true
    color_value: false
    display_state: one_way
    display_zero_tolerance: 20
    invert_state: false
    secondary_info:
      entity: sensor.co2_intensity
      use_metadata: false
      unit_of_measurement: gCO²
      unit_white_space: true
    power_outage:
      icon_alert: ''
      entity_generator: sensor.f150_feed_in_power
    color:
      consumption:
        - 120
        - 87
        - 0
      production:
        - 255
        - 170
        - 0
  solar:
    entity: sensor.envoy_122052091186_current_power_production
    display_zero: true
    name: Solar
    display_zero_tolerance: 0
    use_metadata: false
    secondary_info:
      unit_of_measurement: kW
    icon: mdi:solar-power-variant
    display_zero_state: true
  home:
    entity: sensor.house_grid_energy_total
    use_metadata: false
    override_state: false
    subtract_individual: false
    name: home
    icon: mdi:home
    secondary_info: null
  fossil_fuel_percentage:
    entity: sensor.grid_fossil_fuel_percentage
    display_zero_state: true
    state_type: percentage
    color_value: true
    display_zero: true
    color_icon: true
    use_metadata: false
    name: Power Mix
    unit_white_space: false
    color:
      - 79
      - 122
      - 40
  individual:
    - entity: sensor.juice_boxes_power
      display_zero: true
      name: EV Charging
      icon: mdi:ev-station
      secondary_info:
        entity: sensor.chevrolet_bolt_ev_power
        display_zero: true
    - entity: sensor.emporia_vue2a_heat_pump_power
      name: HVAC
      icon: mdi:heat-pump
      display_zero: true
      secondary_info:
        entity: sensor.emporia_vue2a_server_room_ac_power
        icon: mdi:server
        display_zero: true
    - entity: sensor.server_room_power
      name: Server Room
      icon: mdi:server
      display_zero: true
    - entity: sensor.emporia_vue2b_water_heater_power
      name: Water
      icon: mdi:water-boiler
      display_zero: true
      secondary_info:
        entity: sensor.water_and_septic_power_2
        icon: mdi:water-pump
        display_zero: true
clickable_entities: true
display_zero_lines:
  mode: show
  transparency: 50
  grey_color:
    - 189
    - 189
    - 189
use_new_flow_rate_model: true
w_decimals: 0
kw_decimals: 2
min_flow_rate: 0.75
max_expected_power: 20000
watt_threshold: 1000
transparency_zero_lines: 0
title: Power Flow
max_flow_rate: 7.5
min_expected_power: 1
alexeiw123 commented 2 months ago

Also came here to report this bug.

FYI for a workaround, you can use the template area to show the state in whatever way you please. Not the most direct way but it works.

      secondary_info:
        template: '{{states('climate.izone_controller')}}'
fhrbek commented 2 months ago

Also came here to report this bug.

FYI for a workaround, you can use the template area to show the state in whatever way you please. Not the most direct way but it works.

      secondary_info:
        template: '{{states('climate.izone_controller')}}'

This workaround works for me (even with a string entity, no need to check "Display zero"), I just had to double the inner quotes, i.e. like this:

secondary_info:
  template: '{{states(''climate.izone_controller'')}}'
flixlix commented 2 months ago

thank you all for your detailed description of the issue, helped me a lot. Turned out to be a quick fix :)

fixed in #592

alexeiw123 commented 2 months ago

@flixlix bug still present for me 0.2.2 My entity state I'm using is a string but is just showing blank unless I use a template instead.

flixlix commented 2 months ago

@alexeiw123 this is expected behavior, by detail the card only accepts numeric entities as secondary info

alexeiw123 commented 2 months ago

@alexeiw123 this is expected behavior, by detail the card only accepts numeric entities as secondary info

fair enough! this must be new behaviour with 0.2x as here is my screenshot I took using the old configuration where i just had the entity selected. it's no problem though, I just use this instead now: template: '{{state_translated(''climate.izone_controller_200011148'')}}'

image

fhrbek commented 2 months ago

@alexeiw123 this is expected behavior, by detail the card only accepts numeric entities as secondary info

OK, as @alexeiw123 says, this is new with 0.2x, I used a string entity in the old version as well and it worked fine. The template workaround is acceptable for now; however, please consider supporting strings as secondary info in future versions. I think that many users would appreciate it.