Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106729

Utility Meter Stats – How to Template Total Solar Generation Correctly?

$
0
0

Hi everyone,

I’m forced to fix my statistics every day since 4 days. I can’t seem to figure out how to properly template my solar generation that feeds into a utility-meter.

After the day starts and my inverter turns on, my solar generation jumps up and summs up what it already generated and somehow “doubles” it.

Current setup is the following:

I have 3 sensors for pv generation in kWh

sensor.system_balkonkraftwerk_ertrag_gesamt
sensor.solarinverter_terrasse_ch3_yieldtotal
sensor.solarinverter_terrasse_ch4_yieldtotal

I combine them using this template (I know it looks a bit wierd, because I already tried a few things)

{% set ch1 = states('sensor.system_balkonkraftwerk_ertrag_gesamt') | float(0) %}
{% set ch3 = states('sensor.solarinverter_terrasse_ch3_yieldtotal') %}
{% set ch4 = states('sensor.solarinverter_terrasse_ch4_yieldtotal') %}

{% if ch3 not in ['unknown', 'unavailable', 'none'] and ch4 not in ['unknown', 'unavailable', 'none'] %}
  {{ (ch1 + ch3 | float + ch4 | float) | round(2) }}
{% else %}
  {{ this.state | float(0) }}
{% endif %}

Unit: kWh
Device Class: Energy
State Class: Total Increasing

My Utility-Meter Sensor is this one:

sensor.generierter_solarstrom_gesamt

“Periodically resetting” is enabled
“Sensor always available” is enable

I’m using OpenDTUonBattery with MQTT to get the stats from ch3 and ch4. “Enable Retain Flag” is enabled there.

Is there a better way to handle this? I hope there is someone who can help me.

Thanks a lot!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>