How to change the unit of measurement used for display in this card?

I am trying to post a measurement of disk usage in bytes using the CURL command. I am using the Rest API to update the state of an entity. I have set up a template sensor in the configuration.yaml file, with an empty state (so that there is a sensor ready to receive the data). It looks like this:

template:
 - sensor:
    - name: "My Disk Sensor Bytes"
      unique_id: my_disk_sensor_bytes
      unit_of_measurement: B
      state_class: measurement
      device_class: data_size
      state: ''

Now I try to send some data using CURL form another machine:

curl \
  -H "Authorization: Bearer MYTOKEN" \
  -H "Content-Type: application/json" \
  -d '{"state": "16000000000", 
       "attributes": {
	       "unit_of_measurement": "B", 
		   "state_class": "measurement", 
		   "device_class": "data", 
		   "friendly_name": "My Disk Sensor Bytes"
		   }
	  }'  \
  http://localhost:8123/api/states/sensor.my_disk_sensor_bytes

The data seems to correctly appear in Developer Tools, with the correct attributes:

When I display the entity in a standard entity card, it shows correctly the data in bytes as expected:

image

I would like to display the data here in GiB instead, since that makes the most sense at the moment for this reading. However, I want to keep the underlying data in bytes (so that values can be compared long term, is consistent, and the history graphs work properly, etc). I only want to change the display value in this card.

I tried to click on the entity and edit the unit to GiB using this menu, but it didn’t affect the reading at all:

Is there a simple way to do this?

Hello teeeeee,

Convert it with a template sensor and display that instead.

Is there really no way to change only the display units without creating many new sensors? I know its possible to change the display name for a card, so would expect it with unit as well.

There is customize integration as well.

@Sir_Goodenough

Can you show how can this be used to help in my case? Thanks

Yes ive read that.

But as far as i understand, its just a way to force the unit for this entity to change globally? (Because for some reason the dropdown menu in the entity settings does nothing in my case, as shown in the OP).

But it doesnt allow to change the display unit for only a specfic card, whilst keeping the global unit the same (for consistent long term data, history graphs, etc).

Pleaae correct me if any of this is wrong.