tesla icon indicating copy to clipboard operation
tesla copied to clipboard

Can't close the trunk with latest update

Open SmarterHomeLife opened this issue 2 years ago • 10 comments

Version of the custom_component

v3.19.8

Configuration

No custom config, installed via HACS

Add your logs here.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 19:47:15 (1 occurrences)
Last logged: 19:47:15

[281472554395200] Entity cover.brads_model_3_trunk does not support this service.
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 874, in entity_service_call
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity cover.brads_model_3_trunk does not support this service.

Describe the bug

I can no longer close the trunk after updating to v3.19.8, I can open it but when I try to close I get the error above.

SmarterHomeLife avatar Feb 19 '24 10:02 SmarterHomeLife

I am experiencing the same issue. Only open is supported. Screenshot_20240220-084512

yoali11 avatar Feb 20 '24 07:02 yoali11

Seeing the same. I went as far as completely removing and deleting the integration, restarting HA, and then redownloading and reinstalling the integration. Still only open for trunk, no close.

derekakessler avatar Feb 20 '24 18:02 derekakessler

Same here. I was using a call to the cover:toggle service to open and close the trunk, but no longer working

  • cover.toggle doesn't work anymore
  • cover.close_cover doesn't work
  • cover.open_cover still works

Thank you 🙂

SaveFerrisVote4Pedro avatar Feb 21 '24 02:02 SaveFerrisVote4Pedro

It seems to me that a change was implemented to remove the support of cover.close for the frunk, but somehow this is also applied to the trunk?

yoali11 avatar Feb 21 '24 08:02 yoali11

I was thinking the same thing @yoali11.

SmarterHomeLife avatar Feb 21 '24 09:02 SmarterHomeLife

The code for TeslaCarTrunk.supported_features() is the same as the TeslaCarFrunk.

If anybody has a Power Lift Gate in their car, I bet they can close their Trunk from HA as well.

Is there any Tesla which cannot close the trunk from the keyfob and/or app? I'm not aware of any.

kbrint avatar Feb 22 '24 05:02 kbrint

I've edited the cover.py file in the custom_component to add the open and close functions to the supported features, plus commented out the check for powered lift gate and open/close of the trunk is now working fine.

class TeslaCarTrunk(TeslaCarEntity, CoverEntity):
    """Representation of a Tesla car trunk cover."""

    type = "trunk"
    _attr_device_class = CoverDeviceClass.DOOR
    _attr_icon = "mdi:car-back"
    _attr_supported_features = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE

    async def async_close_cover(self, **kwargs):
        """Send close cover command."""
        _LOGGER.debug("Closing cover: %s", self.name)
        if self.is_closed is False:
            await self._car.toggle_trunk()
            self.async_write_ha_state()

    async def async_open_cover(self, **kwargs):
        """Send open cover command."""
        _LOGGER.debug("Opening cover: %s", self.name)
        if self.is_closed is True:
            await self._car.toggle_trunk()
            self.async_write_ha_state()

    @property
    def is_closed(self):
        """Return True if trunk is closed."""
        return self._car.is_trunk_closed

#    @property
#    def supported_features(self) -> int:
#        """Return supported features."""
#        if self._car.powered_lift_gate:
#            return CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE

#        return CoverEntityFeature.OPEN

SmarterHomeLife avatar Feb 22 '24 22:02 SmarterHomeLife

Kudos, @SmarterHomeLife, that did it. Edit the file, restart HA, and my trunk now opens and closes. Thanks!

derekakessler avatar Feb 23 '24 14:02 derekakessler

@SmarterHomeLife great you've found a fix, could you make a PR for it?

skipishere avatar Feb 23 '24 14:02 skipishere

@skipishere Thanks, I've submitted a PR for this here. https://github.com/alandtse/tesla/pull/868

SmarterHomeLife avatar Feb 23 '24 21:02 SmarterHomeLife

@alandtse any chance this could be integrated into the next release. I keep having to make a custom custom Tesla integration to be able to close my boot.

Avatar1976 avatar Mar 11 '24 02:03 Avatar1976

Not until the issues raised in the PR are resolved.

alandtse avatar Mar 11 '24 02:03 alandtse

Confirmed that v3.20.5 fixes the problem.

kbrint avatar Mar 30 '24 04:03 kbrint