Hi,
trying to figure out what#s wrong here as my Battery sensor show negative values for charging
state:>
{{% set battery_power = states('PV_Batterie_ksem') | float %}}
{% if battery_power > 0 %}
{((battery_power )) | round (2)}
{% else %} 0
{% endif %}
any idea?
jchh
((not John))
2
there are some extra brackets and spaces in there. Try this:
state: >
{% set battery_power = states('PV_Batterie_ksem') |float %}
{% if battery_power > 0 %}
{{ battery_power |round(2) }}
{% else %} 0
{% endif %}
note:
- line 1:
{%
and %}
- line 3: double brackets
{{
and }}
around the whole thing
- line 3:
((
and ))
not necessary around battery_power
- line 3: no spaces between
round
and (2)
jchh
((not John))
4
I made some changes after posting so perhaps double check.