Subtrack to sensors

Today I have two sensors:

“sensor.power_production” (From a solaredge interation)
and’
“sensor.solaredge_current_power” (from a P1 energy meter intergation)

I like to substract the first from the secon and call it “sensor.diff_power”

“sensor.solaredge_current_power” - “sensor.power_production” = “sensor.diff_power”

I want to see if the diference - positive or negative but dobt know how t do this.
I hope someone can help :slight_smile:

Use a Template Sensor

In its simplest form:

template:
  - sensor:
      - name: "Diff Power"
        state: "{{ states('sensor.solaredge_current_power') | float(0) - states('sensor.power_production') | float(0) }}"

Thanks a lot!