{"id":17458543,"url":"https://github.com/adlerre/obd2-mqtt","last_synced_at":"2026-02-16T08:10:24.668Z","repository":{"id":258111780,"uuid":"861709796","full_name":"adlerre/obd2-mqtt","owner":"adlerre","description":" OBD2 to MQTT for Home Assistant","archived":false,"fork":false,"pushed_at":"2026-02-15T10:24:11.000Z","size":9493,"stargazers_count":194,"open_issues_count":5,"forks_count":14,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-02-15T16:12:37.422Z","etag":null,"topics":["a7670","cellular","elm327","esp32","gps","home-assistant","mqtt","obd2","sim7000g","sim7070g","sim800"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adlerre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"buy_me_a_coffee":"adlerre"}},"created_at":"2024-09-23T11:41:14.000Z","updated_at":"2026-02-15T10:24:15.000Z","dependencies_parsed_at":"2025-06-25T06:29:21.967Z","dependency_job_id":"dab0f526-014f-4521-baa0-e7aa11467b73","html_url":"https://github.com/adlerre/obd2-mqtt","commit_stats":null,"previous_names":["adlerre/obd2-mqtt"],"tags_count":58,"template":false,"template_full_name":null,"purl":"pkg:github/adlerre/obd2-mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adlerre%2Fobd2-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adlerre%2Fobd2-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adlerre%2Fobd2-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adlerre%2Fobd2-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adlerre","download_url":"https://codeload.github.com/adlerre/obd2-mqtt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adlerre%2Fobd2-mqtt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29503296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T08:07:58.651Z","status":"ssl_error","status_checked_at":"2026-02-16T08:07:56.823Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a7670","cellular","elm327","esp32","gps","home-assistant","mqtt","obd2","sim7000g","sim7070g","sim800"],"created_at":"2024-10-18T04:05:52.210Z","updated_at":"2026-02-16T08:10:24.649Z","avatar_url":"https://github.com/adlerre.png","language":"C++","funding_links":["https://buymeacoffee.com/adlerre"],"categories":[],"sub_categories":[],"readme":"# OBD2 to MQTT for Home Assistant\n\n## What you need?\n\n* an installed Home Assistant with Mosquitto Broker\n* (optional) an installed PlatformIO\n* (optional) an installed Node.js and NPM\n* a ESP32 with [SIM800L](https://de.aliexpress.com/item/33045221960.html)\n  or [A7670](https://de.aliexpress.com/item/1005006477044118.html)\n    * (optional) [RP-SMA to IPX cable](https://www.amazon.de/dp/B0B9RXDLNN)\n    * (optional) [Antenna](https://www.amazon.de/dp/B0B2DCXL5N) (work's for me) or other\n    * (optional) a 3D Printer for the [case](3d-files)\n* a [ELM327 OBD Bluetooth Adapter](https://www.amazon.de/gp/product/B0BG4W6MLD) or any other\n    * if you want to use [this](https://de.aliexpress.com/item/1005005775562398.html) cheap adapter, you should set the\n      right connection protocol or have patience\n* a SIM Card - I use one\n  from [fraenk](https://fraenk.page.link/?link=https%3A%2F%2Ffraenk.de%2Fdeeplink%2Fmgm%3FfriendCode%3DRENA45\u0026apn=de.congstar.fraenk\u0026amv=1040000\u0026imv=1.4\u0026isi=1493980266\u0026ibi=de.congstar.fraenk\u0026ius=fraenk\u0026ofl=https%3A%2F%2Ffraenk.de)\n* and the most important thing, a car\n\n## Supported Devices\n\n| Product                                                                         | Environment                                                          | SSL/TLS                       | Case                                                                                                                                                                                                                    |\n|---------------------------------------------------------------------------------|----------------------------------------------------------------------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [T-Call SIM800L](https://lilygo.cc/products/t-call-v1-4?variant=42868250869941) | SIM800L_IP5306_VERSION_20190610 \u003cbr/\u003eSIM800L_IP5306_VERSION_20200811 | ❌ (only SSL 2/3, TLS 1.0/1.2) | [Case](3d-files/README.md#for-sim800l-boards)                                                                                                                                                                           |\n| T-Call SIM800C                                                                  | SIM800L_AXP192_VERSION_20200327\u003cbr/\u003eSIM800C_AXP192_VERSION_20200609  | ❌ (only SSL 2/3, TLS 1.0/1.2) | [Case](3d-files/README.md#for-sim800l-boards)                                                                                                                                                                           |\n| [T-Call A7670](https://lilygo.cc/products/t-call-v1-4?variant=43440642719925)   | T-Call-A7670X-V1-0\u003cbr/\u003eT-Call-A7670X-V1-1                            | ✅                             | [Case with internal GPS/LTE](3d-files/README.md#for-a7670-boards-with-included-gps-antenna)\u003cbr/\u003e[Case with external GPS/LTE](3d-files/README.md#for-a7670-boards-with-external-gps4g-antenna)                           |\n| [T-A7670E/G/SA R2](https://lilygo.cc/products/t-sim-a7670e)                     | T-A7670X                                                             | ✅                             | [Case with internal GPS/LTE](3d-files/README.md#for-a7670-boards-with-battery-and-internal-gps4g-antenna)\u003cbr/\u003e[Case with external GPS/LTE](3d-files/README.md#for-a7670-boards-with-battery-and-external-gps4g-antenna) |\n| [T-A7670E/G/SA R2 without GPS](https://lilygo.cc/products/t-sim-a7670e)         | T-A7670X-NO-GPS                                                      | ✅                             | [Case](3d-files/README.md#for-a7670-boards-with-battery-and-internal-gps4g-antenna)                                                                                                                                     |\n| [T-A7670G with GPS Shield](https://lilygo.cc/products/t-sim-a7670e)             | T-A7670X-GPS-SHIELD                                                  | ✅                             | [Case with internal GPS/LTE](3d-files/README.md#for-a7670-boards-with-battery-and-internal-gps4g-antenna)\u003cbr/\u003e[Case with external GPS/LTE](3d-files/README.md#for-a7670-boards-with-battery-and-external-gps4g-antenna) |\n| [T-SIM7000G](https://lilygo.cc/products/t-sim7000g)                             | T-SIM7000G                                                           | ✅                             |                                                                                                                                                                                                                         |\n| [T-SIM7070G](https://lilygo.cc/products/t-sim7070g)                             | T-SIM7070G                                                           | ✅                             |                                                                                                                                                                                                                         |\n| [Waveshare ESP32 S3 A7670E](https://www.waveshare.com/esp32-s3-a7670e-4g.htm)   | WS-A7670E_BLE (BLE only)                                             | ✅                             |                                                                                                                                                                                                                         |\n\n## Getting started\n\n### Upload via Web Installer (ESP Web Tools)\n\nIf you don't want to install PlatformIO and compile by your own, use\nthe [Web Installer](https://adlerre.github.io/obd2-mqtt/).\n\n### Update Settings or Firmware \u0026 Filesystem\n\n* connect to Wi-Fi Access Point starts with name OBD2-MQTT- followed from device MAC\n* open Browser and navigate to http://192.168.4.1\n* change settings to your needs and reboot afterward __OR__ update to new firmware and filesystem\n\n\u003cp\u003e\n\u003cimg width=\"200\" alt=\"Info\" src=\"assets/obd2-mqtt-ui-info-01.png\"\u003e\n\u003cimg width=\"200\" alt=\"Settings1\" src=\"assets/obd2-mqtt-ui-settings-01.png\"\u003e\n\u003cimg width=\"200\" alt=\"Settings2\" src=\"assets/obd2-mqtt-ui-settings-02.png\"\u003e\n\u003cimg width=\"200\" alt=\"OTA Updater\" src=\"assets/obd2-mqtt-ui-ota-01.png\"\u003e\n\u003c/p\u003e\n\n### Build\n\nBuild firmware.bin\n\n```bash\npio run [-e OPTIONAL ENV]\n```\n\nBuild littlefs.bin\n\n```bash\npio run --target buildfs [-e OPTIONAL ENV]\n```\n\n### Upload\n\nBuild and upload firmware.bin to device\n\n```bash\npio run --target upload -e T-Call-A7670X-V1-0\n```\n\nBuild and upload littlefs.bin to device\n\n```bash\n# connect to AP and save current settings\ncurl http://192.168.4.1/api/settings -o settings.json\n\npio run --target uploadfs -e T-Call-A7670X-V1-0\n\n# after reboot connect to AP\ncurl -X PUT -H \"Content-Type: application/json\" -d @settings.json http://192.168.4.1/api/settings\n```\n\n## Settings\n\nConfigure Wi-Fi, Mobile settings according to your needs. Set the detected ELM327 device and optionally select the\nprotocol for faster initialization.\u003cbr /\u003e\nSet up the MQTT configuration with your data. __If you want to use TLS/SSL on a SIM800 device, you need to know that\nonly SSL 2/3 and TLS 1.0 are supported.__\nFor devices with a battery, you can set the automatic sleep timeout (no data/ignition off) and the sleep duration.\n\n## Configure Sensors\n\nThe following sensors are included in the supplied standard profile:\n\n* Ambient Temperature\n* Battery Voltage\n* Calculated average speed\n* Calculated consumption\n* Calculated consumption per 100km\n* Calculated driven distance\n* Check Engine Light\n* Engine Coolant Temperature\n* Engine Load\n* Engine Running\n* Fuel Level\n* Fuel Rate\n* Intake Air Temperature\n* Kilometer per Hour\n* Mass Air Flow\n* Odometer\n* Oil Temperature\n* Pedal Position\n* Revolutions per minute\n* Throttle\n* Top Speed ;-)\n\nDiagnostic Output on all profiles:\n\n* CPU Temperature (ESP)\n* Free Memory (ESP)\n* GPS Location (only for A76xx)\n* GSM Location\n* Signal Quality\n* Uptime\n\n\u003cp\u003e\n\u003cimg width=\"200\" alt=\"Sensors1\" src=\"assets/obd2-mqtt-ha-01.png\"\u003e\n\u003cimg width=\"200\" alt=\"Sensors2\" src=\"assets/obd2-mqtt-ha-02.png\"\u003e\n\u003c/p\u003e\n\nMore profiles can be found [here](profiles).\n\n### Custom OBD States\n\nOn the OBD tab you can adjust the required states and upload and/or download the current profile.\nThere two types of states, __READ__ and __CALC__, both can be a value type of __BOOL__, __FLOAT__ or __INT__.\n\n\u003cp\u003e\n\u003cimg width=\"200\" alt=\"OBD1\" src=\"assets/obd2-mqtt-obd-01.png\"\u003e\n\u003cimg width=\"200\" alt=\"OBD2\" src=\"assets/obd2-mqtt-obd-02.png\"\u003e\n\u003c/p\u003e\n\nOptions:\n\n* **enabled**\n\n  the state is enabled\n\n* **visible**\n\n  the state is visible\n\n* **Measurement**\n\n  if the state is a measurement\n\n* **Diagnostic**\n\n  the state should be displayed as a diagnostic field\n\n* **Interval**\n\n  the update interval or -1 for onetime update\n\n* **Name**\n\n  the state name, only letters, numbers and underscore are allowed\n\n* **Description**\n\n  the state description, is shown in Home Assistant as field description\n\n* **Icon**\n\n  the state icon name without leading __mdi:__\n\n* **Sensor Device Class**\n\n  the sensor device class, [see](https://developers.home-assistant.io/docs/core/entity/sensor/)\n\n* **Unit**\n\n  the unit for device class or custom one\n\n#### READ\n\nThe READ state is used to read PIDs, either using an internal function or by setting the PID codes, response, and value\nchanges. The PID codes must be entered in decimal __NOT__ hexadecimal.\u003cbr /\u003e\nOption __scale factor__ can be a mathematical expression.\u003cbr /\u003e\n\n##### Example\n\nwith internal function:\n\n```json\n{\n  \"type\": 0,\n  \"valueType\": \"float\",\n  \"enabled\": true,\n  \"visible\": true,\n  \"interval\": 30000,\n  \"name\": \"batteryVoltage\",\n  \"description\": \"Battery Voltage\",\n  \"icon\": \"battery\",\n  \"unit\": \"V\",\n  \"deviceClass\": \"voltage\",\n  \"measurement\": true,\n  \"diagnostic\": false,\n  \"readFunc\": \"batteryVoltage\"\n}\n```\n\nor with PID codes and value changes:\n\n```json\n{\n  \"type\": 0,\n  \"valueType\": \"int\",\n  \"enabled\": true,\n  \"visible\": true,\n  \"interval\": 100,\n  \"name\": \"rpm\",\n  \"description\": \"Revolutions per minute\",\n  \"icon\": \"engine\",\n  \"measurement\": true,\n  \"diagnostic\": false,\n  \"pid\": {\n    \"service\": 1,\n    \"pid\": 12,\n    \"numResponses\": 1,\n    \"numExpectedBytes\": 2,\n    \"scaleFactor\": \"1.0 / 4.0\",\n    \"bias\": 0\n  }\n}\n```\n\n#### CALC\n\nThe CALC state can be used to calculate a value based on other states.\n\n##### Example\n\n```json\n{\n  \"type\": 1,\n  \"valueType\": \"float\",\n  \"enabled\": true,\n  \"visible\": true,\n  \"interval\": 100,\n  \"name\": \"distanceDriven\",\n  \"description\": \"Calculated driven distance\",\n  \"icon\": \"map-marker-distance\",\n  \"unit\": \"mi\",\n  \"deviceClass\": \"distance\",\n  \"measurement\": true,\n  \"diagnostic\": false,\n  \"expr\": \"$distanceDriven + ($speed.ov + $speed) / 2 / 3600 * ($millis - $distanceDriven.lu) / 1000\",\n  \"value\": {\n    \"func\": \"toMiles\"\n  }\n}\n```\n\n##### Expression\n\nWithin an expression, all mathematical operators are allowed as well as binary operator __\u0026__ (and) and __|__ (or),\nother states can be used to calculate the value. To do this use the state name with a leading __$__.\u003cbr /\u003e\nIt is also possible to use previous values and stored timestamps for this purpose.\n\nVariables and it's substates:\n\n* **$millis**\u003cbr /\u003e\n  *predefined*\n\n  the current timestamp\n\n* **$var**\u003cbr /\u003e\n\n  the current value\n\n* **$var.ov**\u003cbr /\u003e\n\n  the previous value\n\n* **$var.pu**\u003cbr /\u003e\n\n  the previous updated timestamp\n\n* **$var.lu**\u003cbr /\u003e\n\n  the last updated timestamp\n\n* **$var.b[index]{:[index]}**\u003cbr /\u003e\n\n  extract byte or a byte array from raw payload\u003cbr /\u003e\n  \u003cbr /\u003e\n  for single byte specify the index, starting from 1\u003cbr /\u003e\n  for a byte array, specify the start index followed by a colon and the end index\n\nThere are also some internal mathematical functions like:\n\nsingle parameter functions:\n\n* sin, cos, tan\n* asin, acos, atan\n* sinh, cosh, tanh\n* asinh, acosh, atanh\n* ln, log, exp\n* sqrt, sqr\n* round, floor\n\ntwo parameter functions:\n\n* min, max\n* shl, shr - shift logical left/right\n\nas well as internal functions:\n\n* __afRatio__ - air flow ratio by fuel type\n* __density__ - density by fuel type\n* __numDTCs__ - number of DTCs, is required to call monitor status first.\n  see [default profile](profiles/states-imperial.json)\n\n##### Value Format\n\nCan be used with simple __printf__ compatible expression, such as %d for __int__ or %.2f for __float__ output. If you\nleave this field blank, the default values are used.\u003cbr /\u003e\nOr you can use the format expression to perform some calculations. Within this expression, only $value (for the current\nvalue) is allowed.\nThere are also some built-in functions for formatting values.\n\n* **toBitStr**\u003cbr /\u003e\n\n  Format as Bit String\n\n* **toMiles**\u003cbr /\u003e\n\n  Convert km to mi\n\n* **toGallons**\u003cbr /\u003e\n\n  Convert L to gal\n\n* **toMPG**\u003cbr /\u003e\n\n  Convert L/100km to MPG\n\n* **payload**\u003cbr /\u003e\n\n  Output raw payload\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadlerre%2Fobd2-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadlerre%2Fobd2-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadlerre%2Fobd2-mqtt/lists"}