collect: migrate from weconnect to CarConnectivity + VW connector

Replace the weconnect library with carconnectivity and
carconnectivity-connector-volkswagen.  The connector is configured via
a dict passed to CarConnectivity(); startup()/fetch_all() replace
login()/update().  All domain extractors in data_model.py are rewritten
for the new object model (vehicle.charging.*, vehicle.get_electric_drive(),
vehicle.climatization.*, etc.).  Remaining time fields are now derived
from estimated_date_reached DateAttributes.  Battery temperatures are
read directly in °C (no Kelvin conversion).  Auth error handling drops
the manual re-login since the connector manages token refresh internally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 08:02:34 +02:00
co-authored by Claude Sonnet 4.6
parent ef7b99e7e8
commit f050de7001
4 changed files with 122 additions and 125 deletions
+32 -16
View File
@@ -2,35 +2,51 @@ import logging
import sys
try:
from weconnect import weconnect
from carconnectivity.carconnectivity import CarConnectivity
except ImportError:
print("weconnect is not installed. Run: pip install weconnect", file=sys.stderr)
print(
"carconnectivity is not installed. Run: "
"pip install carconnectivity carconnectivity-connector-volkswagen",
file=sys.stderr,
)
sys.exit(1)
log = logging.getLogger(__name__)
def connect(username: str, password: str):
wc = weconnect.WeConnect(
username=username,
password=password,
updateAfterLogin=False,
loginOnInit=True,
)
wc.login()
wc.update()
return wc
def connect(username: str, password: str) -> CarConnectivity:
config = {
"carConnectivity": {
"connectors": [
{
"type": "volkswagen",
"config": {
"username": username,
"password": password,
},
}
]
}
}
cc = CarConnectivity(config=config)
cc.startup()
cc.fetch_all()
return cc
def select_vehicle(wc, vin: str | None):
def select_vehicle(cc: CarConnectivity, vin: str | None):
"""Return (vehicle, error_message). error_message is None on success."""
vehicles = list(wc.vehicles.values())
vehicles = list(cc.get_garage().list_vehicles())
if not vehicles:
return None, "No vehicles found in this WeConnect account"
return None, "No vehicles found in this CarConnectivity account"
if vin:
vehicle = next((v for v in vehicles if v.vin.value == vin), None)
if not vehicle:
available = [v.vin.value for v in vehicles]
return None, f"VIN {vin} not found. Available: {available}"
return vehicle, None
return vehicles[0], None
return vehicles[0], None
def update(cc: CarConnectivity) -> None:
cc.fetch_all()