Cannot customize sensors from my custom component

I made a custom component to parse the json output of a CLI command.

I have it configures like so:

homeassistant:
  customize:
    sensor.midniteclassic_classic:
      friendly_name: "Cool name"
    sensor.yr_symbol:
      friendly_name: "test"

sensor:
  - platform: command_line_json
    prefix: MidniteClassic
    command: [my CLI command]
    scan_interval: 1
    resources:
      - timestamp
      - classic

group:
  midnite_infos:
    name: "Midnite Classic"
    view: no
    entities:
      - sensor.midniteclassic_classic
      - sensor.midniteclassic_timestamp

I can see mys sensors, and the group. But when it comes to customizing sensor.midniteclassic_classic, nothing works (friendly_name, icon etc.). But it works for sensor.yr_symbol as per the yaml above.

What am I doing wrong with the custom component ?

I made some progress. It is this line that prevents any customization. The purpose of it is to have an entity_id that is distinct and not derived from _name

What is the proper way of doing it ?

Fixed it, but please somebody confirms it is the proper way to do it:

# entity_id
entity_id_format = '{}'
self._name = entity_id_format.format(prefix + '_' + sensor_type)

# nice name
self.registry_name = prefix + ' ' + SENSOR_TYPES[self.type][0]
self._unit_of_measurement = SENSOR_TYPES[self.type][1]