Go to file
2022-08-18 14:59:55 -05:00
.github Merge pull request #162 from michaelwoods/dependabot/github_actions/docker/setup-buildx-action-2 2022-06-07 20:18:11 -04:00
images update docs with latest dashboard 2021-06-10 13:49:39 -04:00
src Update index.js 2022-08-16 18:48:31 -05:00
test updated the test conditions for the unique id 2022-05-24 18:44:09 -04:00
.babelrc Add linting support 2021-06-10 23:44:31 -04:00
.dockerignore github action and metadata files 2020-12-02 14:13:11 -05:00
.env Create .env 2022-08-18 14:57:42 -05:00
.eslintrc.yml Add linting support 2021-06-10 23:44:31 -04:00
.gitignore Add location support. Fixes #87 2021-11-16 12:01:29 -05:00
.nvmrc add .nvmrc 2021-11-16 10:45:38 -05:00
Dockerfile add device config and minor updates 2020-12-27 21:55:49 -05:00
HA-MQTT.md Update HA-MQTT.md 2022-06-07 22:53:48 -04:00
LICENSE Initial version that queries vehicles and its diagnostics then prints to console. 2020-11-30 16:26:14 -05:00
package-lock.json Merge branch 'main' into Dev 2022-08-18 14:59:55 -05:00
package.json Merge branch 'main' into Dev 2022-08-18 14:59:55 -05:00
README.md Update README.md 2022-08-16 08:49:53 -05:00

onstar2mqtt

A service that utilizes the OnStarJS library to expose OnStar data to MQTT topics.

This fork is centered around the gasoline line of vehicles.

There is no affiliation with this project and GM, Chevrolet nor OnStar. In fact, it would be nice if they'd even respond to development requests so we wouldn't have to reverse engineer their API.

Running

Collect the following information:

  1. Generate a v4 uuid for the device ID
  2. OnStar login: username, password, PIN
  3. Your car's VIN. Easily found in the monthly OnStar diagnostic emails.
  4. MQTT server information: hostname, username, password 4a. If using TLS, define MQTT_PORT and MQTT_TLS=true

Node.js

It's a typical node.js application, but I am unfamiliar on how to pass ENV vars, so if someone wants to create a PR to explain how to do that, be my guest. To install and run do the following commands.

sudo wget https://www.github.com/bennydabee/onstar2mqtt  
cd onstar2mqtt  
npm install  

The following is required as I am unfamilar with the ENV vars for NPM.

cd src  
sudo nano index.js  

Make the following lines similar to this

deviceId: process.env.ONSTAR_DEVICEID || 'uuidhere',  
vin: process.env.ONSTAR_VIN || 'vinhere',  
username: process.env.ONSTAR_USERNAME 'usernamehere',  
password: process.env.ONSTAR_PASSWORD 'password here',  
onStarPin: process.env.ONSTAR_PIN 'pinhere',  
const mqttConfig = {  
host: process.env.MQTT_HOST || 'haip',  
username: process.env.MQTT_USERNAME || 'mqttusername',  
password: process.env.MQTT_PASSWORD || 'mqttpassword',  
port: parseInt(process.env.MQTT_PORT) || 1883,  
tls: process.env.MQTT_TLS || false,  
prefix: process.env.MQTT_PREFIX || 'homeassistant',  
namePrefix: process.env.MQTT_NAME_PREFIX || '',  

After all this run cd .. and then npm run start and it should now connect and you will have OnStarJS in your HA MQTT

Home Assistant configuration templates

MQTT auto discovery is enabled. For further integrations and screenshots see HA-MQTT.md.

Development

Running

npm run start

Testing

npm run test

Coverage

npm run coverage

Releases

npm version [major|minor|patch] -m "Version %s" && git push --follow-tags

Publish the release on GitHub to trigger a release build (ie, update 'latest' docker tag).