Skip to content

Commit

Permalink
Merge pull request #5 from dteirney/dev
Browse files Browse the repository at this point in the history
Version 2.0 updates to the ABRP plugin for OVMS
  • Loading branch information
jason-abrp authored Jun 29, 2022
2 parents c51e1ae + 6322370 commit 5cbf84b
Show file tree
Hide file tree
Showing 13 changed files with 8,256 additions and 400 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"commonjs": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:jest/recommended",
"plugin:jest/style"
],
"globals": {
"HTTP": "readonly",
"OvmsConfig": "readonly",
"OvmsMetrics": "readonly",
"OvmsNotify": "readonly",
"PubSub": "readonly",
"performance": "readonly",
"print": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
},
"ecmaVersion": 2015
},
"plugins": ["jest"],
"rules": {}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"proseWrap": "always",
"semi": false,
"singleQuote": true
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"cSpell.words": [
"ABRP",
"dcfc",
"duktape",
"ovmsmain",
"parktime",
"Routeplanner",
"topoff"
]
}
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CHANGELOG

## Version 2.0, 2022, `dteirney`

- Additional telemetry fields sent to ABRP
- `is_dcfc`
- `is_parked`
- `kwh_charged`
- `heading`
- `odometer`
- `est_battery_range`
- Nissan Leaf specific metrics used for SOC, SOH and estimated range
- Reduce bandwidth by only sending frequent data for calibration (every 10
seconds) when the driving speed is greater than 70 kph
- Reduce bandwidth by changing the determination of a significant telemetry
change to take into account whether the vehicle is charging, and only send if
the power changes by more than 1 kW.
- Capture speed and power metrics every second and then send median based on the
power reading for more accurate ABRP calibration of estimated km/kWh @ 110 kph
- Additional DEBUG logging included (off by default)
- Numerous code modifications to reduce use of module state within module
functions

## Version 1.4, 2021, `Jason_ABRP`

- Update script so it can be running continuously
- Remove unneeded dependencies on multiple config items (Now only have to set
token)
- Stability improvements

## Version 1.3, 2020, `inf0mike`

- Background on the OVMS forum at
[Send live data to abrp](https://www.openvehicles.com/node/2375)
- Fix for rounding of fractional SOC causing abrp to report SOC off by 1
- Fix for altitude never being sent
- New convenience method to reset config to defaults

## Version 1.2

- based now on OVMS configuration to store user token, car model and url
- review messages sent during charge
- send a message when vehicle is on before moving to update abrp

## Version 1.1

- fixed the utc refreshing issue
- send notifications
- send live data only if necessary
- script eval abrp.resetConfig() => reset configuration to defaults
67 changes: 66 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,66 @@
ovms-link
# README

[A Better Routeplanner (ABRP)](https://abetterrouteplanner.com) is an electric
vehicle (EV) focussed route planner that incorporates planning of EV charging
stops.

This OVMS plugin sends live telemetry data from the vehicle to ABRP to be used
for the route planning process and appropriate updates to the plan along the way
based on live information.

## Installation

### Obtain Live Data Token

1. Register with [A Better Routeplanner (ABRP)](https://abetterrouteplanner.com)
and login
2. Setup your vehicle, starting with **Select car model**
3. In the settings for the new vehicle, click on the **Live data** button to
generate a generic token. Keep a record of this token

### Install the abrp.js Plugin in OVMS

1. Login to the
[OVMS web console](https://docs.openvehicles.com/en/latest/userguide/installation.html#initial-connection-wifi-and-browser)
2. Navigate to the **Tools** -> **Editor** menu item
3. Create a new `lib` directory in `/store/scripts` if it does not exist
4. Create a new `abrp.js` file in the `/store/scripts/lib` directory
5. Copy the content of the `lib/abrp.js` file in this repository to that new
file and save
6. Create a new `ovmsmain.js` file in `/store/scripts` if it does not exist
7. Copy the content of the `ovmsmain.js` file in this repository to that new
file and **Save**

### Configure Plugin

1. Navigate to **Tools** -> **Shell** in the OVMS web console
2. In the OVMS shell issue the following command substituting `<token>` with the
live data generic token that was set up for the vehicle in ABRP

```text
config set usr abrp.user_token <token>
```

### Reload the JS Engine

1. Navigate to **Tools** -> **Editor** in the OVMS web console and press the
**Reload JS Engine** button. This should result in an `ABRP::started`
notification if the plugin is installed and configured correctly.

## Usage

With the configuration described above the ABRP plugin will automatically send
live telemetry from the vehicle to ABRP on a periodic basis. When data is sent
depends on what is happening for the vehicle. For example, when driving,
information will be sent more frequently than when charging, and even less often
when the car is off.

### OVMS Shell Commands

- `script eval abrp.info()` - display vehicle telemetry that would be sent to
ABRP
- `script eval abrp.onetime()` - send current telemetry to ABRP once only
- `script eval abrp.send(1)` - start periodically sending telemetry to ABRP
(when necessary)
- `script eval abrp.send(0)` - stop sending telemetry
- `script eval abrp.resetConfig()` - reset configuration
Loading

0 comments on commit 5cbf84b

Please sign in to comment.