carwings
is a Go package and command-line tool providing access to
the Nissan Leaf Carwings API.
Through the Carwings API you can ask your vehicle for the latest data, see current battery and charging statuses, see the current climate control state, start or stop climate control remotely, remotely start charging, and retrieve the last known location of the vehicle.
The carwings
tool can be installed with:
go get github.com/joeshaw/carwings/cmd/carwings
Run carwings
by itself to see full usage information.
To update vehicle information:
carwings -username <username> -password <password> update
To get latest battery status:
carwings -username <username> -password <password> battery
This will print something like:
Logging into Carwings...
Getting latest retrieved battery status...
Battery status as of 2017-08-06 15:43:00 -0400 EDT:
Capacity: 240 / 240 (92%)
Crusing range: 114 mi (107 mi with AC)
Plug-in state: not connected
Charging status: not charging
Time to full:
Level 1 charge: 8h30m0s
Level 2 charge: 3h0m0s
Level 2 at 6 kW: 2h30m0s
For some people the username is an email address. For others it's a distinct username.
Usernames and passwords can also be provided through the environment
variables CARWINGS_USERNAME
, CARWINGS_PASSWORD
and CARWINGS_REGION
or in a ~/.carwingsrc
file in the format:
username=<username>
password=<password>
region=<eu|au|jp|ca|us>
sessionfile=<filename for saving sessions>
units=<km|miles>
If the sessionfile
is set in the configuration then the session data will be
read from that file, if present, and written to it if it is missing.
Josh Perry's protocol reference was incredibly helpful for the development of this library.
Josh also has an implementation in Javascript: https://github.com/joshperry/carwings
Jason Horne has a Python implementation: https://github.com/jdhorne/pycarwings2
Guillaume Boudreau has a PHP implementation: https://github.com/gboudreau/nissan-connect-php
Scott Helme created a Javascript Alexa skill: https://github.com/ScottHelme/AlexaNissanLeaf
Tobias Westergaard Kjeldsen has created a Dart library for carwings as well as an Android app: https://gitlab.com/tobiaswkjeldsen/dartcarwings https://gitlab.com/tobiaswkjeldsen/carwingsflutter
Issues and pull requests are welcome. When filing a PR, please make
sure the code has been run through gofmt
.
Copyright 2017-2018 Joe Shaw
carwings
is licensed under the MIT License. See the LICENSE file
for details.