Custom Home Assistant integration that exports Home Assistant entity state changes as OpenTelemetry metrics to an OTLP endpoint.
It is meant for setups where Home Assistant data should be available outside the built-in Home Assistant UI. Instead of keeping telemetry only in Home Assistant dashboards, history views, and recorder-backed charts, this integration sends entity measurements to a standard OpenTelemetry pipeline so they can be stored, queried, correlated, and visualized in tools such as Grafana, New Relic, and other OTLP-compatible backends.
In practice, it solves a simple problem: Home Assistant is good at automation and local status views, but it is not a general observability platform. This integration lets you treat Home Assistant signals like regular telemetry data.
- Config flow based setup
- OTLP over gRPC or HTTP
- Optional authorization header support
- Selectable entity domains
- Configurable export interval
- Open HACS.
- Go to
Integrations. - Open the menu and choose
Custom repositories. - Add
https://github.com/Grandys/otel-exporterwith categoryIntegration. - Install
Home Assistant OpenTelemetry Exporter. - Restart Home Assistant.
- Copy
custom_components/otelinto your Home Assistantcustom_componentsdirectory. - Restart Home Assistant.
Open the config flow directly in your Home Assistant instance:
- In Home Assistant, go to
Settings -> Devices & services -> Add integration. - Search for
OpenTelemetry Exporter. - Enter:
- OTLP endpoint
- protocol (
gRPCorHTTP) - optional authorization header
- After setup, open the integration options to choose exported domains and export interval.
This repository includes a local example stack:
- Home Assistant started from the Python virtual environment
- OpenTelemetry Collector started by Docker Compose
- Grafana LGTM started by Docker Compose
- Demo Home Assistant entities in config/configuration.yaml that emit changing values automatically
If you do not already have .venv:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtIf .venv already exists:
source .venv/bin/activateRun:
./scripts/developThis will:
- start the local Docker stack from compose.yaml
- start the OpenTelemetry Collector using otel-collector/config.yaml
- launch Home Assistant with the local config in config/configuration.yaml
Open Home Assistant and add the integration from Settings -> Devices & services -> Add integration.
Use one of these local collector endpoints:
- gRPC endpoint:
http://localhost:4317 - HTTP endpoint:
http://localhost:4318/v1/metrics
Recommended local settings:
- protocol:
gRPC - authorization header: leave empty
- exported domains: include at least
input_boolean,input_number, andsensor - export interval:
10or15seconds for quick local feedback
The local config includes demo signals:
input_boolean.otel_demo_enabledtoggles every 15 secondsinput_number.otel_demo_temperaturechanges every 15 secondssensor.otel_demo_poweris derived from the demo temperature
That means the exporter should continuously send changing metrics without any manual interaction.
Open LGTM at http://localhost:3000.
What you should expect:
- the Docker stack contains both
lgtmandotel-collector - the collector accepts metrics on ports
4317and4318 - the collector forwards metrics into LGTM
- after the integration is configured, you should start seeing Home Assistant metrics appear within a few export intervals
In Grafana, look for metric names such as:
ha.input_boolean.stateha.input_number.stateha.sensor.generic
You should also expect labels like:
entity_iddomainfriendly_nameunit
For the bundled demo setup specifically, the most useful entities to filter on are:
input_boolean.otel_demo_enabledinput_number.otel_demo_temperaturesensor.otel_demo_power
If everything is working, the Grafana graphs should show:
- a toggling boolean signal for
otel_demo_enabled - a step-like changing numeric signal for
otel_demo_temperature - a matching derived numeric signal for
otel_demo_power
- Confirm
docker compose psshows bothotel-collectorandlgtmrunning - Confirm Home Assistant accepted the integration configuration
- Check the Home Assistant log output in the terminal started by
./scripts/develop - Check collector logs with
docker logs <collector-container> - Verify the endpoint/protocol pair matches:
http://localhost:4317withgRPChttp://localhost:4318/v1/metricswithHTTP
scripts/setupinstalls local development dependencies.scripts/developruns Home Assistant with the bundled test configuration.scripts/lintruns formatting and lint checks.
custom_components/otelcontains the HACS-installable integration.configcontains the local Home Assistant development configuration..github/workflows/validate.ymlrunshassfestand HACS validation.
- Issues: https://github.com/Grandys/otel-exporter/issues
- HACS publishing docs: https://hacs.xyz/docs/publish/start/