I just realised the entity_id is in your original post ( sensor.batterij_input_output
).
template:
- sensor:
- name: "Battery Input"
unit_of_measurement: "A"
state: >
{% if states('sensor.batterij_input_output')|float >= 0 %}
{{ states('sensor.batterij_input_output') }}
{% else %}
0
{% endif %}
- name: "Battery Output"
unit_of_measurement: "A"
state: >
{% if states('sensor.batterij_input_output')|float < 0 %}
{{ -1 * states('sensor.batterij_input_output')|float }}
{% else %}
0
{% endif %}
This shows both sensors (input and output) as positive numbers. If you want the output sensor to be negative just remove -1 *
from the battery output template.