Skip to content

Home Assistant HomeLink trigger fails. AttributeError: Assignment not allowed to message field "location" in protocol message object #9

@MrSco

Description

@MrSco

When trying to activate Homelink using the Tesla Fleet Home Assistant integration ...

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, entity, func, data, call.context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 132, in _async_press_action
    await self.async_press()
  File "/usr/src/homeassistant/homeassistant/components/tesla_fleet/button.py", line 96, in async_press
    await handle_vehicle_command(self.entity_description.func(self))
  File "/usr/src/homeassistant/homeassistant/components/tesla_fleet/helpers.py", line 52, in handle_vehicle_command
    result = await handle_command(command)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tesla_fleet/helpers.py", line 39, in handle_command
    result = await command
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/tesla_fleet_api/vehiclesigned.py", line 990, in trigger_homelink
    action.location = LatLong(latitude=lat, longitude=lon)
    ^^^^^^^^^^^^^^^
AttributeError: Assignment not allowed to message field "location" in protocol message object.

Instead of trying to directly assign to the location field, Can this be fixed by doing...?

# ... existing code ...
async def trigger_homelink(self, lat: float, lon: float) -> None:
    action = VehicleControlTriggerHomelinkAction()
    # Create a new LatLong message first
    location = LatLong()
    location.latitude = lat
    location.longitude = lon
    # Then assign the complete message
    action.location.CopyFrom(location)
    # ... rest of the code ...

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions