Entity is non-numeric

My automation reads a [HC-SR04 Ultrasonic Sensor on a water tank to populate a lovelace guage card. It works most of the time but occasionally the guage fails and I get Entity is non-numeric error. I have researched this and the solution in most cases is a filter: filter_out: nan but this apparently does not work with ultrasonic sensors. Is there a fix for this?

Get a better sensor?

Or use a template sensor to only accept numeric states.

Tom_I thank you. I am new at this and haven’t got into templates yet but will look into a better sensor.

Ha. That was meant to be a joke.

Have a look at the template sensor docs, if you get stuck reply here and we’ll work through it.

Ok. I will give it a go.