Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't close the trunk with latest update #860

Closed
SmarterHomeLife opened this issue Feb 19, 2024 · 13 comments
Closed

Can't close the trunk with latest update #860

SmarterHomeLife opened this issue Feb 19, 2024 · 13 comments

Comments

@SmarterHomeLife
Copy link

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.

@yoali11
Copy link

yoali11 commented Feb 20, 2024

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

@derekakessler
Copy link

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.

@SaveFerrisVote4Pedro
Copy link

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 🙂

@yoali11
Copy link

yoali11 commented Feb 21, 2024

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?

@SmarterHomeLife
Copy link
Author

I was thinking the same thing @yoali11.

@kbrint
Copy link
Contributor

kbrint commented Feb 22, 2024

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.

@SmarterHomeLife
Copy link
Author

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

@derekakessler
Copy link

derekakessler commented Feb 23, 2024

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

@skipishere
Copy link
Collaborator

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

@SmarterHomeLife
Copy link
Author

@skipishere Thanks, I've submitted a PR for this here.
#868

@Avatar1976
Copy link

@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.

@alandtse
Copy link
Owner

Not until the issues raised in the PR are resolved.

@kbrint
Copy link
Contributor

kbrint commented Mar 30, 2024

Confirmed that v3.20.5 fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants