Connect Home Assistant with an external InfluxDB (v2)

I assume that the InfluxDB is already running.

Create a bucket and create an API token:

  1. load data, buckets, create bucket.
  2. API Tokens, Generate API Tokens, Custom API token. A ReadOnly token for the new bucket is sufficient here.

Create database connection in Home Assistant.

We store the InfluxDB-Config in a separate .yaml file. This keeps the configuration.yaml somewhat clearer.

We add the following to configuration.yaml:

configuration.yaml
influxdb: !include influxdb.yaml

Now we create the influxdb.yaml

In this case i only want so store some values, so i use “include”, you can also use exclude. See: InfluxDB – Home Assistant (home-assistant.io)

influxdb.yaml
api_version: 2
ssl: false
host: influxdb.lan
port: 8086
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==
organization: your_organization
bucket: your_bucket
include:
    entities:
      - sensor.temp_govee_out_a8_e2_temperature
      - sensor.temp_govee_terrasse_1d_50_temperature
      - sensor.temp_govee_kinderz_ae_13_temperature
      - sensor.temp_govee_lueftung_c5_95_temperature
      - sensor.temp_govee_schlaf_fa_60_temperature
      - sensor.toyota_aktuelle_tagesstatistiken
      - sensor.toyota_kilometerzahler

Finally, restart HomeAssistant and the data will be written to the InfluxDB.