Sensor entity ID is incorrect

the code:

substitutions:
  device_name: "fan_pwm_01"
  friendly_name: "Fan Pwm 01"

esphome:
  name: "${device_name}"
  friendly_name: "${friendly_name}"

esp8266:
  board: esp8285

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxx"

ota:
  password: "xxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

sensor:
  - platform: pulse_counter
    id: sensor_pulse_counter
    pin:
      number: GPIO13
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Fan Speed"
    unit_of_measurement: 'RPM'
    filters:
      - multiply: 0.5
      - lambda: |-
          if (x <= 5000) return x;
          else return {};
    count_mode:
      rising_edge: INCREMENT
      falling_edge: DISABLE
    update_interval: 2s

The code can correctly calculate the RPM, and can be correctly displayed in the home assistant.

屏幕截图 2024-05-16 004510

but why the entity ID is incorrect? It should be “sensor.sensor_pulse_counter” as I wrote in the code.

The unique_id in HA is derived from the sensor name and not the ID. It gets that unique_id in HA by combining friendly_name and the sensor name. The ID in the ESPHome config is only for internal use.

Thanks.
So I made a big mistake all along, I always thought it is derived from the sensor ID.
So if I use Chinese characters as name, there will be problems.