Build diffrence between 2 sensors

Hi, I need the difference between two power sensors.
In the new Version of hass you can add a helper for the sum … for that I need toconvert one value of the sensors to a negative value.
What is the best solution to get the diffrence ?
Example …
Sensor_sum = 400 Watt
Sensor_part1 = 150 Watt
Sensor_part2 = xx Watt

Thx for help

You can create a sensor based on any calculation you’d like, by creating a sensor based on a template. In that template, you can do any calculation you’d like.

For more information on that, see the template documentation here:

https://www.home-assistant.io/integrations/template/#state-based-template-binary-sensors-buttons-numbers-selects-and-sensors