Can't add sensor to Energy grid consumption dashboard

I have grid energy meter and I created package to read data from this meter via script:

command_line:
  - sensor:
      name: 'electro_counter'
      unique_id: 'electro_counter'
      command_timeout: 4
      command: "/config/sh/electo_counters/electro_counter.sh kwatthour_phaza:T_ALL:1"
      state_class: total_increasing
      device_class: energy
      unit_of_measurement: 'kWh'
      value_template: "{{ ((value | int) / 1000) | float}}"

But I can’t add this sensor to energy dashboard.
An only when I add this to configuration.yaml possible to do it.

homeassistant:
  packages: !include_dir_named packages/
  customize:
    sensor.electro_counter:
      state_class: total_increasing
      device_class: energy
      unit_of_measurement: 'kWh'
      friendly_name: 'electro_counter'
      icon: mdi:flash

I have already added the required parameters (state_class: total_increasing,
device_class: energy) to the package file but it doesn’t work without adding the section “customize:” to configuration.yaml.
What I do wrong?