Code Monkey home page Code Monkey logo

onstarjs's Introduction

OnStarJS

npm version Build Status Coverage Status

An unofficial NodeJS library to make OnStar requests.

Use at your own risk. This is an unofficial library.

Use the Get Account Vehicles request to see which requests your vehicle supports.

Usage

Sample

Use a random version 4 uuid (there are online generators) as a deviceId.

import OnStar from "onstarjs";

const config = {
  deviceId: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  vin: "1G2ZF58B774109863",
  username: "[email protected]",
  password: "p@ssw0rd",
  onStarPin: "1234",
  checkRequestStatus: true, // When false, requests are complete when 'In Progress' (Much faster).
};

const onStar = OnStar.create(config);

onStar
  .alert({
    action: ["Flash"],
  })
  .then(() => {
    onStar.start();
  })
  .catch(e => console.log(e));

Get Account Vehicles

onStar.getAccountVehicles();

Start

onStar.start();

Cancel Start

onStar.cancelStart();

Alert

onStar.alert([options]);
Option Default Valid Values
action ["Flash", "Honk"] ["Flash", "Honk"]
delay 0 Any integer (minutes)
duration 1 Any integer (minutes)
override ["DoorOpen", "IgnitionOn"] ["DoorOpen", "IgnitionOn"]

Cancel Alert

onStar.cancelAlert();

Lock Door

onStar.lockDoor([options]);
Option Default Valid Values
delay 0 Any integer (minutes)

Unlock Door

onStar.unlockDoor([options]);
Option Default Valid Values
delay 0 Any integer (minutes)

Charge Override

onStar.chargeOverride([options]);
Option Default Valid Values
mode "CHARGE_NOW" "CHARGE_NOW", "CANCEL_OVERRIDE"

Get Charging Profile

onStar.getChargingProfile();

Set Charging Profile

onStar.setChargingProfile([options]);
Option Default Valid Values
chargeMode "IMMEDIATE" "DEFAULT_IMMEDIATE", "IMMEDIATE", "DEPARTURE_BASED", "RATE_BASED", "PHEV_AFTER_MIDNIGHT"
rateType "MIDPEAK" "OFFPEAK", "MIDPEAK", "PEAK"

Diagnostics

onStar.diagnostics([options]);
Option Default Valid Values
diagnosticItem ["ODOMETER", "TIRE PRESSURE", "AMBIENT AIR TEMPERATURE", "LAST TRIP DISTANCE"] ["ENGINE COOLANT TEMP", "ENGINE RPM", "LAST TRIP FUEL ECONOMY", "EV ESTIMATED CHARGE END", "EV BATTERY LEVEL", "OIL LIFE", "EV PLUG VOLTAGE", "LIFETIME FUEL ECON", "HOTSPOT CONFIG", "LIFETIME FUEL USED", "ODOMETER", "HOTSPOT STATUS", "LIFETIME EV ODOMETER", "EV PLUG STATE", "EV CHARGE STATE", "TIRE PRESSURE", "AMBIENT AIR TEMPERATURE", "LAST TRIP DISTANCE", "INTERM VOLT BATT VOLT", "GET COMMUTE SCHEDULE", "GET CHARGE MODE", "EV SCHEDULED CHARGE START", "FUEL TANK INFO", "HANDS FREE CALLING", "ENERGY EFFICIENCY", "VEHICLE RANGE"]

Development

Tests

Unit

yarn test:unit

Functional

These tests will execute actual requests to the OnStar API. They will perform a Get Account Vehicles request followed by a Cancel Alert request.

Because of this, the test will require actual OnStar credentials to run. To provide them, copy .env.example to .env and replace the placeholder values inside.

yarn test:functional

All

Run both unit and functional tests

yarn test

Credits

Made possible by mikenemat's work in gm-onstar-probe. Their work describing the process for remote start enabled the rest of the methods implemented here.

onstarjs's People

Contributors

samrum avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.