Sese-Schneider / ha-energy-overview-card

A simple card which displays energy usage details of one or multiple entities.
MIT License
51 stars 1 forks source link

Feature Request: Template Support #21

Open marcelvandorp opened 1 year ago

marcelvandorp commented 1 year ago

Hi, I have a feature request:

I see that negative values will show the animation from right to left (as expected). My DSMR has two sensors per line: Power Consumption and Power Production. Both are positive values. But When I have Production, I do not have Consumption and vice versa

Is there a way to display the results of the calculation: Consumption-Production? That is: with Consumption this is a positive value, and with Production this is a negative value. This way the animation shows exactly the flow of energy as it occurs.

I tried a template, but this isn't recognized (or I do something wrong).

This is a simple test config that works:

type: custom:energy-overview-card
entities:
  - power: input_number.schuiver
    label_leading: P
    label_trailing: L1
    icon_leading: mdi:transmission-tower
    icon_trailing: mdi:home-lightning-bolt
    color: '#488fc2'

But if I change the power line to use a template, like this:

- power: "{{ states('input_number.schuiver') }}"

It doesn't show anything. This line only uses a template to retrieve the value, no calculations are done (yet)

I am aware I can solve this with a template sensor, but I believe a solution in this card is the cleaner solution.

Sese-Schneider commented 1 year ago

Hi @marcelvandorp, thank you for your message. I will treat this as a bug; templates are not working, and I will investigate.

Sese-Schneider commented 1 year ago

Template are indeed currently not supported. Adding template functionallity to custom cards is unfortunately not trivial. I will see what I can do, but can't make promises on the timeline.

For now, I do suggest going with a template sensor.

nonplusnl commented 1 year ago

Also having separate consumption and production sensors here. An alternative solution is perhaps to add production sensors to the custom card, and have the card do the math itself?

Sese-Schneider commented 1 year ago

@nonplusnl a workaround right now would be to create template sensors, which do the math for you: https://github.com/Sese-Schneider/ha-energy-overview-card/issues/28#issuecomment-1468096390

wminno commented 1 year ago

It actually gives you a bit more to work with if you create template sensors like that.. In my case I monitor L1/L2/L3 phases. The solar PV sits on L2 (where you see the negative wattage with animation going into the net properly in screenshot here), and I use a separate template sensor to see how much your house is actually using (in-house display in the screenshot), regardless of the solar panels pushing in or out of the net.

The latter I take by pulling the sensor.solaredge_ac_power directly from the solaredge pv ac power generation (modbus over tcp sensor on the pv setup) and comparing it against the power meter P1 power consumption and generation counters live

Screenshot 2023-03-17 at 13 43 12

The full configuration.yaml entries I use for these:

`template: