Change state value to another text

Hi all,

I do need some help, guess its just a small thing but I can’t figure it out at the moment.
I want to change the value output from, lets say, “none” to “uit”.

The sensor gives the value “none” if the washing machine is doing nothing, so I want to have the value in the frontend set to “uit”.

image

type: custom:button-card
entity: sensor.wasmachine_washer_job_state
icon: mdi:washing-machine
show_name: false
font-size: 10px
show_state: true
styles:
  card:
    - height: 150px
    - width: 150px
    - font_size: 5px
state:
  - value: none
    color: rgb(125, 128, 130)
  - value: wash
    color: rgb(145, 229, 235)
  - value: rinse
    color: rgb(235, 180, 30)
  - value: spin
    color: rgb(30, 105, 235)

Though if I insert the if state like this it should work.

type: 'custom:button-card'
entity: sensor.wasmachine_washer_job_state
icon: mdi:washing-machine
show_state: true
state:  >
          {% if is_state('sensor.wasmachine_washer_job_state', 'none') %}
            Uit
          {% elif is_state('sensor.wasmachine_washer_job_state', 'wash') %}
            Wassen
          {% elif is_state('sensor.wasmachine_washer_job_state', 'rinse') %}
            Spoelen
          {% elif is_state('sensor.wasmachine_washer_job_state', 'spin') %}
            Centrifugeren
          {%- endif %}
    - value: 'none'
      color: rgb(125, 128, 130)
    - value: wash
      color: rgb(145, 229, 235)
    - value: rinse
      color: rgb(235, 180, 30)
    - value: spin
      color: rgb(30, 105, 235) 

But it doesn’t.

Anyone knows the magic answer? :smiley:

Use state_display
Probably, these questions should be asked in a dedicated button-card thread if you want to get a fast answer.

I have tried to add

state_display: '[[[ if (sensor.wasmachine_washer_job_state = none) return "uit"
if (sensor.wasmachine_washer_job_state = wash) return "wassen"
if (sensor.wasmachine_washer_job_state = rinse) return "spoelen"
if (sensor.wasmachine_washer_job_state = spin) return "centrifugeren" ]]]'

but it doesn’t seem to work, tried many options with ’ on every begin and end of the line and with invidiual [[[ and ]]]

Once again.

Also, using templates described in the docs for this card