Skip to content

Commit f9907f7

Browse files
Bre77claude
andcommitted
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 <noreply@anthropic.com>
1 parent 535ad15 commit f9907f7

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

tesla_fleet_api/tesla/vehicle/commands.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
HMAC_Personalized_Signature_Data,
128128
)
129129
from tesla_fleet_api.tesla.vehicle.proto.common_pb2 import (
130+
LatLong,
130131
Void,
131132
PreconditioningTimes,
132133
OffPeakChargingTimes,
@@ -1426,16 +1427,14 @@ async def trigger_homelink(
14261427
lon: float | None = None,
14271428
) -> dict[str, Any]:
14281429
"""Turns on HomeLink (used to open and close garage doors)."""
1429-
action = VehicleControlTriggerHomelinkAction()
1430-
if lat is not None and lon is not None:
1431-
action.location.latitude = lat
1432-
action.location.longitude = lon
1433-
if token is not None:
1434-
action.token = token
1435-
14361430
return await self._sendInfotainment(
14371431
Action(
1438-
vehicleAction=VehicleAction(vehicleControlTriggerHomelinkAction=action)
1432+
vehicleAction=VehicleAction(
1433+
vehicleControlTriggerHomelinkAction=VehicleControlTriggerHomelinkAction(
1434+
location=LatLong(latitude=lat, longitude=lon) if lat is not None and lon is not None else None,
1435+
token=token,
1436+
)
1437+
)
14391438
)
14401439
)
14411440

0 commit comments

Comments
 (0)