How to set the id and the friendly name of a light?

I am a bit lost between unique_id, friendly_name, name and maybe entity_id.

I defined a light as

light:
  - friendly_name: "bureau"
    id: ch1_lampe_bureau
    platform: mqtt
    state_topic: "ch1-lampe-bureau/relay/0"
    command_topic: "ch1-lampe-bureau/relay/0/set"
    payload_on: 1
    payload_off: 0

I would like this light to be seen as bureau in the UI and address its state via light.ch1_lampe_bureau.

This does not work:

  • the UI shows it as MQTT Light
  • it is not addressable via light.ch1_lampe_bureau

No errors are raised in the logs, though.

After repeated experiences, I ended up with

light:
  - name: "bureau"
    platform: mqtt
    state_topic: "ch1-lampe-bureau/relay/0"
    command_topic: "ch1-lampe-bureau/relay/0/set"
    payload_on: 1
    payload_off: 0

which provides bureau in the UI and let me call this light via light.bureau. The latter is not good (not descriptive enough and there may be more “bureau” in various rooms). I also noted that if I set name: lampe bureau, an unique id is calculated: light.lampe_bureau.

Is there a way to achieve

I would like this light to be seen as bureau in the UI and address its state via light.ch1_lampe_bureau.

The first one doesn’t work because friendly_name is not an option of mqtt light and id is an mqtt service, nothing to do with entity_id.

The correct way to do this would be

homeassistant:
  customize:
    light.ch1_lampe_bureau:
      friendly_name: Bureau

light:
  - name: ch1_lampe_bureau 
    platform: mqtt
    state_topic: "ch1-lampe-bureau/relay/0"
    command_topic: "ch1-lampe-bureau/relay/0/set"
    payload_on: 1
    payload_off: 0