flixlix / power-flow-card-plus

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

[BUG] For fossil_fuel_percentage the secondary_info does not show the result from template anymore after update. #618

Open bjiirn opened 6 months ago

bjiirn commented 6 months ago

Describe the bug For fossil_fuel_percentage the secondary_info does not show the result from template. This worked fine in v0.1.8.1. After updating to v0.2.2 this is not longer the case. Instead the entity data is now shown.

To Reproduce Steps to reproduce the behavior:

 type: custom:power-flow-card-plus
 title: Energieverteilung
 entities:
   grid:
     entity:
       consumption: sensor.power_from_grid
       production: sensor.power_to_grid
   fossil_fuel_percentage:
     entity: sensor.electricity_maps_anteil_fossiler_brennstoffe_im_netz
     name: Grün (DE Netz)
     secondary_info:
       entity: sensor.electricity_maps_anteil_fossiler_brennstoffe_im_netz
       unit_of_measurement: '%'
       decimals: 1
       template: >-
         {{ ((100 -
         states('sensor.electricity_maps_anteil_fossiler_brennstoffe_im_netz') |
         float) | round(1) | string + ' %') }}
   home:
     entity: sensor.power_house

Expected behavior Secondary Info should display the result of the template

Screenshots image image

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

bjiirn commented 6 months ago

I think i found the problem. There seems to be a typo in the 'power-flow-card-plus-config.ts': image

However i do not know how to generate the 'power-flow-card-plus.js' from the source so i cant test it. Edit: Added a PR for this: #635

Update: I did now manage to compile the Code and it does not fix the issue. I did not find what causes the problem jet, but i have a hard time understanding whats happening since im not that familiar with JavaScript. I will try to find the Problem again when i have more time.

lorenzofattori commented 6 days ago

confirmed, same problem here for now I created an helper template that is inverting the percentage, but it would be nice to have it working