PhilipDaubmeier.WeConnectClient 2.2.0

dotnet add package PhilipDaubmeier.WeConnectClient --version 2.2.0                
NuGet\Install-Package PhilipDaubmeier.WeConnectClient -Version 2.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PhilipDaubmeier.WeConnectClient" Version="2.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PhilipDaubmeier.WeConnectClient --version 2.2.0                
#r "nuget: PhilipDaubmeier.WeConnectClient, 2.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PhilipDaubmeier.WeConnectClient as a Cake Addin
#addin nuget:?package=PhilipDaubmeier.WeConnectClient&version=2.2.0

// Install PhilipDaubmeier.WeConnectClient as a Cake Tool
#tool nuget:?package=PhilipDaubmeier.WeConnectClient&version=2.2.0                

NuGet Build status

WeConnectClient

This class library provides a way to call the Volkswagen WeConnect interfaces. It encapsulates all authentication, retry and parsing logic and provides a strongly typed method interface.

NuGet

PM> Install-Package PhilipDaubmeier.WeConnectClient

Usage

You have to implement the interfaces IWeConnectAuth and IWeConnectConnectionProvider to provide the WeConnect client with all information necessary to authenticate and establish a connection.

The minimal viable example for playing around with the client would be to create a default connection provider as shown here:

var auth = new WeConnectAuth("<username>", "<password>");
using var connectionProvider = new WeConnectConnectionProvider(auth);

Caution: in a productive use you may want to implement your own IWeConnectAuth, let user credentials be entered by the user in some way and immediatelly discard them again. The IWeConnectAuth object will contain session information that is used to stay logged in and can be persisted by your custom subclass.

If you have the connection providers in place, you can create and use the WeConnect client like this:

var weclient = new WeConnectPortalClient(connectionProvider);

// Get the first vehicle of the logged in user
var vehicle = (await weclient.GetVehicleList()).FirstOrDefault() ?? new();
Console.WriteLine($"VIN: {vehicle.Vin} license plate: {vehicle.LicensePlate}");

// Get statistics about trips
var trips = await weclient.GetLongtermTripStatistics(vehicle.Vin);
foreach (var trip in trips)
    Console.WriteLine($"Trip {trip.TripEndTimestamp}: avg. speed: {trip.AverageSpeedKmph}");

For more usage examples you can also have a look at the unit tests.

Platform Support

WeConnectClient is targeted for .NET 9.0 or higher.

License

The MIT License (MIT)

Copyright (c) 2019-2024 Philip Daubmeier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 87 12/2/2024
1.1.0 474 6/27/2021
1.0.0 476 4/30/2020

2.2.0 - upgraded to target framework net9.0
2.1.0 - upgraded to target framework net8.0
2.0.0 - Complete rewrite due to launch of new WeConnect website in april 2021, incompatible to earlier versions
1.1.0 - upgraded to target framework net5.0
1.0.0 - Initial version for old WeConnect/Car-Net portal until its shutdown on 2021-04-27