text: import esphome.codegen as cg
  import esphome.config_validation as cv
  from esphome.components import sensor
  from esphome.const import (
      CONF_CURRENT,
      CONF_POWER,
      DEVICE_CLASS_CURRENT,
      DEVICE_CLASS_EMPTY,
      DEVICE_CLASS_POWER,
      DEVICE_CLASS_TEMPERATURE,
      DEVICE_CLASS_VOLTAGE,
      ICON_EMPTY,
      ICON_TIMELAPSE,
      STATE_CLASS_MEASUREMENT,
      STATE_CLASS_TOTAL_INCREASING,
      UNIT_AMPERE,
      UNIT_CELSIUS,
      UNIT_EMPTY,
      UNIT_PERCENT,
      UNIT_VOLT,
      UNIT_WATT,
  )
  
  from . import CONF_ANT_BMS_ID, AntBms
  
  DEPENDENCIES = ["ant_bms"]
  
  CODEOWNERS = ["@syssi"]
  
  CONF_BATTERY_STRINGS = "battery_strings"
  CONF_SOC = "soc"
  CONF_TOTAL_BATTERY_CAPACITY_SETTING = "total_battery_capacity_setting"
  CONF_CAPACITY_REMAINING = "capacity_remaining"
  CONF_BATTERY_CYCLE_CAPACITY = "battery_cycle_capacity"
  CONF_TOTAL_VOLTAGE = "total_voltage"
  CONF_TOTAL_RUNTIME = "total_runtime"
  
  CONF_AVERAGE_CELL_VOLTAGE = "average_cell_voltage"
  CONF_MIN_CELL_VOLTAGE = "min_cell_voltage"
  CONF_MAX_CELL_VOLTAGE = "max_cell_voltage"
  CONF_MIN_VOLTAGE_CELL = "min_voltage_cell"
  CONF_MAX_VOLTAGE_CELL = "max_voltage_cell"
  
  CONF_TEMPERATURE_1 = "temperature_1"
  CONF_TEMPERATURE_2 = "temperature_2"
  CONF_TEMPERATURE_3 = "temperature_3"
  CONF_TEMPERATURE_4 = "temperature_4"
  CONF_TEMPERATURE_5 = "temperature_5"
  CONF_TEMPERATURE_6 = "temperature_6"
  
  CONF_CELL_VOLTAGE_1 = "cell_voltage_1"
  CONF_CELL_VOLTAGE_2 = "cell_voltage_2"
  CONF_CELL_VOLTAGE_3 = "cell_voltage_3"
  CONF_CELL_VOLTAGE_4 = "cell_voltage_4"
  CONF_CELL_VOLTAGE_5 = "cell_voltage_5"
  CONF_CELL_VOLTAGE_6 = "cell_voltage_6"
  CONF_CELL_VOLTAGE_7 = "cell_voltage_7"
  CONF_CELL_VOLTAGE_8 = "cell_voltage_8"
  CONF_CELL_VOLTAGE_9 = "cell_voltage_9"
  CONF_CELL_VOLTAGE_10 = "cell_voltage_10"
  CONF_CELL_VOLTAGE_11 = "cell_voltage_11"
  CONF_CELL_VOLTAGE_12 = "cell_voltage_12"
  CONF_CELL_VOLTAGE_13 = "cell_voltage_13"
  CONF_CELL_VOLTAGE_14 = "cell_voltage_14"
  CONF_CELL_VOLTAGE_15 = "cell_voltage_15"
  CONF_CELL_VOLTAGE_16 = "cell_voltage_16"
  CONF_CELL_VOLTAGE_17 = "cell_voltage_17"
  CONF_CELL_VOLTAGE_18 = "cell_voltage_18"
  CONF_CELL_VOLTAGE_19 = "cell_voltage_19"
  CONF_CELL_VOLTAGE_20 = "cell_voltage_20"
  CONF_CELL_VOLTAGE_21 = "cell_voltage_21"
  CONF_CELL_VOLTAGE_22 = "cell_voltage_22"
  CONF_CELL_VOLTAGE_23 = "cell_voltage_23"
  CONF_CELL_VOLTAGE_24 = "cell_voltage_24"
  CONF_CELL_VOLTAGE_25 = "cell_voltage_25"
  CONF_CELL_VOLTAGE_26 = "cell_voltage_26"
  CONF_CELL_VOLTAGE_27 = "cell_voltage_27"
  CONF_CELL_VOLTAGE_28 = "cell_voltage_28"
  CONF_CELL_VOLTAGE_29 = "cell_voltage_29"
  CONF_CELL_VOLTAGE_30 = "cell_voltage_30"
  CONF_CELL_VOLTAGE_31 = "cell_voltage_31"
  CONF_CELL_VOLTAGE_32 = "cell_voltage_32"
  
  CONF_CHARGE_MOSFET_STATUS_CODE = "charge_mosfet_status_code"
  CONF_DISCHARGE_MOSFET_STATUS_CODE = "discharge_mosfet_status_code"
  CONF_BALANCER_STATUS_CODE = "balancer_status_code"
  
  ICON_BATTERY_STRINGS = "mdi:car-battery"
  ICON_CAPACITY_REMAINING = "mdi:battery-50"
  ICON_TOTAL_BATTERY_CAPACITY_SETTING = "mdi:battery-50"
  ICON_BATTERY_CYCLE_CAPACITY = "mdi:battery-50"
  ICON_SOC = "mdi:battery-50"
  ICON_CHARGE_MOSFET_STATUS_CODE = "mdi:heart-pulse"
  ICON_DISCHARGE_MOSFET_STATUS_CODE = "mdi:heart-pulse"
  ICON_BALANCER_STATUS_CODE = "mdi:heart-pulse"
  
  ICON_MIN_CELL_VOLTAGE = "mdi:battery-minus-outline"
  ICON_MAX_CELL_VOLTAGE = "mdi:battery-plus-outline"
  ICON_MIN_VOLTAGE_CELL = "mdi:battery-minus-outline"
  ICON_MAX_VOLTAGE_CELL = "mdi:battery-plus-outline"
  
  UNIT_SECONDS = "s"
  UNIT_AMPERE_HOURS = "Ah"
  
  CELLS = [
      CONF_CELL_VOLTAGE_1,
      CONF_CELL_VOLTAGE_2,
      CONF_CELL_VOLTAGE_3,
      CONF_CELL_VOLTAGE_4,
      CONF_CELL_VOLTAGE_5,
      CONF_CELL_VOLTAGE_6,
      CONF_CELL_VOLTAGE_7,
      CONF_CELL_VOLTAGE_8,
      CONF_CELL_VOLTAGE_9,
      CONF_CELL_VOLTAGE_10,
      CONF_CELL_VOLTAGE_11,
      CONF_CELL_VOLTAGE_12,
      CONF_CELL_VOLTAGE_13,
      CONF_CELL_VOLTAGE_14,
      CONF_CELL_VOLTAGE_15,
      CONF_CELL_VOLTAGE_16,
      CONF_CELL_VOLTAGE_17,
      CONF_CELL_VOLTAGE_18,
      CONF_CELL_VOLTAGE_19,
      CONF_CELL_VOLTAGE_20,
      CONF_CELL_VOLTAGE_21,
      CONF_CELL_VOLTAGE_22,
      CONF_CELL_VOLTAGE_23,
      CONF_CELL_VOLTAGE_24,
      CONF_CELL_VOLTAGE_25,
      CONF_CELL_VOLTAGE_26,
      CONF_CELL_VOLTAGE_27,
      CONF_CELL_VOLTAGE_28,
      CONF_CELL_VOLTAGE_29,
      CONF_CELL_VOLTAGE_30,
      CONF_CELL_VOLTAGE_31,
      CONF_CELL_VOLTAGE_32,
  ]
  
  TEMPERATURES = [
      CONF_TEMPERATURE_1,
      CONF_TEMPERATURE_2,
      CONF_TEMPERATURE_3,
      CONF_TEMPERATURE_4,
      CONF_TEMPERATURE_5,
      CONF_TEMPERATURE_6,
  ]
  
  SENSORS = [
      CONF_BATTERY_STRINGS,
      CONF_CURRENT,
      CONF_SOC,
      CONF_TOTAL_BATTERY_CAPACITY_SETTING,
      CONF_CAPACITY_REMAINING,
      CONF_BATTERY_CYCLE_CAPACITY,
      CONF_TOTAL_VOLTAGE,
      CONF_TOTAL_RUNTIME,
      CONF_AVERAGE_CELL_VOLTAGE,
      CONF_POWER,
      CONF_MIN_CELL_VOLTAGE,
      CONF_MAX_CELL_VOLTAGE,
      CONF_MIN_VOLTAGE_CELL,
      CONF_MAX_VOLTAGE_CELL,
      CONF_CHARGE_MOSFET_STATUS_CODE,
      CONF_DISCHARGE_MOSFET_STATUS_CODE,
      CONF_BALANCER_STATUS_CODE,
  ]
  
  # pylint: disable=too-many-function-args
  CONFIG_SCHEMA = cv.Schema(
      {
          cv.GenerateID(CONF_ANT_BMS_ID): cv.use_id(AntBms),
          cv.Optional(CONF_BATTERY_STRINGS): sensor.sensor_schema(
              unit_of_measurement=UNIT_EMPTY,
              icon=ICON_BATTERY_STRINGS,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CURRENT): sensor.sensor_schema(
              unit_of_measurement=UNIT_AMPERE,
              icon=ICON_EMPTY,
              accuracy_decimals=1,
              device_class=DEVICE_CLASS_CURRENT,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_SOC): sensor.sensor_schema(
              unit_of_measurement=UNIT_PERCENT,
              icon=ICON_SOC,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TOTAL_BATTERY_CAPACITY_SETTING): sensor.sensor_schema(
              unit_of_measurement=UNIT_AMPERE_HOURS,
              icon=ICON_TOTAL_BATTERY_CAPACITY_SETTING,
              accuracy_decimals=2,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CAPACITY_REMAINING): sensor.sensor_schema(
              unit_of_measurement=UNIT_AMPERE_HOURS,
              icon=ICON_CAPACITY_REMAINING,
              accuracy_decimals=2,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_BATTERY_CYCLE_CAPACITY): sensor.sensor_schema(
              unit_of_measurement=UNIT_AMPERE_HOURS,
              icon=ICON_BATTERY_CYCLE_CAPACITY,
              accuracy_decimals=2,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TOTAL_VOLTAGE): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=2,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TOTAL_RUNTIME): sensor.sensor_schema(
              unit_of_measurement=UNIT_SECONDS,
              icon=ICON_TIMELAPSE,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_TOTAL_INCREASING,
          ),
          cv.Optional(CONF_AVERAGE_CELL_VOLTAGE): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=2,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_POWER): sensor.sensor_schema(
              unit_of_measurement=UNIT_WATT,
              icon=ICON_EMPTY,
              accuracy_decimals=1,
              device_class=DEVICE_CLASS_POWER,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_MIN_CELL_VOLTAGE): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_MIN_CELL_VOLTAGE,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_MAX_CELL_VOLTAGE): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_MAX_CELL_VOLTAGE,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_MIN_VOLTAGE_CELL): sensor.sensor_schema(
              unit_of_measurement=UNIT_EMPTY,
              icon=ICON_MIN_VOLTAGE_CELL,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_MAX_VOLTAGE_CELL): sensor.sensor_schema(
              unit_of_measurement=UNIT_EMPTY,
              icon=ICON_MAX_VOLTAGE_CELL,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TEMPERATURE_1): sensor.sensor_schema(
              unit_of_measurement=UNIT_CELSIUS,
              icon=ICON_EMPTY,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_TEMPERATURE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TEMPERATURE_2): sensor.sensor_schema(
              unit_of_measurement=UNIT_CELSIUS,
              icon=ICON_EMPTY,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_TEMPERATURE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TEMPERATURE_3): sensor.sensor_schema(
              unit_of_measurement=UNIT_CELSIUS,
              icon=ICON_EMPTY,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_TEMPERATURE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TEMPERATURE_4): sensor.sensor_schema(
              unit_of_measurement=UNIT_CELSIUS,
              icon=ICON_EMPTY,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_TEMPERATURE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TEMPERATURE_5): sensor.sensor_schema(
              unit_of_measurement=UNIT_CELSIUS,
              icon=ICON_EMPTY,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_TEMPERATURE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_TEMPERATURE_6): sensor.sensor_schema(
              unit_of_measurement=UNIT_CELSIUS,
              icon=ICON_EMPTY,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_TEMPERATURE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_1): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_2): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_3): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_4): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_5): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_6): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_7): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_8): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_9): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_10): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_11): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_12): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_13): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_14): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_15): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_16): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_17): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_18): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_19): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_20): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_21): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_22): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_23): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_24): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_25): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_26): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_27): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_28): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_29): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_30): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_31): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CELL_VOLTAGE_32): sensor.sensor_schema(
              unit_of_measurement=UNIT_VOLT,
              icon=ICON_EMPTY,
              accuracy_decimals=3,
              device_class=DEVICE_CLASS_VOLTAGE,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_CHARGE_MOSFET_STATUS_CODE): sensor.sensor_schema(
              unit_of_measurement=UNIT_EMPTY,
              icon=ICON_CHARGE_MOSFET_STATUS_CODE,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_DISCHARGE_MOSFET_STATUS_CODE): sensor.sensor_schema(
              unit_of_measurement=UNIT_EMPTY,
              icon=ICON_DISCHARGE_MOSFET_STATUS_CODE,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
          cv.Optional(CONF_BALANCER_STATUS_CODE): sensor.sensor_schema(
              unit_of_measurement=UNIT_EMPTY,
              icon=ICON_BALANCER_STATUS_CODE,
              accuracy_decimals=0,
              device_class=DEVICE_CLASS_EMPTY,
              state_class=STATE_CLASS_MEASUREMENT,
          ),
      }
  )
  
  
  async def to_code(config):
      hub = await cg.get_variable(config[CONF_ANT_BMS_ID])
      for i, key in enumerate(TEMPERATURES):
          if key in config:
              conf = config[key]
              sens = await sensor.new_sensor(conf)
              cg.add(hub.set_temperature_sensor(i, sens))
      for i, key in enumerate(CELLS):
          if key in config:
              conf = config[key]
              sens = await sensor.new_sensor(conf)
              cg.add(hub.set_cell_voltage_sensor(i, sens))
      for key in SENSORS:
          if key in config:
              conf = config[key]
              sens = await sensor.new_sensor(conf)
              cg.add(getattr(hub, f"set_{key}_sensor")(sens))
  