Best way to determine fan setting from power

I’m using a shelly plug to monitor the power of a Vornado Transom window fan to create fan levels for a template fan and running into a few issues. The fan has 4 levels, which range between ~22W to 29W. While I can see a noticeable difference between the levels, the power drifts enough that I can’t use the raw sensor data from the shelly:


I’ve been experimenting with filters and averages, but I can’t find one that will respond quickly on a level change but also smooth the raw data to prevent false changes. Anyone have any suggestions?

Here is the filter I’m using:

sensor:
  - platform: filter
    name: "Window Fan Filter"
    entity_id: sensor.window_fan_plug_power
    filters:
      - filter: outlier
        window_size: 4
        radius: 4.0
      - filter: lowpass
        time_constant: 10
        precision: 2