Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Template Support #21

Open
marcelvandorp opened this issue Mar 5, 2023 · 5 comments
Open

Feature Request: Template Support #21

marcelvandorp opened this issue Mar 5, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@marcelvandorp
Copy link

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
Copy link
Owner

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

@Sese-Schneider Sese-Schneider added the bug Something isn't working label Mar 5, 2023
@Sese-Schneider
Copy link
Owner

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.

@Sese-Schneider Sese-Schneider added enhancement New feature or request and removed bug Something isn't working labels Mar 7, 2023
@Sese-Schneider Sese-Schneider changed the title Power consumption/production in one animation Feature Request: Template Support Mar 7, 2023
@nonplusnl
Copy link

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
Copy link
Owner

@nonplusnl a workaround right now would be to create template sensors, which do the math for you:
#28 (comment)

@wminno
Copy link

wminno commented Mar 17, 2023

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:

  • sensor:

    • name: "Stroomverbruik netto L1"
      unique_id: "stroom_netto_l1"
      unit_of_measurement: "W"
      state: >
      {{ states ('sensor.phases_power_consumed_phase_l1') | float(0) | round(0)
      - states ('sensor.phases_power_produced_phase_l1') | float(0) | round(0) }}
  • sensor:

    • name: "Stroomverbruik netto L2"
      unique_id: "stroom_netto_l2"
      unit_of_measurement: "W"
      state: >
      {{ states ('sensor.phases_power_consumed_phase_l2') | float(0) | round(0)
      - states ('sensor.phases_power_produced_phase_l2') | float(0) | round(0) }}
  • sensor:

    • name: "Stroomverbruik netto L3"
      unique_id: "stroom_netto_l3"
      unit_of_measurement: "W"
      state: >
      {{ states ('sensor.phases_power_consumed_phase_l3') | float(0) | round(0)
      - states ('sensor.phases_power_produced_phase_l3') | float(0) | round(0) }}
  • sensor:

    • name: "Stroomverbruik in huis"
      unique_id: "stroomverbruik_huis"
      unit_of_measurement: "W"
      state: >
      {{ states ('sensor.solaredge_ac_power') | float(0) | round(0)
      - states ('sensor.smartmeter_power_production') | float(0) | round(0)
      + states ('sensor.smartmeter_power_consumption') | float(0) | round(0) }}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants