Go to file
2023-03-02 15:34:31 -05:00
.github Bump docker/build-push-action from 3 to 4 2023-02-01 08:00:29 +00:00
images update docs with latest dashboard 2021-06-10 13:49:39 -04:00
src Fixed bug from upstream update preventing publishing of location to MQTT 2023-02-01 20:33:30 -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
.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 Use lts codename. 2023-02-01 20:33:30 -05:00
Dockerfile Upgrade docker image to node:alpine-18 2022-07-03 12:41:57 -04:00
HA-MQTT.md Add an example automation to automatically update location 2023-01-03 16:16:35 -07: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 pull request #257 from michaelwoods/dependabot/npm_and_yarn/onstarjs-2.3.16 2023-03-02 15:34:31 -05:00
package.json Merge pull request #257 from michaelwoods/dependabot/npm_and_yarn/onstarjs-2.3.16 2023-03-02 15:34:31 -05:00
README.md Doc the refresh rate 2022-10-17 20:58:37 -04:00

onstar2mqtt

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

The functionality is mostly focused around EVs (specifically the Bolt EV), however PRs for other vehicle types are certainly welcome.

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
    1. If using TLS, define MQTT_PORT and MQTT_TLS=true

Supply these values to the ENV vars below. The default data refresh interval is 30 minutes and can be overridden with ONSTAR_REFRESH with values in milliseconds.

Docker

docker run \
  --env ONSTAR_DEVICEID= \
  --env ONSTAR_VIN= \
  --env ONSTAR_USERNAME= \
  --env ONSTAR_PASSWORD= \
  --env ONSTAR_PIN= \
  --env MQTT_HOST= \
  --env MQTT_USERNAME \
  --env MQTT_PASSWORD \
  michaelwoods/onstar2mqtt:latest

docker-compose

  onstar2mqtt:
    container_name: onstar2mqtt
    image: michaelwoods/onstar2mqtt
    restart: unless-stopped
    env_file:
      - /srv/containers/secrets/onstar2mqtt.env
    environment:
    - ONSTAR_DEVICEID=
    - ONSTAR_VIN=
    - MQTT_HOST=

onstar2mqtt.env:

ONSTAR_USERNAME=
ONSTAR_PASSWORD=
ONSTAR_PIN=
MQTT_USERNAME=
MQTT_PASSWORD=

Node.js

It's a typical node.js application, define the same environment values as described in the docker sections and run with: npm run start. Currently, this is only tested with Node.js 18.x.

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