I have a energy meter thats reads the actual power of my solar panels. However this value is negative. How can I convert this to a positive value?
I have tried the following in configuration.yaml
template:
- sensor:
- name: Actual solar power - Dak
unit_of_measurement: "kWh"
state: "{{ states ('Solar meter dak (5c2faf0e37dc) Active power') | int *-1}}"
You can create a Template Sensor to convert the value of sensor.solar_meter_5c2faf0e37dc to a positive value using the abs filter:
template:
- sensor:
- name: Actual solar power - Dak
unit_of_measurement: "kWh"
state: "{{ states('sensor.solar_meter_5c2faf0e37dc') | int(0) | abs }}"
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.