Creating sensor getting data from InfluxDB

Hello!
I am trying to add energy sensors to Home Assistant. Those sensors will have to be feeded from Influx DB, but it doesn’t work because the new sensor doesn’t appear in any place. What am I doing wrong? I share the code I have added. Thank you in advance!

configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor: !include sensors.yaml

homeassistant:
  customize: !include customize.yaml

sensors.yaml

- platform: influxdb
  api_version: 2
  host: IP
  port: PORT
  token: TOKEN
  organization: SweetHome
  bucket: eSolar
  queries_flux:
    - name: "pvPower"
      range_start: "-1m"
      unit_of_measurement: Wh
      unique_id: "pvPower"
      query: >
        from(bucket: "eSolar")
          |> range(start: -1m, stop: now())
          |> filter(fn: (r) => r["_measurement"] == "sensor.esolar_Modbus")
          |> filter(fn: (r) => r["_field"] == "loadPower")
          |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
          |> yield(name: "last")

customize.yaml

sensor.pvPower:
  last_reset: "1970-01-01T00:00:00+00:00"
  state_class: measurement
  device_class: energy

I add a log

2022-11-30 22:09:03.937 ERROR (MainThread) [homeassistant.setup] Error during setup of component influxdb
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/influxdb/__init__.py", line 481, in setup
    conf = config[DOMAIN]
KeyError: 'influxdb'
2022-11-30 22:09:04.015 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform influxdb.sensor: Unable to set up component.

Unfortunately this is very limited. You should remove “from(bucket: …” and initiate the query with filter(…), specifying the bucket as I did. Unfortunately I cannot write a script this way, even the “option location = …” seems impossible to set.

- platform: influxdb
  api_version: 2
  ssl: false
  host: 172.31.31.31
  port: 8086
  token: !secret influxdb_token
  organization: MEj
  bucket: home_assistant/autogen
  queries_flux:
  - name: "Flux Test"
    range_start: "date.truncate(t: now(), unit: 1d)"
    imports:
      - date
      - join
      - timezone
    query: >
        filter(fn: (r) => r["entity_id"] == "heating_system_kwh")
        |> filter(fn: (r) => r["_field"] == "value")
        |> aggregateWindow(every: 1m, fn: last, createEmpty: false)
        |> last()
        |> keep(columns: ["_value"])
    unit_of_measurement: "kWh"