But you said that it was rattly, as though there is oil starvation at the top end, so there must be an issue other than faulty sensor
Not the same engine but finding I have a similar problem.
Oil light flashes and beeps 3 times then stays on. Has done a few times. I topped up (maybe a little too much) oil and still on.
Pulled away one time and puff of smoke came out of the back and when stopped had slight mayo on inside of oil cap. None in dipstick, coolant was a little foamy but calmed down after like bubbles dispersing.
Had to get the car home and later noticed it sounded rattly at the top end. Cleaned oil cap and left it for a bit. Came back later and it sounded ok so went for a longer drive gently under 3-4k to see how it was. (Recently bought it cheap and want to make sure it's not Head Gasket gone)
Was all good until I went up the hill in Mawgan Porth, prob about 1/2-1/3 Hill.
Then no real power and jolty but made it. Sounded really rattly.
Got home OK and checked oil level and cap and no gunk in oil cap at all which surprised me.
Now I'm thinking it's got to be something to do with oil pressure and not getting oil to the top of the engine?
Reading this thread makes me think the oil pickup is blocked rather than the sensor.
When I have time I shall take to a friends garage to get the sump off and replace it.
I just wanted to thank you all for your help and to bump this thread after 10 years.
My car is an A3 8p 1.6 Petrol but found this thread extremely interesting and insightful.
Will update when I have done the work.