Helper template negative values show 0

Please format code correctly. If you paste it as simple text, the forum uses “smart quotes”, and anyone copy/pasting it in responses has to fix it

{{ [states("sensor.solaredge_i1_ac_power")|float(0) - states("sensor.trenutna_watt")|float(0), 0]|max }}

Re-written to be easier to understand:

{% set solar = states("sensor.solaredge_i1_ac_power")|float(0) %}
{% set house = states("sensor.trenutna_watt")|float(0) %}
{{ [solar - house, 0]|max }}

max needs a list as its input.

1 Like