How to change friendly name of a DHT22 sensor

my sensor.yaml looks like:

  • platform: dht
    sensor: DHT22
    pin: ‘22’
    • temperature
    • humidity

Now I try to get a friendly name for temperature and humidity.
When I look to the states view I do get
sensor.dht_sensor_humidity 50.5 friendly_name: DHT Sensor Humidity
unit_of_measurement: %
sensor.dht_sensor_temperature 20.9 friendly_name: DHT Sensor Temperature
unit_of_measurement: °C

My first try was to change the friendly_name within the
friendly_name: Office TemperaturPreformatted text

But that was just ignored. So now I wonder how I can the friendly name of that sensor?

Be sure that your “customize” is a child of “homeassistant”, not a child of the switch.

    friendly_name: Office Temperature

as usual. The problem sits in front of the screen and avoid typing blanks. Thanks it was just a missing blank

When you think about indentation, think of it like a table of contents. Indented items are children of the parent above them.