Smart Home Assistant

Home Assistant InfluxDB and Grafana: Long-Term History Guide

SepehrBy Sepehr· 7 August 2026· Updated 7 August 2026· 7 min read
✓ Independent — no paid placements✓ UK-tested in real homes✓ Cited sources on every guide
Home Assistant InfluxDB and Grafana: Long-Term History Guide
On this page[tap to expand]
Buy the picks in this guide

Recommended for Home Automation

See all devices →

Home Assistant's built-in History and Logbook pages are useful for a quick check, but the default recorder only keeps a rolling window of data — typically 10 days — before older records are purged to keep the database small. If you want to see how your living room temperature trended over the last six months, compare this winter's heating usage to last winter's, or build a dashboard that actually looks like something out of a data centre, you need a proper time-series database and a dedicated visualisation tool. That combination is InfluxDB for storage and Grafana for dashboards, and both are available as official add-ons for Home Assistant OS and Supervised installs.

This guide covers installing both add-ons, configuring the influxdb: integration in Home Assistant's YAML, connecting Grafana to InfluxDB as a data source, and building your first panel.

What InfluxDB and Grafana Actually Do

InfluxDB is a time-series database. Unlike Home Assistant's default SQLite recorder, it is built specifically to store huge volumes of timestamped numeric data — exactly what sensor readings are — and query it efficiently over long ranges. It does not replace Home Assistant's recorder; it runs alongside it. Home Assistant keeps its short-term recorder for the History and Logbook UI, while the influxdb: integration streams a copy of your state changes into InfluxDB for permanent storage.

Grafana is a visualisation and dashboarding tool. It connects to InfluxDB (and dozens of other data sources) and lets you build custom graphs, gauges, tables, and alert rules from the stored data. It is not a Home Assistant product — it is a general-purpose open-source tool used widely in server monitoring and IoT — but it integrates cleanly with Home Assistant's InfluxDB export.

What You Need

  • A running Home Assistant OS or Supervised installation (the add-on store is not available on Home Assistant Container or Core installs — you would need to run InfluxDB and Grafana as separate Docker containers instead).
  • The Home Assistant Community Add-ons repository added to your add-on store. Most users already have this from installing other add-ons; if not, add https://github.com/hassio-addons/repository under Settings → Add-ons → Add-on Store → Repositories.
  • Basic familiarity with editing YAML, either through Settings → Add-ons → File editor or via Studio Code Server.

Step 1: Install the InfluxDB Add-on

Go to Settings → Add-ons → Add-on Store, search for InfluxDB, and select the add-on published under the Home Assistant Community Add-ons repository. Click Install and wait for it to finish — the add-on ships InfluxDB itself along with Chronograf and Kapacitor for optional database administration.

Home Assistant Add-on Store screen showing the InfluxDB and Grafana community add-ons ready to install
The InfluxDB and Grafana add-ons both live under the Home Assistant Community Add-ons repository in the Add-on Store.

Once installed, open the add-on's Configuration tab. The default settings create an admin user and a database/organisation on first boot — note whichever credentials you set, since you'll need them for both the Home Assistant integration and the Grafana data source. Start the add-on and enable Start on boot and Watchdog so it comes back up automatically after a Home Assistant restart.

Step 2: Configure the InfluxDB Integration in Home Assistant

The Home Assistant side is configured through the influxdb: key in configuration.yaml — this integration is YAML-only for its filtering options, though basic connection fields can also be set through Settings → Devices & Services → Add Integration → InfluxDB. Home Assistant's InfluxDB integration supports InfluxDB 1.x, 2.x, and 3.x; the config keys differ slightly by version. For InfluxDB 2.x (the version the add-on installs by default), your configuration looks like this:

influxdb:
  api_version: 2
  host: a0d7b954-influxdb
  ssl: false
  port: 8086
  token: !secret influxdb_token
  organization: home
  bucket: home_assistant
  include:
    domains:
      - sensor
      - binary_sensor
      - climate
    entity_globs:
      - light.*
  exclude:
    entities:
      - sensor.date
      - sensor.time

A few notes on the fields that trip people up. host is the add-on's internal hostname (visible on the add-on's Info tab, usually in the form <hash>-influxdb) rather than an IP address, since Home Assistant and the add-on run on the same Supervisor network. token should be generated from the InfluxDB UI or Chronograf with write access to your bucket, and stored in secrets.yaml rather than hard-coded. The include/exclude block is optional but strongly recommended — without it, every entity in your system streams to InfluxDB, including diagnostic and configuration entities you almost certainly don't want charted. The integration matches an explicit entity list first, then domains, then glob patterns, so you can be as broad or as precise as you like.

If you're on InfluxDB 1.x instead (some older or self-hosted setups), the block uses database, username, and password in place of token, organization, and bucket — and the 1.x database must be created manually before Home Assistant will write to it.

Save the file and restart Home Assistant. If the connection is working, you'll see state changes for your included entities start appearing in InfluxDB within a minute or two — you can verify this from the InfluxDB add-on's Chronograf interface, or by checking the Home Assistant log for any influxdb connection errors.

Step 3: Install the Grafana Add-on

Back in the Add-on Store, search for Grafana and install the Home Assistant Community Add-ons version. Start it, enable Show in sidebar, and open it from the Home Assistant sidebar or directly at port 3000 on your Home Assistant host. Log in with the default admin/admin credentials. On the Home Assistant add-on build, the default admin password can't be changed directly from the UI, so the recommended approach is to create a new user with the Admin role from Grafana's user settings and then delete the original default admin account.

Step 4: Connect Grafana to InfluxDB

Inside Grafana, go to Connections → Add new connection, search for InfluxDB, and select it. On the setup screen, choose Flux as the query language (this is the query language InfluxDB 2.x and 3.x use) and fill in:

  • URL — the InfluxDB add-on's address and port, e.g. http://a0d7b954-influxdb:8086
  • Organization — the same organisation name used in your influxdb: config (e.g. home)
  • Token — the same InfluxDB API token, with at least read access
  • Default Bucket — the bucket name (e.g. home_assistant)
Grafana Add data source screen configured for InfluxDB with URL, organization, token and default bucket fields filled in
Configuring the InfluxDB data source in Grafana using the Flux query language, the same organisation and bucket set in Home Assistant's influxdb: integration.

Click Save & test. A working connection reports back the number of buckets found in your InfluxDB instance. If it fails, the most common causes are a mismatched token, the wrong internal hostname, or the organisation name not matching exactly what's set in the InfluxDB add-on.

Step 5: Build Your First Dashboard Panel

From the Grafana sidebar, go to Dashboards → New → New Dashboard → Add visualization, and select your InfluxDB data source. Switch to the Flux query editor and write a query against your bucket, filtering by entity ID. A basic query to chart a temperature sensor over the last seven days looks like:

from(bucket: "home_assistant")
  |> range(start: -7d)
  |> filter(fn: (r) => r["_measurement"] == "°C")
  |> filter(fn: (r) => r["entity_id"] == "living_room_temperature")
  |> filter(fn: (r) => r["_field"] == "value")

Note that the _measurement value in InfluxDB corresponds to whatever the integration used as the measurement name — by default this is the entity's unit of measurement (controlled by the measurement_attr option), so a temperature sensor typically lands under a measurement named after its unit rather than its entity ID. Set the panel type to Time series, give it a title, and Grafana renders a line graph updating live as new data streams in from Home Assistant.

Grafana dashboard showing a Living Room Temperature time series panel and additional stat panels for humidity and energy, built from Home Assistant data in InfluxDB
A finished Grafana panel charting a week of temperature history alongside stat panels for humidity and daily energy use — all sourced from InfluxDB.

From here, repeat the process for other entities — humidity, energy consumption, or anything else you included in the influxdb: filter — and arrange the panels into a dashboard. Grafana panels can also be pinned as a full dashboard link in Home Assistant's own Lovelace dashboard using an iframe or webpage card, so you don't need to switch apps to check your long-term history.

Common Problems and Fixes

No data appears in InfluxDB. Check the Home Assistant log for connection errors first — a wrong host or token is the most common cause. Confirm the entity you're checking for isn't accidentally caught by an exclude filter, and that InfluxDB and Home Assistant are both running.

Grafana shows the data source is fine but the panel is empty. This is almost always a mismatched _measurement or entity_id filter in the Flux query — use Chronograf (bundled with the InfluxDB add-on) to browse your actual measurement and tag names rather than guessing.

Restarting Home Assistant loses the connection temporarily. This is expected — the integration reconnects automatically once Home Assistant finishes starting, and any missed writes during the restart simply aren't recorded (InfluxDB doesn't backfill).

Is It Worth Setting Up?

For most casual users, Home Assistant's default 10-day recorder and the built-in Energy dashboard are enough. InfluxDB and Grafana earn their keep once you want year-over-year comparisons, custom alerting thresholds Grafana can email or Slack you about, or dashboards that combine Home Assistant data with other sources entirely — server metrics, network throughput, or a solar generation feed, for example. It's a bigger commitment than a stock Lovelace dashboard, but for anyone running Home Assistant as a serious home-data project rather than just light switches, it's one of the most useful additions you can make.

Frequently asked questions

Do I need InfluxDB and Grafana if I already use the Home Assistant Energy dashboard?
Not necessarily. The built-in Energy dashboard covers most household energy tracking needs out of the box. InfluxDB and Grafana are worth adding if you want history beyond the default recorder's retention window, custom alerting, or dashboards that combine Home Assistant data with non-Home Assistant sources in one place.
Can I run InfluxDB and Grafana without Home Assistant OS?
Yes, but not as add-ons — the add-on store is only available on Home Assistant OS and Supervised installations. On Home Assistant Container or Core, you would run InfluxDB and Grafana as separate Docker containers or standalone services, then point the influxdb: integration's host and port at wherever InfluxDB is running.
What's the difference between InfluxDB 1.x and 2.x for Home Assistant?
InfluxDB 1.x uses a database, username, and password for authentication and requires the database to be created manually beforehand. InfluxDB 2.x (and 3.x) use an API token, an organization, and a bucket instead, and the bucket can be created automatically. The Home Assistant integration supports both via the api_version config key.
Does streaming data to InfluxDB slow down Home Assistant?
The influxdb: integration writes asynchronously and is designed to have minimal impact on normal operation, though a very large number of included entities updating frequently can add load. Using the include/exclude filters to limit which entities are streamed keeps both the write volume and the InfluxDB storage footprint manageable.

Sources

Sources verified 2026-08-07

  1. Home Assistant — InfluxDB — Home Assistant Integration Docs
  2. Grafana Labs — InfluxDB data source — Grafana Documentation
  3. Grafana Labs — Configure the InfluxDB data source — Grafana Documentation
  4. Home Assistant Community Add-ons — InfluxDB Add-on — hassio-addons/addon-influxdb
  5. Home Assistant Community Add-ons — Grafana Add-on — hassio-addons/addon-grafana
  6. Home Assistant — Recorder — Home Assistant Integration Docs
  7. Unsplash — Data reporting dashboard on a laptop screen — Stephen Dawson
How we researched this

Claims in this article are checked against primary sources — manufacturer specifications, official documentation, Which? research, Ofgem guidance, or gov.uk — rather than forum threads or video reviews. Where the author has direct hands-on experience with a product (most Home Assistant, Zigbee, and home-networking gear is running in his own homelab), that is stated explicitly in the text.

For categories outside that personal setup — such as boilers, heat pumps, and other areas that are traditionally a heating engineer's domain — verdicts are built from cross-referenced manufacturer data, published lab results, and vetted expert and owner reviews rather than a claim of personal hands-on testing. See the editorial policy for the full methodology.

Sepehr

Written by

Sepehr

10+ years hands-on with Home Assistant & networking · Research-backed elsewhere · No brand deals

Smart home specialist with 10+ years running a self-hosted Home Assistant setup — Zigbee2MQTT, Frigate NVR, and local-first automations. Independent coverage for UK homes, no brand deals.

LinkedIn →

Related reading