Troubles integrating influxdb

Hi,
I’m quite new to home assistant and trying to integrate influxdb to homeassistant. Ideally I want the data shown as a time series graph, but one problem at a time.

I get an error I’ve found in two other home assistant posts, but neither were solved, and they’re somewhat old and both using influx api version 1, whilst I’m using version 2. (linked at bottom of this post)

in configuration.yaml:
sensor: !include_dir_merge_list sensors/

in sensors/influxdb.yaml

- platform: influxdb
  api_version: 2
  ssl: false
  host: 192.168.16.156
  port: 8086
  organization: !secret influxdb_org
  token: !secret influxdb_token
  bucket: new_lab_sensors
  queries_flux:
    - group_function: mean
      name: "Data from DB"
      query: 'from(bucket: "new-lab-sensors") |> range(start: -24h) |> filter(fn: (r) => r["_measurement"] == "temperature") |> aggregateWindow(every: 5m, fn: mean, createEmpty: false) |> yield(name: "mean")'

Log Details

Logger: homeassistant.setup
Source: components/influxdb/__init__.py:483
First occurred: 12:27:55 (1 occurrences)
Last logged: 12:27:55

Error during setup of component influxdb
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/usr/local/lib/python3.11/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 483, in setup
    conf = config[DOMAIN]
           ~~~~~~^^^^^^^^
KeyError: 'influxdb'

Other posts:

In configuration.yaml:

Thank you. This resolved the error.
(Now I’m just left with the rest of the HA learning curve.)

And sorry for late reply, I had forgotten to turn on e-mail notifications