Moving average for inacurate sensor

Hello.
I’ve installed a Zigbee garage door state and trigger sensor. Sensor is hard wired on a gate, at some 20 meters from the actual zigbee module. Due to the distance and cables, signal is weak. When the gate is open, state changes from 0 to 1 to 0… every 10 secs. When close, state is 0 and stable.
I will change the wires, but in the meantime, I would like to compute a moving average of the sensor state based on, say, 1 minute.
This virtual sensor would give me a stable status after 1 min.

I’va had no luck so far with statistics integration. Any ideas on how to achieve this ?

Filter integration supports moving average.