Car Telemetry in Home assistant

Wouldn’t it be cool if you could get live data from your car and feed that into Home Assistant?

Well it seemed cool to me and now that I am writing about it, I am forced to come up with some good reasons as to why you dear reader, might do this. So I will jot down a few reasons here. But for me (and probably you), the real reason we do these things is for the joy of investigating how to do it and then making it happen.

Reasons for integrating car telemetry into home assistant:

  • Always have an up to date map position of where your car (or the family car) is and get notifications when it arrives home.
  • Store data on the performance of your car journeys, such as fuel used per trip, CO2 used per trip, engine performance etc.
  • Chart the performance of your car over time using ODB2 parameters such as LTFT, STFT and MAF and other metrics and warn of possible engine faults before they fail.
  • Keep a log of car journeys.
Screen shot from Grafana showing a recent car journey

Where to start

Firstly, you are going to need the right hardware. This is essential to get a reliable data feed into Home Assistant which doesn’t fail (very often) and means you can just forget about things and they will just happen. This is not necessarily a cheap project, although I will offer some alternatives as to how you can lower the price or use your own smartphone rather than purchasing expensive hardware for your car.

Hardware needed:

  • An ODB2 Bluetooth or WIFI car transmitter. Nearly all modern cars in the EU and USA have a service port somewhere under the car dashboard which provides live data from many sensors within your car engine.  I use a cheap ODB2 receiver to grab the sensor information and transmit via bluetooth to my android device. Its also important for this project to pick the right ODB2 receiver.  You need one which goes into sleep mode automatically and even more importantly, wakes up when it receives a Bluetooth connection attempt. Most cheap ODB2 receivers do not do this, so I am recommending the one I have working which is the Vgate Icar Pro. BT3.0 version should work fine. Bluetooth low energy version is not necessary.
  • An android device (v8 or later). I have two options here, which have different advantages:
    • Option 1 – Expensive option: swap out your car stereo
      • Use an in-car entertainment system based on android. I have a Nissan Qashqai and swapped out my factory installed car stereo for an android head unit from a company called Joying. (https://www.joyingauto.com). Joying are well known for their good value after-market car stereos based on android.  This is another subject in its own right, so I cannot advise you here on what the best after market car stereo for your own vehicle might be. However, I do think Joying probably have a solution for your particular car.  There are many advantages of replacing your basic car stereo for an android stereo, but for the purposes of this project it provides dedicated hardware in which to host the ODB2 software (Torque).
      • An in car mobile data usb dongle.  I use this model in the UK, but you can use whichever suits your country. Obviously, what we are doing here, is providing a mobile data connection so that information can be sent back to your home. As a side benefit, you get in car wifi.  In the UK, it is also simple to purchase a no contract data sim with a set amount of data.  Here is an example. The key thing to look for is a data sim which allows your data to be spread over 12/24 months. By the way, this project will use very little data. The bulk of my data use on the usb dongle, is to stream internet radio, you tube and run google maps in the car.

Tip: Some of the newer Android car stereo models from Joying now include a built in 4g mobile module so purchasing a separate dongle is not necessary.

  • Option 2 – Cheaper option: use an android smartphone
    • Whilst this option will work, it only works when your smartphone is in the car. If you share your car, then this is not ideal to capture every journey.

Software needed:

  • Llamalab Automate (available on google play). If you have never heard of this app before, it is a visual scripting tool which allows you to do a lot of clever things on your android device. It is similar to a product called Tasker, but I really like the visual scripting language. Also if you choose this product you will be able to download my pre-prepared script to grab the ODB2 data and post it to Home Assistant.
  • Torque lite (or pro). This is a very popular application which runs on android devices and connects to ODB2 receivers. It can be used to show the data in the application, but for this project we will be using its data logging capabilities.
  • MQTT Broker (like mosquitto). It’s likely that your Home Assistant server is already running an MQTT server for other devices, but just in case it is not, you need to run an MQTT server and configure in Home Assistant.

Step 1 : Installing the ODB2 adapter and Torque software:

So assuming you have the components I have described above, the first thing to do is install the ODB2 dongle into your car ODB2 Port. Your car manual should tell you where the ODB2 port is if you cannot find it. Once found, it is simply a matter to plug it in. I should warn you that you do this at your own risk. I can’t be held responsible for any damage resulting from this. I and many people have installed these devices without any problems. If you purchased the model I recommended, then it should be safe to leave this device in the ODB2 port permanently. I have had it in place for over a year. When disconnected, it will power down and will not drain your car battery.

Installing Torque Application:

Turn on your car ignition so there is power to the ODB2 receiver and then on your android device, go to the bluetooth setting and search and pair to the ODB2 receiver.

Now install Torque lite (or pro) onto your android device. The app will ask you to complete some information to profile your particular car.  If you are lucky the app will automatically connect via Bluetooth to your ODB2 adapter. If it does not connect, go to the Torque settings and check the ODB2 adapter settings. The front screen always shows a tachometer, and when there is a successful Bluetooth connection, the current revs of your engine will be shown.

Now that we have a successful connection, we need to set up the logging. Go to ‘settings’ and select ‘Data logging & upload’.   Complete the following settings below:

Select what to log:

The first thing you are going to do is select the data set that you want to log. These datasets are called PID’s in the ODB2 protocol.  The specific dataset (PID’s) available from your car will be dependent on what the cars manufacturer is willing to provide over the ODB2 interface. The Torgue app makes this simple for you by highlighting the PID’s available in light green. I recommend you choose 1 or 2 PId’s for basic testing at first.

Synchronous logging file log interval: off

File logging interval: Choose 5 seconds.

Log when Torgue is started: Yes

Only when ODB connected: Yes

Automatically log GPS: Yes

Rotate log files: No

Ok, to recap. We have installed the ODB2 adapter and paired it to the android device. We have installed the Torque app and configured it to connect to the ODB2 adapter and log some data continuously to always run in the background (we will automatically restart the app using a script later).

Step 2 : Configure Home assistant access and security:

For the next step we need to prepare Home Assistant to receive data from an external device and to do this we are going to use the ‘services api call’ available in Home Assistant. But first, a word on accessing Home Assistant through your home network router.

Clearly Home Assistant needs to be accessible from the internet so that your car can communicate to it. But we don’t want any bad actor hacking your Home Asistant server, so we need to implement some security. I’m going to assume that as a user of Home Assistant, you are already aware of how and why you should implement SSL security to access your server. If you have not yet implemented security, this project will still work but will be, well , less secure.

We are going to communicate to Home Assistant using the services api. For security, we are going to set a password which must be provided for any external device connecting to the API. Choose a nice long one. This is defined under the auth_providers section. See example below.

  auth_providers:

    – type: legacy_api_password

      api_password: [your_api_password]

Update on Security. The above method of security is no longer recommend. Home Assistant have made several advances in implementing security in recent versions and you may choose an alternative secure way of posting data to Home Assistant using ‘long lived tokens’. The Llamalab Automate script I have created now supports long lived access tokens. Simply create an access token in Home assistant and take a copy of the security string provided for later use.

Step 3: Installing Llamalab Automate:

On your android device, install Llamalab Automate from the Google play store. Then go to the Llamalab community section in the app and search for a script called ‘Car Telemetry to Home Assistant’.  Download the script posted by me (Robert Cunningham) and open it.

We are going to instruct Llamalab Automate to send data to your particular Home Asssitant instance. To do this we use the HTTP request block in Llamalab Automate. An HTTP request to home assistant would look like this:

https://[Your Home assistant server domain address]/api/service/mqtt/publish

Note: my Home assistant server connection is SSL Encrypted. Yours may or may not be. I’m not judging.

Llamalab Automate presents scripts in a visual friendly block diagram. Each block represents a task and then is linked to the next task by a line. The code is all visible for you to review. Here is what my script will do:

  • At startup, get some information from you to communicate with your own instance of home assistant and store it on your device.
  • Wait until a new log file called Torque.log appears on your android device. (when a file is created we know that the Torque app has connected to your ODB2 receiver and is recording data)
  • Scan the header of the file to obtain the names of each PID you selected to log and store it.
  • Scan the last line of the log file for the latest PID dataset (which is appended to the log every few seconds by Torque).
  • Format the data into a JSON format message ready for acceptance by Home Assistant. (Home Assistant will pass this data to the MQTT server).
  • Construct a HTTP Post request to the Home assistant services API, containing your user authentication and the payload.
  • Confirm the data was received by Home Assistant.
  • Repeat sending the data until the car engine is switched off (journey end).

There are a few additional features which you can also benefit from in my script:

  • Scan the immediate area for bluetooth devices. (I use this to report who is in the car, but you don’t strictly need this).
  • Sends information in the correct format to be used by the ‘owntracks’ integration to Home Assistant. This allows your car to show up on the map in home assistant.

Step 4: Inserting long lived access token into Llamalab Automate script:

If you are using a long lived access token in HA, simply run the Automate script and complete the questions. When asked for a token, paste in the access token you noted down from Home Assistant earlier. It should read as follows … Bearer xxxxxxx….(long list of characters). The information you inputted will be stored in a file called /torqueLogs/car_config.json. if you need to change this information, delete the file before you re- run the script. The token never leaves your device.

Step 5: First test:

OK, this completes the basic setup stage. We have configured Home Assistant to accept secure messages and publish them to your internal MQTT server. We have set up your android device to connect to the Cars ODB2 port, receive the data and log the data. We have configured the Llamalab Automate script to transmit the data in a suitable format to Home Assistant. With these basics in place, you should be able to test it out.

Run the Torque App and the Automate Script. If everything has gone well, you should be able to turn on your car engine and data should start flowing. Of course, I’m sure you will have to work out any little bugs in your setup. With the Automate script running you will begin to see messages in the Automate script log. If you are seeing messages like, ” Rest Post success:Torque data:200″, then this means that the messages are getting through to your Home Assistant server correctly. If you a seeing exception messages or “catch Failure” messages, you will need to debug the problem. Some tips from me are below:

  • Remember that if you are not using SSL security on your Home Assistant server then the http blocks we looked at earlier need to be ‘http’ requests, rather than ‘https’ requests.
  • Check Torque is creating a log file called Torque.log and that the LlamaLab Automate script is picking up that log file from the correct location on your android device.
  • Check in the Llamlab Automate Log that Home Assistant is returning a HTTP post response of value 200. This essentially means that Home assistant received the data and the format of the data was acceptable to it.
  • Check your MQTT server and search for the topic called ‘devices/[car name]/torque’. This should now contain a JSON packet of Torque data from your car.
  • if the MQTT topic is updating, but there is no payload, investigate further on what data is being sent to HA from the script blocks.

I’m sure there might be a few stumbles along the way, and its impossible to predict what might have gone wrong for you, so you might need to debug your HA setup and the llamlab script, but if everything is OK it should now automatically start reporting telemetry from your car into your MQTT server..

Step 6: Home Asisstant Configuration

The last step should be familiar to an Home assistant User. The Home Assistant configuration needs a sensor to make the data available. This is easily done now by adding the following lines to the configuration.yaml file.

  • 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: Since I drive a Quashqai, this is what I have named my sensor. You should replace with the name you gave your car in the Automate script. Also, it is important to make sure GPS Time is the state attribute as it is always changing and therefore HA will always update the sensor on a state change.

Screenshot of the Car telemetry sensor in Home Assistant

Finally

So now we have the data in Home Assistant. I will leave you to decide how you present the data and what ingenious automations you come up with. I share my setup below to give you ideas. In a later post, I’ll show how I record the data to a database and present it in the grafana data visualisation tool.

Some longer term issues to note:

It’s been fun learning how to do this project, but I should make you aware of some feedback over the longer term.

  • 2 years or more later. The android car stereo and ODB2 Bluetooth adapter have performed well without any intervention from me. It took a while to craft the llamalab script to make it reliable so please benefit from my learning.
  • If the car engine is turned off and on in quick succession, you may get some broken trip reports as Torque App has cleared the log and started a new journey. So this can happen when you make a fuel stop. The data will still be captured but will be reported in Grafana as two trips.
  • Llamalab Automate may fail on occasion to send data to Home assistant because your mobile network connection in your car is unreliable. I have made the Automate script resilient so the script should not crash, but you may get some gaps in the data.
4.9 9 votes
Article Rating
Subscribe
Notify of
guest

113 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
DobriyS
DobriyS
5 years ago

Does not work. Do with the help 4a option. But the message “Login attempt or request with invalid authentication” comes from the Home Assistant”. Need help!

DobriyS
DobriyS
5 years ago

sorry, my mistake, I use 4b method with long lived access token and have this message “Login attempt or request with invalid authentication”

Robert Cunningham
5 years ago
Reply to  DobriyS

Try downloading the llamalab script again. Ive made some changes that should help.

DobriyS
DobriyS
5 years ago

Tried. Not help. All the same, HA writes the error that I wrote above. In the HA settings, I don’t have any restrictions on networks. I use DuckDNS and SSL. If it helps, here is a link to the logs. I changed the real address there, of course. https://yadi.sk/d/_esUNlcqoLBEBA

Robert Cunningham
5 years ago

So your flow log shows a 401 error, which means you are connecting successfully, but HA does not like your authorisation code. I looked in your car_config.json file and see that your token is not correct. It needs to have “Bearer xxxxxx…” at the beginning. That’s bearer and then a space and then your token key. I think it should work for you then.

DobriyS
DobriyS
5 years ago

Could you please send me to my email (gp_astron@mail.ru )how should correct car_config.json file looks like. I don’t know word “Bearer” and Google translate didn’t help me in understanding. Sorry 🙂

Robert Cunningham
5 years ago

See copy in your e-mail.
Also this link helps explain.. https://swagger.io/docs/specification/authentication/bearer-authentication/

DobriyS
DobriyS
5 years ago

Oh, now I understand 🙂 Thanks a lot, I will try it tomorrow.

DobriyS
DobriyS
5 years ago

Test it with “Bearer token” and it works! Thanks for your help!

Miguel Rodriguez
Miguel Rodriguez
5 years ago

Congratulations, incredible project. It works perfectly for me.
Now I have to see how to automatically start Torque and Automate when I turn on Android Car Radio.

Philip Hill
Philip Hill
4 years ago

Hello – this really looks interesting. So does this work with the current version of Torque because the app states that webserver must respond with an “OK”? Does HA actually respond or is this something new? Also, I use NabuCasa which gives me a direct SSL connection to my HA device via some long, random URL; however, it doesn’t appear to work. When your script prompts for the Domain do you just use the “HA address” and not include “/api/service/mqtt/publish”?

Philip Hill
Philip Hill
4 years ago

I finally got data into my HA; however, I get the escape characters being sent via MQTT (see below)

{
“payload”: “{\”_type\”:\”location\”,\”tid\”:\”me\”,\”acc\”:,\”batt\”:77,\”conn\”:\”m\”,\”doze\”:false,\”lat\”:,\”lon\”:,\”tst\”:}”,
“topic”: “owntracks/homeassistant/mercedes”,
“retain”: “True”
}

And when I create a MQTT sensor in HA in never triggers. (see below)

owntracks:
max_gps_accuracy: 100
mqtt_topic: “owntracks/homeassistant/mercedes”

sensor:
– platform: mqtt
name: “Test Battery”
state_topic: “owntracks/homeassistant/mercedes”
unit_of_measurement: ‘%’
value_template: “{{ value_json.batt }}”

Are you having similar issues and do you think it’s related to the escape characters?

Oktay Oner
Oktay Oner
4 years ago

Great project and thanks for all the effort.

I tried it today, but the only MQTT message I get is:

/devices/Polo 6R/torque

{}

and another MQTT message with:
“time”: “actual time and date”
“occupants”: “3 MAC-addresses”
“speed”: “0”

If I open the TorqueLog, everything looks fine, except that all the data isn’t seperated in the rows, but all the data is in 1 cell.

If I import the log into a Torque viewer, it shows normal data.

James
James
2 years ago

Was there a solution to this? I am having the same issue – MQTT explorer shows the right topic (devices\focus) but displays “time” “occupants” “bytes_downloaded” “bytes uploaded” “lat” “lon” “acc” “speed”

I’m trying to find a way to review the automate script on my computer, but I was hoping someone else had a solution to this?

Chris
Chris
4 years ago

Thanks for taking the time to write this up. This could well be my next corona lockdown project.

Any suggestions for what would be the most basic suitable android phone to purchase 2nd hand? I’m purely Apple but I’ll concede this project will work better with a dedicated android phone in the car.

Donovan Vesters
Donovan Vesters
4 years ago

@Robert Cunningham:

Super cool project. I’m a big fan of HomeAssistant (using it sinds v0.30, I thing it whas 2016 ).

A friend of mine told me last fryday that I can pull data from my car.
Me: realy not a car person, “what really, … data from my car?…” A few seconds later I was browsing your site a few minutes after that, I bought a “vgate icar pro bluetooth 4” 

So, thx for sharing!
Great project!

Grtz, Donovan

Aaron
Aaron
3 years ago

Hi, I’m testing this but the config doesn’t seem to work:

Invalid config for [sensor.mqtt]: invalid template (TemplateSyntaxError: unexpected char ‘‘’ at 14) for dictionary value @ data[‘value_template’]. Got ‘{{ state_attr(‘sensor.silverado_torque’, ‘GPS Time’) }}’. (See ?, line ?).

Nevermind, figured it out. Can’t copy and paste your config because the ” character is not the same as the one that HA expects.

Last edited 3 years ago by Aaron
SebFas
SebFas
3 years ago
Reply to  Aaron

Also should be ‘

Luke
Luke
3 years ago

Which Vgate Icar Pro model did you use? BT 3.0 or BLE 4.0?

Adam
Adam
3 years ago

Hey, just came across this article and was amazed with the idea! Never thought to get my old 2008 cars data into HA! I might have a go at the android phone idea but I’m a bit worried about battery drain, do you think it would be possible to just have an NFC tag in the car somewhere and set the automate app to do something like “When I scan the tag, connect to the device, upload all files in the folder and then delete them all” ? Would then mean I can just send over a load of data… Read more »

Adam
Adam
3 years ago

I don’t mind the phone connecting to the device but it’s more the battery drain of continuously transmitting that data back home over 4G. I don’t need it realtime in HA so it would be useful to just “automatically” upload that data at the end of a trip, or just upload whatever is new when NFC tag is tapped. If that clears up what I meant!

Last edited 3 years ago by Adam
snipes
snipes
3 years ago

Thanks for documenting this! I ran the script and inputted all my details but for some reason the Automate app logs only show:

  • Atomic Store
  • File delete
  • App start
  • App in foreground?

It then stops there and runs but nothing looks to be coming into homeassistant/mqtt server. any ideas where else to look to see what is happening?

snipes
snipes
3 years ago

Ah ok thanks Robert! that definitely got it a little further, it’s still populating data into my mqtt server but I haven’t had a chance to dig more into the logs. Thanks for responding so quickly!

Mon Rod
Mon Rod
3 years ago

Hi Rob, would you know of an app that works on a PC? Thanks for sharing this awesome project!
-Mon

sondreen
sondreen
3 years ago

Is there any straightforward way to utilize this if I run a broker seperate from HAs instance? I’ve gotten an external url configured and I’m running mosquitto on ubuntu if that’s any help. Thanks for any help!

Philip Boydell
Philip Boydell
3 years ago

Hello, I am trying to get this up and running however my phone wont allow me to check the privileges box for “appear on top….” I get the message its disabled as it slows your phone down.(its only a cheap android 10 unit I was going to leave in the car” I have followed all the steps and watched the video by “make it work” who uses your instructions. Upon starting the flow I get a “Stopped by failure” message, is this because of the unchecked privilege or have I got something else wrong too? I only see 1 sensor… Read more »

Djmalin
Djmalin
3 years ago

Hello i have this problem, my log, whats wrong im do 08-05 17:36:39.511 I 114@452: Flow beginning 08-05 17:36:39.511 I 114@1311: Fork 08-05 17:36:39.524 I 114@1535: File exists? 08-05 17:36:39.530 I 115@1309: Broadcast receive 08-05 17:36:39.539 I 114@1403: File exists? 08-05 17:36:39.547 I 114@1669: File read text 08-05 17:36:39.556 I 114@1670: Variable set 08-05 17:36:39.556 I 114@1671: For each 08-05 17:36:39.557 I 114@1672: Dictionary put 08-05 17:36:39.557 I 114@1671: For each 08-05 17:36:39.558 I 114@1672: Dictionary put 08-05 17:36:39.559 I 114@1671: For each 08-05 17:36:39.562 I 114@1672: Dictionary put 08-05 17:36:39.562 I 114@1671: For each 08-05 17:36:39.563 I 114@1672: Dictionary… Read more »

Djmalin
Djmalin
3 years ago

Ok, I deleted this block as you wrote, and I managed to connect to the car and ha, thank you for your help and a good job

Andrew
Andrew
3 years ago

This is fantastic, thank you so much!

Arjen
Arjen
3 years ago

I was struggling to make it work and I noticed that my token was ‘only’ 163 characters. maybe this is a bug when you copy it with android? Anyway I have downloaded the car_config_json and created a new token ( now with 183 characters) on the pc and edited the json file and uploaded it again.
Now all is working! 🙂
Also a tip if you made a mistake and you want to re enter the config just delete de car_config_json file which you can find on your phone in the torquelogs folder

Last edited 3 years ago by Arjen
Tarik
Tarik
3 years ago

anybody know why Home assistant config is saying this?

Integration error: sensors – Integration ‘sensors’ not found.
I cant seem to find torque addon or integration anywhere

Last edited 3 years ago by Tarik
tismo
tismo
3 years ago

I think I messed something up in the script in automate, is there any way to start it over?

tismo
tismo
3 years ago

I keep getting this error [javax.net.ssl.sslhandshakeexception: connection closed by peer]

I cant figure out why. can you help?

tismo
tismo
3 years ago

it seems my comment didn’t save yesterday.
I keep getting this error ” http post failure at block 1359 javax.net.ssl.sslhandshakeexception: connection closed by peer”
any idea what might cause this error?
I have HA external URL setup with duckdns. latest firmware on both supervisor and core.
mqtt also setup and checked with mqtt explorer.

Last edited 3 years ago by tismo
Tarik
Tarik
3 years ago

are you still maintaining this script?

Last edited 3 years ago by Tarik
Mitch
Mitch
3 years ago

Its working quite well for me. Thank you for sharing all this! One thing, I cant seem to find how to upload ‘odometer’ or ‘total miles/km’ in the Torque app. I search through the list of things I can upload from Torque to HA but none of the options seem to be for total miles the car has driven. What am I missing? Anyone else have this issue or just me?

Mitch
Mitch
3 years ago

After a quick google search I found the below 🙁 anyone have a way of pulling odometer readings?

Why OBD-II dongles are bad at verifying mileage

Inaccuracy: It might surprise you, but on-board diagnostics dongles aren’t able to access a vehicle’s actual odometer reading. Instead, OBD dongles calculate a car’s approximate mileage information based on its location as well as the start and end of the driver’s trips.

Rafal
Rafal
3 years ago

Thanks for the script! It was working perefctly for a few days.. but suddenly, Torque Pro stopped to create “trackLog.csv” in sd card folder, but instead it creates it in secured location “Andorid/data/com.prowl.torque/files/torqueLogs” Any idea how to fix it?

Rafal
Rafal
3 years ago

You’re right, update is broken. I installed one version earlier and it is working

Mitch
Mitch
3 years ago
Reply to  Rafal

good to know! thanks I will not update.

Marco
Marco
3 years ago
Reply to  Rafal

Same here…. 🙁

Marco
Marco
3 years ago
Reply to  Rafal

I’m going crazy in these days because i didn’t find the tracklogs.cvs…

Marco
Marco
3 years ago

it continues to show “file not found”, i have to try after installing a microsd, because at the moment it stores on my device… is this the error?

Blaine
Blaine
3 years ago
Reply to  Marco

Can confirm that I’m still seeing the log in the wrong location. I’ve even joined the beta.

Blaine
Blaine
3 years ago
Reply to  Marco

The dev let me know that the file has been moved to Documents/torqueLogs/trackLog.csv

Jake
Jake
3 years ago

Hi Robert, brilliant project, thank you! The only issue I’m having is the file directory for Torque – for me, the trackLog.csv is stored in (root)/Documents/torqueLogs instead of (root)/torqueLogs as you have set in your Automate Flow. I was wondering if you would be able to have a dialog to ask the user what directory they would like to use because I’m having to go through and change the flow elements to look in Documents. Would appreciate the help!

Renato Furlan
Renato Furlan
3 years ago

Hey, this is really cool, great job! Thank you so much for sharing. I am using it in my Android head unit and it works great, but found an issue in fork Parent_URI: after receiveing the BOOT_COMPLETED intent, it tries to read the value from config to determine whether Torque should be launched or not. At that momement, config file hasn’t been read yet, so Torque will not be launched even if set to true. So you might consider adding some delay before it (and hopefully config entries are loaded until that) or listen for some other intent you can… Read more »

Blaine
Blaine
3 years ago

Thanks for all your work on this! Still seeing the file here /storage/emulated/0/Documents/torqueLogs. Sounds like the next update will help.

Robert Cunningham
3 years ago
Reply to  Blaine

New script uploaded today.

Adrian
Adrian
3 years ago
Hello Friend, great project, I use it all the time, but recently after the torque updates, my configuration stopped, I downloaded the latest script of your version 13, but it still does not work, I have the latest version of torque 1.10.190 from 12/24/2021, I don't want to mi mobierac a file from logs, only in my configuration the file is not in the directory as before in torqueLogs, but now Android / data / org.prowl.torque / files / torqueLogs / trackLog.csv
James
James
3 years ago

I’m curious – did you have any feedback from someone else using Nabu Casa? I do it out of support for development of Home Assistant and had migrated any external access needs through it. I’d prefer to not go direct just for this but I’ve been unsuccessful getting it to work unless I go direct.

James
James
3 years ago

Thanks for all your work on this — incredible automation — Automate needs to give you some referral dollars as I bought the app just to see the complex flow in action! I’ll give this another go and see if I can tackle it.

Terry S
Terry S
3 years ago

Had anybody had any success? I tried selecting both places and after 10 seconds it times out saying it cannot locate the file. I cant wait to show this and the idea I have to layer it over my arduino module controlled car and show my followers. You deserve more than just credit if I can get this working. No data shows on HAS yet but when it does I’m gonna be like a big kid.

Jake
Jake
3 years ago

Hi Rob, thank you for the great script, but I’m having an issue. I have my sensor and templates set up and data is being received to my MQTT broker but for some reason, the main sensor (GPS Time) is showing None on my dashboard and the template sensors are showing unknown and I have no idea how the debug this issue. Much appreciated any help!

Blaine
Blaine
3 years ago

I’ve been testing for a bit now and I just wanted to report that it’s working great! Thanks for all your work on this!

Robert Cunningham
3 years ago
Reply to  Blaine

👍

Terry S
Terry S
3 years ago
Reply to  Blaine

Are you not experiencing the force close saying it cannot locate file? May I ask how you manage to get it to function?

Robert Cunningham
3 years ago
Reply to  Terry S

Make sure you are using the latest script. If the script cannot see a file it will try again. The file must use the correct name.

Christian
Christian
2 years ago

Hello Robert, thank you very much four your script which makes a great and functional link between torque and HA 😉
Do you know if it is possible to push the automation by automatically launch Automate then Torque without any intervention just by starting car engine on?
My little improvements would be to avoid all the steps of validations and launches of apps 😉

Tiberi
Tiberi
2 years ago

Hi. Can’t connect to. Gives an error: Communication failure
In the logs writes:

08-02 17:59:37.970 I 7@1953: Failure catch
08-02 17:59:37.971 I 7@1790: HTTP request
08-02 17:59:38.070 F 7@1790: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

I tried to connect via http and https, same result.

I use the remote connect to my HA constantly so it’s not a problem with access.

Created the long token and putted it with “Bearer xxxxxx…”

I need a help with this please

Screenshot_2022-08-02-18-50-50-10_e6a78a44c2a4240c0ee4570124bdc575.jpg
PuckStar
PuckStar
2 years ago

Probably not, but might you have the script for Tasker as well? I already use Tasker with several script so would prefer to have it in there.

Regarding your comment that you couldn’t find out how to prevent the apps from dozing above Android 10, but isn’t there an option in android to say that an app should never sleep and always allow background service?

HyeongGwon
HyeongGwon
2 years ago

When I press ‘start’ and set it up, a 400 error occurs with the message “Check your security token” even though I entered it in the form of “Bear xxxxxxx…” in the box where token is entered. How do I solve this?

Balazs
Balazs
2 years ago

Hi Robert,

That’s an amazing project, thank you for sharing this.
I purchased all the stuff, started to implement in HA, but I stuck at the configuration.yaml stage with the following errors:

 – platform: mqtt
  name: “Grande Punto”
  state_topic: “devices/grande_punto/torque”
  value_template: “{{ state_attr(‘sensor.grande_punto’, ‘GPS Time’) }}”
  json_attributes_topic: “devices/grande_punto/torque”


Any idea what should I correct?

Thanks.

config.png
Last edited 2 years ago by Balazs
Balazs
Balazs
2 years ago

Thanks. In the meantime with the help of google I managed to correct that original syntax to the same you just wrote.

mqtt:
  sensor:
    - name: "Grande Punto"
      state_topic: "devices/Grande_Punto/torque"
      value_template: "{{ state_attr('sensor.grande_punto', 'GPS Time') }}"
      json_attributes_topic: "devices/Grande_Punto/torque"

I also have the Automate sensor, that works just fine.

My new problem however is with the torque sensor as that is only what I see in the sensor attributes. What could be the problem? Any idea?

sensor_grande_punto.png
Balazs
Balazs
2 years ago
Reply to  Balazs

Also, that’s all what I receive via MQTT:

Message 1 received on devices/Grande_Punto/torque at 20:29:
{
    "": "Tue Oct 18 18:27:43 GMT+02:00 2022"
}
QoS: 0 - Retain: true

Not sure, where the other details are? I see all I selected in the trackLog.csv file.

Balazs
Balazs
2 years ago

I think the problem is more like that the data is not coming through mqtt. 🙄

atv
atv
2 years ago
Reply to  Balazs

Did you manage to resolve this? I get the same in my mqtt server. I saw the test message, and now just empty data.

Tismo
Tismo
2 years ago

I can’t believe there is still no way to use this script on iPhones. Not even a mention of it on the interwebs 😔

Tismo
Tismo
2 years ago

😭

atv
atv
2 years ago

Hi Robert, Few questions if you will: Automate seems to basically want full access to my android tablet. Is this normal ? How much access does your script need ? Does the trackLog.csv get overwritten by Torque every time (since we set to not rotate) and it is up to us to store it in HA for longer archival ? How do you manage storage in HA, does this not fill up HA very quickly ? Does a OBD dongle (i have the the OBDlink MX+ 13264) only update the ECU sensors? Is ECU what is coming from the car… Read more »

atv
atv
2 years ago

In addition:

  1. Torque logs at 5 seconds and the scripts seems to default at 10s. Is that ok ?
  2. the GPS time attribute, do i need to include that in my pid’s or is that done by your script somehow ?
atv
atv
2 years ago
Reply to  atv

If i add more pid’s later in torque, will the attributes automatically update (e.g. more attributes?) Is the sensor.automate for occupants similar to the one for torque? I believe it asked for head unit data and owl tracks, not sure which one i need to say yes to to get the occupants ? As i leave my tablet in the car, it actually keeps pairing to the ODB dongle, meaning it never goes to sleep and will drain the battery. I created a quick script in automate for this, that when the cigarette lighter port does not give a charge… Read more »

Craig McGowan
Craig McGowan
2 years ago

Hi Robert Thank you very much for your great work in this. I have tried to set it up this weke me but am running into an issue. I believe that the Automate script is looking for trackLog.csv, however Torque now appears to call this file trackTorqueLog.csv. Im assuming I’d need to update every reference to this file in the Automate Blocks as it does not appear to be a variable, but I can’t find a “Find & Replace” function in Automate and looking in each Block on a phone is very difficult. Do you have any advice for this… Read more »

maverik80
maverik80
2 years ago

Hello and congratulations for the work done, I completely followed and redone the procedure but unfortunately in mqtt explorer I receive the empty torque {} message, I don’t know where I’m wrong but the script from the automate log starts right at least that’s how it seems but I only receive an empty message .. can you tell me where I’m wrong?

113
0
Would love your thoughts, please comment.x
()
x