More fun with Car Telemetry in Home Assistant

In the part 1 of this project I connected my car to Home Assistant.

In this part, I’ll discuss capturing the data, storing and presenting it. The picture below shows a short journey I made and is presented as a dashboard in Grafana.

Screenshot of a short journey

On the top left, you can see the trip statistics. Bottom left shows a map trace of the car journey. The right side of the screen shows varous sensor data from the car during the journey time.

All these datapoints are constantly updated whenever the car is moving. However to get the best views of this data, I store it in a database (influxDB) and then view it using a graphing tool (Grafana). Both of these tools are free and can be run on a raspberry Pi. With a powerful raspberry Pi 4b, you should easily be able to run Home Assistant, InfluxDB and Grafana on the same device.

I’m not going to go into detail on how to install Influx DB or Grafana. There are lots of pages on the Internet that can help you with that already and I’m assuming that if your the kind of person that likes messing about with Home Assistant, you already know your way around installing these items. So I’m focussing only on the Home assistant integration and some things that might help you store the data and present it successfully.

Configuring Influx DB

From the previous project, we created a sensor in Home Assistant which extracted the car telemetry data from and MQTT topic as below


platform: mqtt
name: “Quashqai Torque”
state_topic: “devices/quashqai/torque”
value_template: “{{ state_attr(‘sensor.quashqai_torque’, ‘GPS Time’) }}”
json_attributes_topic: “devices/quashqai/torque”

Note: If you followed the car telemetry project part 1, your car and car sensor will have a different name.

To store the data feed in influxDB we need to use the sensor that you created and tell Home Assistant to feed the sensor information into influxdb. Add this config to your Home Assistant Yaml files:


host: [your influxdb server iP name]
port: 8086
database: home_assistant
username: home-assistant
password: [your database password]
max_retries: 10

– sensor.[your car name]_torque

I should explain the above configuration a little as there are some idiosyncrasies in Home Assistant on how it stores data to a database. In the Home Assistant sensor, you can see above that I have highlighted ‘GPS Time’ as the value template. This was necessary because Home Assistant only seemed to write data to a database when the state of the sensor changed. So even though individual datapoints(attributes) were constantly changing, it was not being written to the database until the state changed. My solution was to use ‘GPS Time’ for the sensor state, as this is different on every incoming update from the car.

Ok, a quick reboot of Home Assistant and all the car telemtry data should now be being fed into the database.

Configuring Grafana

Grafana is seperate to Home Assistant and requires no configuration in Home Assistant What you need to do is go to the Grafana web interface and create a new database connection to the influxdb da tabase. In Grafana this is called a data source. The datasource config will need:

  • ip address of your database and the port it can be accessed (default is 8086).
  • The influxdb database name and password.

Having done this you can now create a dashboard similar to the one I created. So its up to you to experiment in creating your own dashboard. To show a map of your car journey, you need to use a Grafana plugin called the Worldmap panel. It’s a bit tricky to set up so I offer some pictures of the config below to help you.

Worldmap plugin panel config

Give the Latitude and Longitude datapoints and alias with the same name (above) and then add these aliases to the field mapping section (below).

worldmap plugin panel config

Explaining the dashboard

On my Grafana dashboard, you can see a summary of the last car trip. In the top left we have some data on the journey. Below that , we have a plotted map of the Journey. Then on the right side of the dashboard we can see the data spread out over the journey time. I can expand any of these charts to a large view.

I’ve taken the chart on the bottom right and expanded it (pictrured below). We can see the car journey started at 08:02 am and ended at 08:26 am. You can clearly see the engine took around 10 minutes to get to operating temperature, the load on the engine was around 25% and the short term and long term fuel trims were bouncing between +/- 10% which is within normal parameters.

Long term and short term fuel trims provided a good indication on whether your car is operating normally. For most modern petrol cars these parameters should not go outside the +/- 10% limits. If they do, then your car may have a problem or be beginning to have a problem.

Further development:

So now we have the data what can we do with it? Well loads of things but consider this one as an example:

  • I now have a record of all my car journeys.
  • I could construct alarms or notifications in Grafana (or Home assistant) to warn me if my car was showing signs of a problems by analysing the fuel trim parameters or CO2 emissions etc.
  • I could have Home Assistant provide a health report based on the last journey or even baseline the car performance and look for deviations from the normal operating range to predict a problem.
  • I have another Home Assistant project which allows me control Alexa speech throughout the home, I could include the cars health report into my morning report.
  • I can ask Home Assistant (via Alexa) where the car is at any time. I will have a separate post on this.

2 thoughts on “More fun with Car Telemetry in Home Assistant”

  1. Could you please share more examples. Totally new in Grafana.
    Does Grafana have the ability to share panel configurations?

    1. There are many pages available for Grafana, which detail it better than I can. Suffice to say that once you install influxdb and grafana, it’s not too difficult to create your first chart.

Leave a Reply

Your email address will not be published. Required fields are marked *