Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

JOHLC/ha-torque-2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

98 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

** Archiving this repository **

Due to several issues overall, I started fresh here: https://github.com/JOHLC/Home-Assistant-Torque-OBDII This repo will be archived soon.

๐Ÿš— Torque OBD Custom Integration for Home Assistant

Torque OBD Logo Torque OBD Logo

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!

โœจ Features

  • ๐Ÿ”ง 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_class for 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.


๐Ÿš€ Installation & Setup

๐Ÿ› ๏ธ HACS Installation (Recommended)

You can install this integration via HACS as a custom repository:

  1. In Home Assistant, go to HACS > Integrations.

  2. Click the three dots (โ‹ฎ) in the top right and select Custom repositories.

  3. Add this repository URL as type: Integration:

    https://github.com/JOHLC/ha-torque-2.0/
    
  4. Search for "Torque" in HACS and install this integration.

  5. Restart Home Assistant.

๐Ÿ–๏ธ Manual Installation

  1. Copy the torque folder to your Home Assistant custom_components directory.
  2. Restart Home Assistant.

โž• Integration Setup

  1. Add the integration via Settings > Devices & Services > Add Integration > Torque.
  2. Enter an email address
    • Can be anything, but must match what you enter into the Torque app setup below.
  3. Enter a name for the vehicle
    • Example: 2023 Ford EcoSport
  4. Click submit then click finish

๐Ÿ“ฑ Torque App Setup

  1. Generate a long-lived access token for your Home Assistant instance.
    • Give it a good name like 'Torque - Custom'
  2. 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.
  3. Under Logging Preferences:
    • Tap Select what to log.
    • Use the menu to Add PID to log and select items of interest.
  4. 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.


๐Ÿ™‹ FAQ & Troubleshooting

  • 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.

๐Ÿ” Enabling Debug Logging

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

๐Ÿงช Development & Contributing

This 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:

  1. Fork the repository
  2. Install development dependencies: pip install -r requirements-dev.txt
  3. Run tests: pytest tests/
  4. Run linting: ruff check custom_components/ and black custom_components/
  5. Submit a pull request

๐Ÿ“š References


๐Ÿ“จ Support & Feedback

  • For questions, suggestions, or bug reports, please open an issue on GitHub.
  • Contributions and PRs are welcome!

๐Ÿ“ License

This project is licensed under the MIT License. See the LICENSE file for details.

Attribution

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.


๐Ÿš€ Installation & Setup

๐Ÿ› ๏ธ HACS Installation (Recommended)

You can install this integration via HACS as a custom repository:

  1. In Home Assistant, go to HACS > Integrations.

  2. Click the three dots (โ‹ฎ) in the top right and select Custom repositories.

  3. Add this repository URL as type: Integration:

    https://github.com/JOHLC/ha-torque-2.0/
    
  4. Search for "Torque" in HACS and install this integration.

  5. Restart Home Assistant.

๐Ÿ–๏ธ Manual Installation

  1. Copy the torque folder to your Home Assistant custom_components directory.
  2. Restart Home Assistant.

โž• Integration Setup

  1. Add the integration via Settings > Devices & Services > Add Integration > Torque.
  2. Enter an email address
    • Can be anything, but must match what you enter into the Torque app setup below.
  3. Enter a name for the vehicle
    • Example: 2023 Ford EcoSport
  4. Click submit then click finish

โš™๏ธ Customization Options (Optional)

After setup, you can customize the integration:

  1. Go to Settings > Devices & Services > Torque > Configure.
  2. Hide PIDs: Enter comma-separated PID numbers to hide sensors you don't want (e.g., 12,34,56).
  3. Rename Sensors: Enter comma-separated pairs to rename sensors by PID (e.g., 12:Engine Temp,34:Speed).
  4. Click submit to apply changes.

๐Ÿ“ฑ Torque App Setup

  1. Generate a long-lived access token for your Home Assistant instance.
    • Give it a good name like 'Torque - Custom'
  2. 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.
  3. Under Logging Preferences:
    • Tap Select what to log.
    • Use the menu to Add PID to log and select items of interest.
  4. 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 receives valid data from Torque.


๐Ÿ™‹ FAQ & Troubleshooting

  • 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.

๐Ÿ” Enabling Debug Logging

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

๐Ÿ“š References


๐Ÿ“จ Support & Feedback

  • For questions, suggestions, or bug reports, please open an issue on GitHub.
  • Contributions and PRs are welcome!

๐Ÿ“ License

This project is licensed under the MIT License. See the LICENSE file for details.

Attribution

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.