I created a sensor of two photovoltaic strings to sum them up with this addition to the configuration.YAML:
# Sensor für Solarman PV1-2 Summe
- platform: template
sensors:
solar_power_total:
friendly_name: "Solarman PV1-2 Total Solar Power"
unit_of_measurement: 'W'
value_template: "{{(states('sensor.solarman_pv1_Power')|float) + (states('sensor.solarman_pv2_Power')|float)}}"
The result is: 1.200,0 W
I would like to strip (delete) the “,0” from this value.
Could someone please let me know how the full code for this sensor should look like so it looks like this:
EDIT: question how to avoid rounding errors? I was assuming 1.5 | int would round to 2 but it seems to truncate to 1, above then could lead to 0.8 + 0.8 = 0
{{ (states('sensor.solarman_pv1_Power')|float + states('sensor.solarman_pv2_Power')|float ) | round | int }}