Can't get HA to connect to Influx DB

Hello, I can’t get Influx DB to work with Home Assistant. I have used Influx DB on a previous HA installation and didn’t have any issues at all, just followed the instructions and it worked. But not now.

In HA, I get this error message:

Cannot connect to InfluxDB due to 'HTTPConnectionPool(host='localhost', port=8082): Max retries exceeded with url: /write?db=homeassistant (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xae894178>: Failed to establish a new connection: [Errno 111] Connection refused'))'. 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.

in my config.yaml:

influxdb:
  host: localhost
  port: 8082
  database: homeassistant
  username: homeassistant
  password: password
  max_retries: 3
  default_measurement: state

I have created a database name homeassistant, a user named homeassistant and set permissions to all.

I have tried to use a0d7b954-influxdb, localhost, 127.0.0.1, my local ip, my external ip, my duck dns domain as host, all fails.

I also had a weird issue when adding the database to grafana, it wouldn’t let me connect when entering localhost as an address (which has worked for me before) but worked when I used my local ip. Also influx glitched out a few times when setting up database and user, after adding db and user they get deleted by themself and I couldn’t add new user/db, I get some “auth 401 error” but was resolved by reinstalling Influx DB.

After googling the error message I can see a lot of people had the same issue, mostly with older versions and was resolved when updating to the newest version. I am, however, using the newest releases. HassOS 4.17, 2020.11.0, InfluxDB 3.7.9. Running on a RPi 4.

Any ideas on how to get it working?

Hi, I’m having the same problem, did you mange to resolve the problem?

1 Like

I solved this problem by formating the SD card and reinstalling HA… Then it worked flawlessly. Not an ideal way to fix broken stuff trough…

I think I had to change the database name to something else than homeassistant…
Strange that it worked, but it worked :smiley: