Hey, i want configurate a template, which return the positive value of a negative value. For example:
-34 -> 34
but I get a string as return value
-34 -> 34’
What do i have to do to get a number as return value?
Here is my template:
battery_charge:
value_template: >
{% set batter_cons = states('sensor.powerwall_battery_now') | float %}
{% if batter_cons < 0 %}
{{ batter_cons | float * (-1)}}
{% else %}
{{0 | float}}
{% endif %}'
device_class: power
unit_of_measurement: kW