How to configure negative and positive energy?

Hello

I have two measuring clamps working with a local tuya.

I use the A power of the A clamp to monitor the grid of my house.

But when my solar panel produces more than the consumption of my house, the power should pass with negative power.
But it doesn’t :expressionless:

Is it possible to link power A with direction A? Reverse for negative and Forward to positive

Thank’s :smiley:

So basically if direction A = Forward then power A is Positive whole reverse = negative and the same for Direction B /Power B?

Look up how to create a template sensor. You’ll essentially create a parallel sensor beside these that report the way you want - such as invert the sign when power direction switches.

Then use the shiny new sensor anywhere you need that display.

As Nathan said create new sensors for +ve and -ve values in templates.yaml. Here is a section of mine for monitoring power in and out of my batteries;

    - name: "Battery Power In"
      unique_id: bat_power_in
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {{ -([0,states('sensor.total_battery_power')|float]|min)|round(1) }}

    - name: "Battery Power Out"
      unique_id: bat_power_out
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement
      state: >
        {{ ([0,states('sensor.total_battery_power')|float]|max)|round(1) }}
1 Like

Ok thank’s

Just find a solution with a template and

{% if states('sensor.linky_direction_a') == "FORWARD" %} {{(states('sensor.linky_power_a') | float) -}}
{% else %}
{{ (states ('sensor.linky_power_a') | float *-1) }}
{% endif %}
1 Like