Package: volkswagencarnet
Volkswagen CarnetHelp WantedAs i don't have a car with we 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! ThanksInformationRetrieve statistics about your Volkswagen from the Volkswagen Carnet online serviceNo licence, public domain, no guarantees, feel free to use for anything. Please contribute improvements/bugfixes etc.Thanks toWez3ReneboerTubalainenJohNanmilkboyFor supporting and helping in this project.Other related repositoriesHomeAssistant Componenta custom component for Home AssistantInstallation[venv-python3]user@localhost:~
$pipinstallvolkswagencarnetExample#!/usr/bin/env python3fromvolkswagencarnet.vw_connectionimportConnectionimportpprintimportasyncioimportloggingfromaiohttpimportClientSessionlogging.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']defis_enabled(attr):"""Return true if the user has enabled the resource."""returnattrinRESOURCESasyncdefmain():"""Main method."""asyncwithClientSession(headers={'Connection':'keep-alive'})assession:connection=Connection(session,VW_USERNAME,VW_PASSWORD)ifawaitconnection.doLogin():ifawaitconnection.update():# Print overall statepprint.pprint(connection._state)# Print vehiclesforvehicleinconnection.vehicles:pprint.pprint(vehicle)# get all instrumentsinstruments=set()forvehicleinconnection.vehicles:dashboard=vehicle.dashboard(mutable=True)forinstrumentin(instrumentforinstrumentindashboard.instrumentsifinstrument.componentinCOMPONENTSandis_enabled(instrument.slug_attr)):instruments.add(instrument)# Output all supported instrumentsforinstrumentininstruments: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())DevelopmentI'd strongly advise installing the git pre-commit hook usingpre-commit install. Seepre-commit.comfor 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-verifyflag togit 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 :)