Writing data to InfluxDB


This is a crosspost of my issue topic on the Home Assistant forums which can be found here.

I have an issue with writing event data from HA to an InfluxDB bucket.
in short, it boils down to this; The HA debug logging for the InfluxDB integration reports it is writing data but I am unable to find any data in InfluxDB.

2022-08-27 13:06:13.822 DEBUG (influxdb) [homeassistant.components.influxdb] Wrote 26 events.

I run HAOS 8.5 (Core 2022.8.6) in a KVM instance on my TrueNAS-SCALE- NAS.
I run InfluxDB 2.4 in an influxdb2022.0.0 Docker container from Docker’s official images hub on the same NAS.
HAOS is able to access the influx container across a bridge interface.

the influx config in HA is as follows (from this guide);

# saving data to influxdb
  api_version: 2
  ssl: false
  host: [influxdbdockerIP]
  port: 8086
  token: [tokenthathaswriteaccess]
  organization: bb87ec5d0a46acb1
  bucket: home-assistant
    source: HA
    - friendly_name
    - device_class
  default_measurement: units

If I change this config to something I know will not work, I get errors in my HA log - example, if I change the host ip;

2022-08-27 13:17:48.103 ERROR (SyncWorker_7) [homeassistant.components.influxdb] Cannot connect to InfluxDB due to ‘<urllib3.connection.HTTPConnection object at 0x7f8c966efbe0>: Failed to establish a new connection: [Errno 113] Host is unreachable’. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible. Retrying in 60 seconds.

Likewise, if I update the config so it is correct but turn off the docker container, I get a similar message - so I know that HA can see and validate that InfluxDB is there and is sending data, I just don’t see that data arrive in InfluxDB.

The token in use has write access to the bucket mentioned, not that it matters, if I change the token to a new one with RW or the local admin one created during initial setup, then I get the same result; HA reports it’s writing data but nothing appears in InfluxDB.

I can check that InfluxDB is active and listening with the following curl;

curl -sL -I <influxiphere>:8086/ping

And that gives me a 204 HTTP response which is a success;

So everything I have avbailable to me says I’m writing data to InfluxDB but the Data Explorer is giving me a whole lot of nothing.

I’ve gone through a multitude of HA topics in their forums, their discord and checked github issues but nothing jumps out at me as being related.

Hello @Obsidi88,
Can you please share a screen shot of how you’re trying to query data with the data explorer?

Also have you tried writing data through the UI or cURL just to make sure you can?
UI: (I’d try line protocol like: weather,location=us-midwest,season=summer temperature=82):

cURL: Write data with the InfluxDB API | InfluxDB Cloud Documentation