InfluxDB is a fantastic integration in HA. Thank you for providing it.
[ InfluxDB - Home Assistant ]
The existing integration writes/stores values from Home Assistant to an external InfluxDB database. It’s helpful for use cases including longer retention and building Grafana Dashboards around sensor data.
Feature Request - Ability to write to more than one InfluxDB Database
Use case:
I store all HA sensor data in an external Influx (v1.8) database. This request is to enable writing to multiple databases on the same InfluxDB server. A closely related feature it could enable is the ability to write to Influx databases on multiple hosts.
This would enable the following additional use cases:
- Storing specific sensors into other existing databases (example, long term weather record keeping)
- Enabling users to have a cloud based InfluxDB in additional to a local database. This can be for backup/redundancy uses or for publishing sensor data in a publicly accessible database outside of the home network
The feature would be implemented so multiple databases could be configured under the influxdb:
root in configuration.yaml
. All of the parameters currently supported (host:
, database:
, etc) should be supported under the addition of a YAML sequence named instance
.
Example current configuration:
influxdb:
host: <HOST_IP>
database: home_assistant
Example proposed configuation with new feature:
influxdb:
- instance: 1
host: <HOST_IP>
database: home_assistant
- instance: 2
host: <HOST_IP>
database: weather_db
include:
entities:
- sensor.temperature_tempest
Backward Compatibilty
This would not be a breaking change to existing InfluxDB integration users.
- The YAML supports both single mappings and sequences of mappings
- The existing format maps directly to an “instance” in the new format
When implementing, the code would:
- Check if configuration is a sequence (new format)
- If not, treat single mapping as default instance (old format)
- Process each instance accordingly
Impact
7.2% of the active Home Assistant installations use the InfluxDB integration. That is a lot of users!
A quick search revealed other users requesting a feature like this: