Multiple database Influxdb in HA?

Hello.
I’ve read influx documentation and it’s possible, but I don’t know how.
I’ve created two database, one is working.

influxdb:

  host: localhost

  port: 8086

  database: HA_db

  username: XXXX

  password: XXXX

  max_retries: 3

  default_measurement: state

  include:

    entities:

      - sensor.temperatura_comedor

      - sensor.temperatura_despacho_2

      - sensor.humedad_comedor

      - sensor.humedad_despacho_2

I’ve created the second database.

influxdb:

  host: localhost

  port: 8086

  database: Consumo

  username:XXXX

  password: XXXX

  max_retries: 3

  default_measurement: state

  include:

    entities:

      - sensor.horno_current

      - sensor.secadora_current

      - sensor.termo_current

      - sensor.lampara_current

      - sensor.led_micro_current

      - sensor.luz_tv_current

The problem is that logically HA tells me that I have duplicate variables, like “database”, “host”, etc.

In the documentation of HA and Influx I have found anything about it, can anyone guide me?

1 Like

I would not know but I would like to understand why you need 2db…might help answering too :slight_smile:

Good question. Well really for having an order in my head. On second thought, maybe I should have only one database.

I am also interested in having multiple databases. A two-database setup allows some data to be stored locally for a year or two, and all the data to be stored permanently on an external server. Did you find out any solution for this?

3 Likes

I am also interested in this since I already have an influxdb cloud database and I want one locally through the influxdb addon!
Any idea how is this possible???

Some suggested copying the integration from the HA core, renaming it, and importing it as custom_component. Then use the custom component for the other database. It seems like it should work, but I did not manage to do that.

Seems like a lot of work and tinkering!
Maybe it should be added to the official integration!

sad, I keep coming back hoping that there is support for this.

My use case is I want a “prod” bucket in InfluxDB that stores only included sensor data for a long time and a “dev” bucket that only lasts 30 days or so where everything gets dumped to and I can play around with data or figure out what is actually useful to then start capturing in the “prod” bucket.

1 Like

According to HA Discord, this use case is not intended to work. The person behind the InfluxDB integration probably doesn’t even know we’d like such a feature, so he might not even consider it. It might be possible they add this feature if anyone opens a GitHub request. I haven’t been able to do that for some reason and the language barrier would be challenging for me anyway.

Has anyone made progress on this? I’m sending up lots of data to one bucket with a 24 hour retention, using a influx task to move cleaned data to another bucket with a much longer retention. Then I’d like to download data from that second bucket into HA…

I’ve decided to try to use curl to get the data from my second, downsampled bucket. I’ll let you know if I succeed.

1 Like