Due to several issues overall, I started fresh here: https://github.com/JOHLC/Home-Assistant-Torque-OBDII This repo will be archived soon.
Bring your car's real-time OBD-II data into Home Assistant using the Torque Pro app.
This integration creates sensors for every OBD-II PID that your car reports, enabling automation, visualization, and monitoring of your vehicle.
โก๏ธ Modern rewrite of the Torque logger integration for Home Assistant.
ย ย ย ย ย ย Note: This integration replaces the Home Assistant core Torque integration. You cannot run both at the same time.
๐ค Disclosure: AI-Powered
This integration is maintained and improved with the help of GitHub Copilot among various other AI assistants.
I am not a Python coder by any means. Community feedback, contributions, and code reviews are welcome!
-
๐ง No YAML required: Setup is done via the "add integration" page of Home Assistant, through the UI.
-
๐พ State Restoration: All sensors (even if Torque is offline) are restored on Home Assistant startup.
-
๐ Logging: Detailed logging for troubleshooting and diagnostics.
-
๐จ Smart Icons: Sensors use context-appropriate Material Design Icons (e.g., gas-station for fuel, speedometer for speed, etc.).
-
๐งฉ Unique IDs & Grouping: All sensors have unique IDs and are grouped per vehicle for easy management.
-
๐ Automatic sensor discovery: New sensors appear as new PIDs are received from Torque.
-
๐ท๏ธ State Class Only: Sensors are assigned
state_classfor better statistics. -
๐ ๏ธ Options Flow for Customization: Easily hide or rename sensors (by PID) from the Home Assistant UIโno YAML or file editing required.
-
๐ก๏ธ Error Handling: Malformed or unexpected data is safely ignored and logged for troubleshooting.
-
๐ Full Localization: Support for multiple languages through Home Assistant's translation system.
You can install this integration via HACS as a custom repository:
-
In Home Assistant, go to HACS > Integrations.
-
Click the three dots (โฎ) in the top right and select Custom repositories.
-
Add this repository URL as type: Integration:
https://github.com/JOHLC/ha-torque-2.0/ -
Search for "Torque" in HACS and install this integration.
-
Restart Home Assistant.
- Copy the
torquefolder to your Home Assistantcustom_componentsdirectory. - Restart Home Assistant.
- Add the integration via Settings > Devices & Services > Add Integration > Torque.
- Enter an email address
- Can be anything, but must match what you enter into the Torque app setup below.
- Enter a name for the vehicle
- Example: 2023 Ford EcoSport
- Click submit then click finish
- Generate a long-lived access token for your Home Assistant instance.
- Give it a good name like 'Torque - Custom'
- In the Torque app's main page, go to Settings > Data Logging & Upload.
- Settings from the live data screen and settings from the main page of the app are different.
- Under Logging Preferences:
- Tap Select what to log.
- Use the menu to Add PID to log and select items of interest.
- Under Realtime web upload: - Set the webserver URL to your Home Assistant instance:
https://homeassistant.yourdomain.com/api/torque- Enable 'Send Https: Bearer Token' - Set 'Bearer Token' to the long-lived access code you generated in the previous steps. - Set your email address to match the one used in the integration setup. - Set the 'Logging Interval' to something higher than 10-20 seconds. Anything lower may overload the system. - Optional: Enable 'Only when OBD connected. This will ensure Torque is only sending data when it is actually connected to your vehicle. - Enable web uploads๐ Security Note: If you are exposing your Home Assistant instance to the internet, you should always use SSL/TLS encryption (HTTPS).
Never expose your instance over plain HTTP, as this can put your credentials and data at risk.
See the Home Assistant documentation on securing your installation for setup instructions.
You should now be all set to start logging data to Home Assistant! Sensors will be created once Home Assistant recieves valid data from Torque.
-
Sensors missing or not updating?
- Check that the Torque app is uploading to the correct URL and using the correct email.
- Ensure the PIDs you want are enabled in Torque's logging preferences.
- Force stop the app on your phone, then re-open it.
- For testing, make sure that "Only when OBD connected" is not enabled under the app's 'Realtime web upload' settings.
- Check your Home Assistant log for any details. You may also want to enable debug logging (see below).
-
Sensor values look off?
- The integration now always assumes the values sent by the Torque app are metric, regardless of the reported unit. Home Assistant will handle any conversion for display based on your UI preferences.
- If you encounter an issue with this, please open a GitHub issue and I'll do my best to investigate.
To enable debug logging for this integration, add the following to your configuration.yaml and restart Home Assistant. This will show detailed logs from the integration in Settings > System > Logs.
Note: This may quickly fill up your log as the logging is quite verbose. Remember to remove or revert back to a less verbose level.
logger:
default: info
logs:
custom_components.torque: debugThis integration now includes comprehensive development tools:
- Code Quality: Ruff and Black for linting and formatting
- Testing: Comprehensive test suite with pytest
- Type Safety: Full type hints throughout the codebase
- CI/CD: Automated quality checks via GitHub Actions
To contribute:
- Fork the repository
- Install development dependencies:
pip install -r requirements-dev.txt - Run tests:
pytest tests/ - Run linting:
ruff check custom_components/andblack custom_components/ - Submit a pull request
- For questions, suggestions, or bug reports, please open an issue on GitHub.
- Contributions and PRs are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
This project makes use of documentation and examples from the Home Assistant documentation, which is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Portions of this repository may be adapted from or reference content originally published by the Home Assistant project.
Copyright ยฉ Home Assistant authors.
Licensed under CC BY-NC-SA 4.0.
You can install this integration via HACS as a custom repository:
-
In Home Assistant, go to HACS > Integrations.
-
Click the three dots (โฎ) in the top right and select Custom repositories.
-
Add this repository URL as type: Integration:
https://github.com/JOHLC/ha-torque-2.0/ -
Search for "Torque" in HACS and install this integration.
-
Restart Home Assistant.
- Copy the
torquefolder to your Home Assistantcustom_componentsdirectory. - Restart Home Assistant.
- Add the integration via Settings > Devices & Services > Add Integration > Torque.
- Enter an email address
- Can be anything, but must match what you enter into the Torque app setup below.
- Enter a name for the vehicle
- Example: 2023 Ford EcoSport
- Click submit then click finish
After setup, you can customize the integration:
- Go to Settings > Devices & Services > Torque > Configure.
- Hide PIDs: Enter comma-separated PID numbers to hide sensors you don't want (e.g.,
12,34,56). - Rename Sensors: Enter comma-separated pairs to rename sensors by PID (e.g.,
12:Engine Temp,34:Speed). - Click submit to apply changes.
- Generate a long-lived access token for your Home Assistant instance.
- Give it a good name like 'Torque - Custom'
- In the Torque app's main page, go to Settings > Data Logging & Upload.
- Settings from the live data screen and settings from the main page of the app are different.
- Under Logging Preferences:
- Tap Select what to log.
- Use the menu to Add PID to log and select items of interest.
- Under Realtime web upload:
- Set the webserver URL to your Home Assistant instance:
https://homeassistant.yourdomain.com/api/torque - Enable 'Send Https: Bearer Token'
- Set 'Bearer Token' to the long-lived access code you generated in the previous steps.
- Set your email address to match the one used in the integration setup.
- Set the 'Logging Interval' to something higher than 10-20 seconds. Anything lower may overload the system.
- Optional: Enable 'Only when OBD connected'. This will ensure Torque is only sending data when it is actually connected to your vehicle.
- Enable web uploads
๐ Security Note: If you are exposing your Home Assistant instance to the internet, you should always use SSL/TLS encryption (HTTPS).
Never expose your instance over plain HTTP, as this can put your credentials and data at risk.
See the Home Assistant documentation on securing your installation for setup instructions. - Set the webserver URL to your Home Assistant instance:
You should now be all set to start logging data to Home Assistant! Sensors will be created once Home Assistant receives valid data from Torque.
-
Sensors missing or not updating?
- Check that the Torque app is uploading to the correct URL and using the correct email.
- Ensure the PIDs you want are enabled in Torque's logging preferences.
- Force stop the app on your phone, then re-open it.
- For testing, make sure that "Only when OBD connected" is not enabled under the app's 'Realtime web upload' settings.
- Check your Home Assistant log for any details. You may also want to enable debug logging (see below).
-
Sensor values look off?
- The integration now always assumes the values sent by the Torque app are metric, regardless of the reported unit. Home Assistant will handle any conversion for display based on your UI preferences.
- If you encounter an issue with this, please open a GitHub issue and I'll do my best to investigate.
To enable debug logging for this integration, add the following to your configuration.yaml and restart Home Assistant. This will show detailed logs from the integration in Settings > System > Logs.
Note: This may quickly fill up your log as the logging is quite verbose. Remember to remove or revert back to a less verbose level.
logger:
default: info
logs:
custom_components.torque: debug- For questions, suggestions, or bug reports, please open an issue on GitHub.
- Contributions and PRs are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
This project makes use of documentation and examples from the Home Assistant documentation, which is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Portions of this repository may be adapted from or reference content originally published by the Home Assistant project.
Copyright ยฉ Home Assistant authors.
Licensed under CC BY-NC-SA 4.0.
