How can I have a moving average of a value from mqtt?

I have a wind speed that I am getting from ESPhome where I have applied a filter with a sliding_window_moving_average. I want to do the same thing with a diferent value I am getting from mqtt. But if I try to add a filter to the mqtt value, HA complains that my configuration is invalid.

This is what I have in my configuration.yaml currently:

  - platform: mqtt
    state_topic: "doorbell/Light_level"
    unit_of_measurement: 'lm'
    name: "Light level (hall)"

How can I create a moving average of this value? I get a new value once a minute.

Filters are separate sensors. So your configuration will match your other filter sensor, but pointing to the mqtt entity.