Skip to main content

Volkswagen Carnet

buy me a coffee

Release PyPi Version CodeStyle Known Vulnerabilities CodeQL codecov

Downloads a day Downloads a week Downloads a month

Help Wanted

As i don't have a car with Volkswagen Connect anymore i would appreciate if it would be possible to get help to keep this repository maintained. So if you feel that you have some time over and is interested in helping out with this. Please feel to contact me! Thanks

Information

Retrieve statistics about your Volkswagen from the Volkswagen Carnet online service

No licence, public domain, no guarantees, feel free to use for anything. Please contribute improvements/bugfixes etc.

Thanks to

For supporting and helping in this project.

Other related repositories

Installation

[venv-python3] user@localhost:~
$ pip install volkswagencarnet

Example

#!/usr/bin/env python3
from volkswagencarnet.vw_connection import Connection
import pprint
import asyncio
import logging

from aiohttp import ClientSession

logging.basicConfig(level=logging.DEBUG)

VW_USERNAME = "test@example.com"
VW_PASSWORD = "mysecretpassword"


COMPONENTS = {
    "sensor": "sensor",
    "binary_sensor": "binary_sensor",
    "lock": "lock",
    "device_tracker": "device_tracker",
    "switch": "switch",
    "climate": "climate",
}

RESOURCES = [
    "position",
    "distance",
    "electric_climatisation",
    "combustion_climatisation",
    "window_heater",
    "combustion_engine_heating",
    "charging",
    "adblue_level",
    "battery_level",
    "fuel_level",
    "service_inspection",
    "oil_inspection",
    "last_connected",
    "charging_time_left",
    "electric_range",
    "combustion_range",
    "combined_range",
    "charge_max_ampere",
    "climatisation_target_temperature",
    "external_power",
    "parking_light",
    "climatisation_without_external_power",
    "door_locked",
    "trunk_locked",
    "request_in_progress",
    "windows_closed",
    "sunroof_closed",
    "trip_last_average_speed",
    "trip_last_average_electric_consumption",
    "trip_last_average_fuel_consumption",
    "trip_last_duration",
    "trip_last_length",
    "trip_refuel_average_speed",
    "trip_refuel_average_electric_consumption",
    "trip_refuel_average_fuel_consumption",
    "trip_refuel_duration",
    "trip_refuel_length",
]


def is_enabled(attr):
    """Return true if the user has enabled the resource."""
    return attr in RESOURCES


async def main():
    """Main method."""
    async with ClientSession(headers={"Connection": "keep-alive"}) as session:
        connection = Connection(session, VW_USERNAME, VW_PASSWORD)
        if await connection.doLogin():
            if await connection.update():
                # Print overall state
                pprint.pprint(connection._state)

                # Print vehicles
                for vehicle in connection.vehicles:
                    pprint.pprint(vehicle)

                # get all instruments
                instruments = set()
                for vehicle in connection.vehicles:
                    dashboard = vehicle.dashboard(mutable=True)

                    for instrument in (
                        instrument
                        for instrument in dashboard.instruments
                        if instrument.component in COMPONENTS
                        and is_enabled(instrument.slug_attr)
                    ):
                        instruments.add(instrument)

                # Output all supported instruments
                for instrument in instruments:
                    print(f"name: {instrument.full_name}")
                    print(f"str_state: {instrument.str_state}")
                    print(f"state: {instrument.state}")
                    print(f"supported: {instrument.is_supported}")
                    print(f"attr: {instrument.attr}")
                    print(f"attributes: {instrument.attributes}")


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    # loop.run(main())
    loop.run_until_complete(main())

Development

I'd strongly advise installing the git pre-commit hook using pre-commit install. See pre-commit.com for details. Some basic checks are performed before you commit the code, so code style issues will be visible and fixable before creating the PR. Git pre-commit hooks can always be skipped using the --no-verify flag to git commit, if there is something preventing you from actually fixing the reported (and non-auto-fixed) issues.

Decent test coverage for any new or changed code is also much appreciated :)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

volkswagencarnet-5.5.0.tar.gz (93.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

volkswagencarnet-5.5.0-py3-none-any.whl (70.6 kB view details)

Uploaded Python 3

File details

Details for the file volkswagencarnet-5.5.0.tar.gz.

File metadata

  • Download URL: volkswagencarnet-5.5.0.tar.gz
  • Upload date:
  • Size: 93.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for volkswagencarnet-5.5.0.tar.gz
Algorithm Hash digest
SHA256 5a5270ccc4a95d50031867f9d52d350b1e09c695948b13318b61a1518ccc27bb
MD5 5bbdcc9da280e4642d92473db8b89d61
BLAKE2b-256 a27d48845434f6f91b38af67f3a7b58df0278d0405cac8359697a6659736a633

See more details on using hashes here.

Provenance

The following attestation bundles were made for volkswagencarnet-5.5.0.tar.gz:

Publisher: release.yaml on robinostlund/volkswagencarnet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file volkswagencarnet-5.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for volkswagencarnet-5.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70de75a1e6551614bb9a2cbe0378f4b1c3a31dff3bca57006001b8756e665bbd
MD5 d0bbe58b2ce8c41f014fd7322b42275d
BLAKE2b-256 a4e6c7a1910e8cf2358cbc8887abb017f33c41af749be0f8f032b83f27ec1f9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for volkswagencarnet-5.5.0-py3-none-any.whl:

Publisher: release.yaml on robinostlund/volkswagencarnet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

5.5.1

2 files

This release

5.5.0 This release

2 files

5.4.11

2 files

5.4.9

2 files

5.4.8

2 files

5.4.7

2 files

5.4.6

2 files

5.4.5

2 files

5.4.4

2 files

5.4.3

2 files

5.4.2

2 files

5.4.1

2 files

5.4.0

2 files

5.3.4

2 files

5.3.3

2 files

5.3.2

2 files

5.3.1

2 files

5.3.0

2 files

5.2.9

2 files

5.2.8

2 files

5.2.7

2 files

5.2.6

2 files

5.2.5

2 files

5.2.4

2 files

5.2.3

2 files

5.2.2

2 files

5.2.1

2 files

5.2.0

2 files

5.1.9

2 files

5.1.8

2 files

5.1.7

2 files

5.1.6

2 files

5.1.5

2 files

5.1.4

2 files

5.1.3

2 files

5.1.2

2 files

5.1.1

2 files

5.1.0

2 files

5.0.3

2 files

5.0.2

2 files

5.0.1

2 files

5.0.0

2 files

4.4.74

2 files

4.4.73

2 files

4.4.72

2 files

4.4.71

2 files

4.4.70

2 files

4.4.69

2 files

4.4.68

2 files

4.4.67

2 files

4.4.66

2 files

4.4.65

2 files

4.4.64

2 files

4.4.63

2 files

4.4.62

2 files

4.4.61

2 files

4.4.60

2 files

4.4.59

2 files

4.4.58

2 files

4.4.57

2 files

4.4.56

2 files

4.4.55

2 files

4.4.54

2 files

4.4.53

2 files

4.4.52

2 files

4.4.51

2 files

4.4.50

2 files

4.4.49

2 files

4.4.48

2 files

4.4.47

2 files

4.4.46

2 files

4.4.45

2 files

4.4.44

2 files

4.4.38

2 files

4.4.37

2 files

4.4.36

2 files

4.4.35

2 files

4.4.34

2 files

4.4.33

2 files

4.4.32

2 files

4.4.31

2 files

4.4.30

2 files

4.4.29

2 files

4.4.28

2 files

4.4.27

2 files

4.4.26

2 files

4.4.25

2 files

4.4.24

2 files

4.4.23

2 files

4.4.22

2 files

4.4.21

2 files

4.4.20

2 files

4.4.19

2 files

4.4.18

2 files

4.4.17

2 files

4.4.16

2 files

4.4.15

2 files

4.4.14

2 files

4.4.13

2 files

4.4.12

2 files

4.4.11

2 files

4.4.10

2 files

4.4.9

2 files

4.4.8

2 files

4.4.7

2 files

4.4.6

2 files

4.4.5

2 files

4.4.4

2 files

4.4.3

2 files

4.4.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page