From f9907f7d42148a4810a1b6e3ecb63994f15bb49d Mon Sep 17 00:00:00 2001 From: Brett Adams Date: Mon, 19 Jan 2026 14:32:05 +1000 Subject: [PATCH] Fix trigger_homelink protobuf assignment error Use constructor-based initialization for LatLong instead of direct field assignment on nested protobuf messages, which was causing AttributeError. Fixes #9 Co-Authored-By: Claude Opus 4.5 --- tesla_fleet_api/tesla/vehicle/commands.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tesla_fleet_api/tesla/vehicle/commands.py b/tesla_fleet_api/tesla/vehicle/commands.py index d6f11ad..477dfe3 100644 --- a/tesla_fleet_api/tesla/vehicle/commands.py +++ b/tesla_fleet_api/tesla/vehicle/commands.py @@ -127,6 +127,7 @@ HMAC_Personalized_Signature_Data, ) from tesla_fleet_api.tesla.vehicle.proto.common_pb2 import ( + LatLong, Void, PreconditioningTimes, OffPeakChargingTimes, @@ -1426,16 +1427,14 @@ async def trigger_homelink( lon: float | None = None, ) -> dict[str, Any]: """Turns on HomeLink (used to open and close garage doors).""" - action = VehicleControlTriggerHomelinkAction() - if lat is not None and lon is not None: - action.location.latitude = lat - action.location.longitude = lon - if token is not None: - action.token = token - return await self._sendInfotainment( Action( - vehicleAction=VehicleAction(vehicleControlTriggerHomelinkAction=action) + vehicleAction=VehicleAction( + vehicleControlTriggerHomelinkAction=VehicleControlTriggerHomelinkAction( + location=LatLong(latitude=lat, longitude=lon) if lat is not None and lon is not None else None, + token=token, + ) + ) ) )