Gauge with Template text

I have a water level sensor which gives integer values 0…4 for 5 different levels. I succesfully map them to a gauge in these 5 steps, with a needle pointing to 5 different colors. Now, what I’m trying to achieve is, that instead of the number a text transformed via a template like this is shown in this gauge:

'value_template':'{% set mapper =  {'\
   '"0" : "< 1/3",'\
   '"1" : "1/3 ... 1/2",'\
   '"2" : "1/2 ... 2/3",'\
   '"3" : "2/3 ... 3/4",'\
   '"4" : "> 3/4"} %}'\
   '{{mapper[value] if value in mapper else "invald"}}'

The template is fine (formatting quoted from my python code), but how can I show that text in the gauge, but still make the gauge react correctly with its needle?
Maybe, if not the original home assistant gauge, is there a similar one, that can do this?

You would need the a lovelace templater card (there are two) to allow templating in this card

Thank You very much. Sounded promising, and I tried around with the lovelace-card-templater, but with no avail. I configured this:

type: custom:card-templater
  type: gauge
  entity: sensor.frischwasser
  min: 0
  max: 4
  needle: true
    - from: 0
      color: '#db4437'
    - from: 0.5
      color: '#ffa600'
    - from: 1.5
      color: '#ffcc00'
    - from: 2.5
      color: '#19c70b'
    - from: 3.5
      color: '#179806'
  - entity: sensor.frischwasser
    state_template: |
      {{ "test" }}

As soon as I change the state to something not numerical (which is what I want), I get an error: “entity is not numerical”. So, the templater seems to change the state of the entity before feeding it to the gauge itself. Same effect, as if I would have changed my value directly without the templater.
Did I do something wrong or misunderstand? Any idea?

That is logical as the state expects a numeric value, from your original question I see that you use numerics hence my suggestion.
In this case I would have both the name as well as the state templated, if the state turns into something which you call ‘invalid’ then set the state to 0 and the name to invalid.

You can assign each segment a label which will be shown instead of value, e.g.

    - from: 0
      color: '#db4437'
      label: '< 1/3'

If you need different labels for the same color, you have to define multiple segments with the same color.

Ahh, great, that easy!