Sorry for late Answer.
As I also get sometimes zero or very high values from the IR Reader of the smart meter I add some code to supress the low values. That is running up to now.
-platform: template
sensors:
energy_from_grid:
friendly_name: "Energy from Grid"
unique_id: Energy_from_Grid
device_class: energy
unit_of_measurement: kWh
value_template: >
{% if states('sensor.zaehler_sm_1_8_0') | float < 2000 %}
{{ states('sensor.energy_from_grid') }}
{% else %}
{{ states('sensor.zaehler_sm_1_8_0') | float | multiply(1.0) | round(0) }}
{% endif %}
This will only transfer new values if bigger than 2000kwh.
But sometimes I also get very big values that I also want to delete.
How to check if the new value is just the same or a little bit bigger than the old one (Energy from Grid)
So if my actual Energy_From Grid value is 2000kwh it should ignore values below 2000 and also ignore values above 2050
I’m not a yaml specialist
-platform: template
sensors:
energy_from_grid:
friendly_name: "Energy from Grid"
unique_id: Energy_from_Grid
device_class: energy
unit_of_measurement: kWh
value_template: >
#Ignore values below the actual energy value
{% if states('sensor.zaehler_sm_1_8_0') | float < "Energy from Grid" % }
{{ states('sensor.energy_from_grid') }}
#Ignore values above the actual energy value +50
{% elseif states('sensor.zaehler_sm_1_8_0') | float > ("Energy from Grid" + 50) % }
{{ states('sensor.energy_from_grid') }}
{% else %}
{{ states('sensor.zaehler_sm_1_8_0') | float | multiply(1.0) | round(0) }}
{% endif %}
Can someone correct the code for me
Thank you in advance
Michael
2 posts - 1 participant