Merge branch 'main' into Dev
This commit is contained in:
commit
cec9b78355
78
README.md
78
README.md
@ -1,57 +1,51 @@
|
||||
# onstar2mqtt
|
||||
A service that utilizes the [OnStarJS](https://github.com/samrum/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.
|
||||
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](https://www.uuidgenerator.net/version4) a v4 uuid for the device ID
|
||||
1. OnStar login: username, password, PIN
|
||||
1. Your car's VIN. Easily found in the monthly OnStar diagnostic emails.
|
||||
1. MQTT server information: hostname, username, password
|
||||
1. If using TLS, define `MQTT_PORT` and `MQTT_TLS=true`
|
||||
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`
|
||||
|
||||
Supply these values to the ENV vars below.
|
||||
### [Docker](https://hub.docker.com/r/michaelwoods/onstar2mqtt)
|
||||
|
||||
```shell
|
||||
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
|
||||
```yaml
|
||||
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:
|
||||
```shell
|
||||
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 12.x.
|
||||
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](HA-MQTT.md).
|
||||
|
2963
package-lock.json
generated
2963
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -32,17 +32,17 @@
|
||||
"async-mqtt": "^2.6.2",
|
||||
"convert-units": "^2.3.4",
|
||||
"lodash": "^4.17.21",
|
||||
"onstarjs": "^2.3.8",
|
||||
"onstarjs": "^2.3.9",
|
||||
"uuid": "^8.3.2",
|
||||
"winston": "^3.7.2",
|
||||
"winston": "^3.8.1",
|
||||
"dotenv": "^16.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.18.2",
|
||||
"@babel/eslint-plugin": "^7.17.7",
|
||||
"@babel/eslint-parser": "^7.18.9",
|
||||
"@babel/eslint-plugin": "^7.18.10",
|
||||
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"eslint": "^8.18.0",
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"eslint": "^8.22.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user