The original sensor is noisy or updates irregularly. You want a time-weighted mean that reflects a decayed average rather than instantaneous values. You need a smoother input for automations or PID ...