A Node-RED flow for capturing data sent from the Torque OBDII app and creating a formatted JSON message. Example configuration provided for storing the data in an InfluxDB database via MQTT sent to Telegraf.
-
Node-RED. I run via Docker using the latest official image.
-
node-red-contrib-moment. This parses the
session
field into a human readable date. -
Torque app, either free or paid (limitations of free described below), and a suitable OBD2 reader.
-
MQTT Broker for sending messages out.
-
Telegraf for consuming MQTT messages and writing metrics to InfluxDB.
-
InfluxDB for storing metrics.
-
Grafana for viewing data. JHenzi made an awesome dashboard!
-
Import the contents of flow.json into a new flow in Node-RED.
-
Change the output TZ of the "Date/Time Formatter" node.
-
Ensure you can access the Node-RED server while on a mobile network. See security considerations below.
-
Set the correct parameters for your MQTT broker in the MQTT output node.
-
Add the Telegraf example to your Telegraf config, changing the parameters to connect to your MQTT broker.
This works with both the paid and free versions of Torque. The free version is limited to 6 PIDs reporting simultaneously, and has no good way to identify separate vehicles. For either version:
-
Navigate to the app settings and enable "Upload to webserver".
-
Enter the address of your Node-RED instance in the webserver URL field. Default is
http://<ip address>:<port>/upload
. This will change due to port forwarding, reverse proxy settings, domain names, dynamic DNS, etc. -
Select which PIDs to log.
-
If using the paid version of Torque, enter a descriptive name for your vehicle in the "User Email Address" field. This information is parsed and used as the metric name in the Telegraf/InfluxDB example. It is the only way I have found to differentiate multiple vehicles, and must be changed manually when switching vehicles and keeping the same android device. The free version of Torque does not send this field, so all data received is stored under the same metric:
liteVersion
.
The Torque app does not support sending data over HTTPS, so HTTPS access to your Node-RED server, either directly or via reverse proxy will not work. The data sent by Torque potentially contains sensitive data, such as GPS coordinates. This is low risk when sending data across a private network, but in order to upload real-time data to your server while not on the same network (i.e. driving in your car), you must either:
-
Expose your Node-RED HTTP endpoint to the internet, using port forwarding/reverse proxy (Not recommended).
-
Use a VPN to create a secure connection to the network that has your server. I use Wireguard for this, but that set up is outside the scope of this documentation.