Wrong metrics or wrong config in power history graph?

Hello

I set up home assistant, reading the Smartmeter Power-In and Output (PV) with an Tasmota SoC and sending the values to Home Assistant via MQTT.
I do get original Values of the SoC in kW, and I need another value in W for grid-Feed in control.

I created two sensor templates to make these two values available in Home Assistant:

- name: Momentanenergieverbrauch Haus 
        unique_id: gplugd.Pi-ID
        state: "{{ states('sensor.gplugd_pi')|float }}"
        unit_of_measurement: kW  
        device_class: power
        state_class: measurement
        
      - name: Momentanenergieverbrauch Haus W
        unique_id: gplugd.PiW-ID
        state: "{{ (states('sensor.gplugd_pi')|float * 1000)| round(0) }}"
        unit_of_measurement: W  
        device_class: power
        state_class: measurement

Problem is now, the momentary values seem to display correct (e.g. 0W or 100W), but the history is always messed up with factor 1000
grafik

And this applies to both entities, the kW entity is sometimes historically wrong as well, momenatry values always seem to be correct. (e.g. 2,653 kW)

How can I fix the history graph to the right metrics?
Another Issue I am fighting right now, is short term peaks of the Tasmota like 107 kW energy usage Max… but this is less important, because it just messes the historical Max, but not the power display per se.

Thanks for any help.