Change an input value and only then display and save it

Sorry I’m a noob using Home Assistant. Configuration Home Assistant Core 2025.4.1., Frontend 20250404.0 in a Docker container on Ubuntu 24.04.
This involves the recalculation of a value that is supplied as a negative number. However, it should be displayed as a positive value. This is a Tasmota installation that reads a SmartMeter. The device is recognized correctly and delivers three values: the total electricity drawn from the grid in kWh, the total electricity fed into the grid in kWh and the current feed-in in W. This value is a negative value if electricity is being fed into the grid and a positive value if electricity is currently being drawn from the grid. I would like this value to be displayed exactly differently: positive when electricity is being fed into the grid and negative when electricity is being drawn from the grid. To display the values with the correct units, there is already a customize.yaml with the following values:


sensor.wattzahler_mt631_power_cur:
  device_class: power
  unit_of_measurement: 'W'
sensor.wattzahler_mt631_total_in:
  device_class: energy
  unit_of_measurement: 'kWh'
  state_class: total_increasing
sensor.wattzahler_mt631_total_out:
  device_class: energy
  unit_of_measurement: 'kWh'
  state_class: total_increasing

What do I have to do so that the value ```sensor.wattzahler_mt631_power_cur`` is multiplied by -1?

https://community.home-assistant.io/t/one-entity-divided-in-two/871625/2?u=tom_l