Volkswagen Carnet
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
- HomeAssistant Component a custom component for Home Assistant
- VolkswagenCarnetClient a cli version of this library
Installation
[venv-python3] user@localhost:~
$ pip install volkswagencarnet
Example
#!/usr/bin/env python3
import volkswagencarnet
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'
]
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() as session:
connection = volkswagencarnet.Connection(session, VW_USERNAME, VW_PASSWORD)
if await connection._login():
if await connection.update(request_data=False):
# 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())
Metadata
Release files for volkswagencarnet 4.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| volkswagencarnet-4.4.2.tar.gz | 21.4 kB | Without provenance | Details for volkswagencarnet-4.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| volkswagencarnet-4.4.2-py3-none-any.whl | Python 3 | none | any | Details for volkswagencarnet-4.4.2-py3-none-any.whl |
Total release size: 40.5 kB
Release files / volkswagencarnet-4.4.2.tar.gz
| Download URL | volkswagencarnet-4.4.2.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a58af47bcecc6295c4494792490e04edadbb38cc73b0fb062245a0766e3dc99
|
|
BLAKE2b-256 checksum How to use checksums |
b65b4f0ed6b4a64fb78d9eb2b4db600b596d17d471d9651b6d86b2ec5d1c7c8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / volkswagencarnet-4.4.2-py3-none-any.whl
| Download URL | volkswagencarnet-4.4.2-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5eddc87e8e1b2e61ca0cdba937785151640d3adcc2125e87ac755c39d54becd2
|
|
BLAKE2b-256 checksum How to use checksums |
98c3b838d14b2ecdca7aeb68113d8552debc6e4e19faea38612cdc426f5066c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for volkswagencarnet 4.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.