Skip to content

Commit

Permalink
add documentation for running and lovelace
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoods committed Dec 2, 2020
1 parent 5253214 commit e029012
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 4 deletions.
85 changes: 84 additions & 1 deletion HA-MQTT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
Sample configs for MQTT Home Assistant integration.

- Utility meter that resets for monthly LIFETIME ENERGY USED
### Lovelace Dashboard
Create a new dashboard, or use the cards in your own view. The `mdi:car-electric` icon works well here.

![lovelace screenshot](images/lovelace.png)

yaml:
```yaml
views:
- badges: []
cards:
- type: gauge
entity: sensor.ev_battery_level
min: 0
max: 100
name: Battery
severity:
green: 60
yellow: 40
red: 15
- type: gauge
entity: sensor.ev_range
min: 0
max: 420
name: Range
severity:
green: 250
yellow: 150
red: 75
- type: glance
entities:
- entity: sensor.tire_pressure_left_front
name: Left Front
icon: 'mdi:car-tire-alert'
- entity: sensor.tire_pressure_right_front
name: Right Front
icon: 'mdi:car-tire-alert'
- entity: sensor.tire_pressure_left_rear
name: Left Rear
icon: 'mdi:car-tire-alert'
- entity: sensor.tire_pressure_right_rear
name: Right Rear
icon: 'mdi:car-tire-alert'
columns: 2
title: Tires
- type: glance
entities:
- entity: sensor.last_trip_total_distance
name: Distance
- entity: sensor.last_trip_electric_econ
name: Economy
title: Last Trip
- type: entities
title: Mileage
entities:
- entity: sensor.odometer
- entity: sensor.lifetime_energy_used
- entity: sensor.lifetime_mpge
- entity: sensor.lifetime_efficiency
- entity: sensor.electric_economy
- type: glance
entities:
- entity: sensor.ambient_air_temperature
name: Ambient
- entity: sensor.hybrid_battery_minimum_temperature
name: Battery
- entity: sensor.kewr_daynight_temperature
name: Outdoor
title: Temperature
- type: entities
entities:
- entity: binary_sensor.ev_plug_state
- entity: binary_sensor.ev_charge_state
- entity: binary_sensor.priority_charge_indicator
- entity: binary_sensor.priority_charge_status
- entity: sensor.ev_plug_voltage
- entity: sensor.interm_volt_batt_volt
- entity: sensor.charger_power_level
title: Charging
title: Bolt EV

```
TODO
- Utility meter that resets for monthly LIFETIME ENERGY USED. This seems to only be updated after a full charge, along with other data points.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,59 @@
A service that utilizes the [OnStarJS](https://github.com/samrum/OnStarJS) library to expose OnStar data to MQTT topics. Mostly focused around EVs, however happy to accept PRs for other vehicle types.

There is no official relationship with 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`

Supply these values to the ENV vars below.
### Docker

```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 only tested with Node.js 12.x.

### Home Assistant configuration templates
Auto discovery is enabled, for further integrations see [HA-MQTT.md](HA-MQTT.md).
MQTT auto discovery is enabled, for further integrations see [HA-MQTT.md](HA-MQTT.md).

### TODO
## TODO
1. Logging library
1. Figure out metric->imperial unit handling
1. Enable write actions to lock doors, flash lights, remote start, etc.
Binary file added images/lovelace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const onstarConfig = {
username: process.env.ONSTAR_USERNAME,
password: process.env.ONSTAR_PASSWORD,
onStarPin: process.env.ONSTAR_PIN,
checkRequestStatus: process.env.ONSTAR_SYNC === "true",
checkRequestStatus: process.env.ONSTAR_SYNC === "true" || true,
refreshInterval: parseInt(process.env.ONSTAR_REFRESH) || (30 * 60 * 1000) // 30 min
};

Expand Down

0 comments on commit e029012

Please sign in to comment.