Skip to content

Commit

Permalink
Hide close action for Pure frunk
Browse files Browse the repository at this point in the history
  • Loading branch information
nshp committed Jan 22, 2024
1 parent fc7411b commit 0d00d62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/lucidmotors/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from typing import Any

from lucidmotors import APIError, LucidAPI, Vehicle, DoorState
from lucidmotors import APIError, LucidAPI, Vehicle, DoorState, StrutType

from homeassistant.components.cover import CoverDeviceClass, CoverEntity, CoverEntityFeature, CoverEntityDescription
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -104,7 +104,14 @@ def __init__(
self.entity_description = description
self.api = coordinator.api
self._attr_unique_id = f"{vehicle.config.vin}-{description.key}"
self._attr_supported_features = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
self._attr_supported_features = CoverEntityFeature.OPEN
# Note: Pure's frunk has STRUT_TYPE_GAS, not powered open/close. Close
# doesn't actually do anything.
if (
description.key != "front_cargo" or
vehicle.config.frunk_strut == StrutType.STRUT_TYPE_POWER
):
self._attr_supported_features |= CoverEntityFeature.CLOSE
self._attr_device_class = CoverDeviceClass.DOOR

async def async_close_cover(self, **kwargs: Any) -> None:
Expand Down

0 comments on commit 0d00d62

Please sign in to comment.