Change entitty value in Lovelace Card

Hello,

I have a door sensor which records its value as on or off, which is not good for a door status:
image

The code I am using is

- entity: sensor.living_room_occupancy
type: custom:multiple-entity-row
name: Living Room Occupancy
icon: false
secondary_info: last-changed
icon: none
- entity: binary_sensor.0x00158d00041d4a8f_contact
type: custom:multiple-entity-row
name: Living Room Patio Door
icon: false
secondary_info: last-changed
icon: none

Home Assistant displays it beautifully as open and closed:
image

What I would like to do is change the word “On” to “Closed” and “Off” to “Open”, can I do that in Lovelace entity card?

Many thanks for your help.

Try adding a “device_class: door” to your binary_sensor. Btw standard definition for the binary_sensor device_class door is ‘on’ is ‘open’. If that doesn’t work you can always create a template sensor to convert the state from on/off to open/close and then use it in place of the original binary_sensor in the ui.

sensor:
  - platform: template
    sensors:
      contact_1:
        value_template: >
          {% if is_state('binary_sensor.0x00158d00041d4a8f_contact', 'on') %}
            Closed {% else %} Open {% endif %}

Btw in the future use the code-mode for listing sample code (icon: </>) as it preserves spacing etc and makes it easier to read.