Skip to content

A Java library for the Nissan Connect API (also known as Carwings)

License

Notifications You must be signed in to change notification settings

josteitv/nissanconnect-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nissan Connect API

All Contributors

Maven Central Build Status Known Vulnerabilities Quality Gate Status Coverage

A Java library for the Nissan Connect API (also known as Carwings). The API is used to get information and remotely control your Nissan Leaf.

Installation

Add the following dependency to you pom.xml.

<dependency>
    <groupId>solutions.tveit.nissanconnect</groupId>
    <artifactId>nissanconnect-api</artifactId>
    <version>0.0.2</version>
</dependency>

Usage

public class Main {
    
    public static void main(String[] args) throws Exception {        
        // Create async service
        NissanConnectAsyncService service = new NissanConnectAsyncService();
        
        // Log in
        String userId = "owner@example.com";
        String password = "MySecretPassword123!";
        service.login(Region.EUROPE, userId, password);
        
        // Force update of battery status from car (this will take some time)
        Future<BatteryStatusCheckResultResponse> batteryStatus = service.getBatteryStatus();
        BatteryStatusCheckResultResponse batteryStatusCheckResultResponse = batteryStatus.get();
        
        // Get state of charge (SOC) from server
        Future<BatteryStatusRecordsResponse> batteryStatusRecords = service.getBatteryStatusRecords();
        BatteryStatusRecordsResponse batteryStatusRecordsResponse = batteryStatusRecords.get();
        String soc = batteryStatusRecordsResponse.getBatteryStatusRecords().getBatteryStatus().getSoc().getValue();
        System.out.println("soc: " + soc);
        
        // Turn on air condition
        service.turnAcOn();
    }
}

References

How to release

This is how the project is released to Maven Central Repository.

Add the following config to your Maven settings.xml file:

<settings>
  <servers>
    <server>
      <id>ossrh</id>
      <username>your-jira-id</username>
      <password>your-jira-pwd</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>ossrh</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <gpg.executable>gpg2</gpg.executable>
        <gpg.passphrase>the_pass_phrase</gpg.passphrase>
      </properties>
    </profile>
  </profiles>  
</settings>

Snapshots

Create and deploy SNAPSHOT

$ mvn clean deploy

Snapshot is now available at https://oss.sonatype.org/content/repositories/snapshots/solutions/tveit/nissanconnect/nissanconnect-api/

Release

Create release and deploy to staging repository

$ mvn release:clean release:prepare
$ mvn release:perform

Promote from staging to central repository

$ cd target/checkout
$ mvn nexus-staging:release

Drop the staging repository (if something went wrong)

$ cd target/checkout
$ mvn nexus-staging:drop

For more information see https://central.sonatype.org/pages/apache-maven.html

Contributors ✨

Thanks goes to these wonderful people (emoji key):

ToineSiebelink
ToineSiebelink

🐛 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

A Java library for the Nissan Connect API (also known as Carwings)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages