Skip to content

Commit

Permalink
Fix cover supported features
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Feb 1, 2024
1 parent 7cb8350 commit 6913275
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions custom_components/teslemetry/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,15 @@ class TeslemetryFrontTrunkEntity(TeslemetryVehicleEntity, CoverEntity):
"""Cover entity for the charge port."""

_attr_device_class = CoverDeviceClass.DOOR
_attr_supported_features = CoverEntityFeature.OPEN

def __init__(self, vehicle: TeslemetryVehicleData, scopes: list[Scopes]) -> None:
"""Initialize the sensor."""
super().__init__(vehicle, "vehicle_state_ft")
if Scopes.VEHICLE_CMDS in scopes:
self._attr_supported_features = CoverEntityFeature.OPEN

# Require VEHICLE_CMDS to make changes
if Scopes.VEHICLE_CMDS not in scopes:
self._attr_supported_features = CoverEntityFeature(0)

@property
def is_closed(self) -> bool | None:
Expand All @@ -137,12 +140,15 @@ class TeslemetryRearTrunkEntity(TeslemetryVehicleEntity, CoverEntity):
"""Cover entity for the charge port."""

_attr_device_class = CoverDeviceClass.DOOR
_attr_supported_features = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE

def __init__(self, vehicle: TeslemetryVehicleData, scopes: list[Scopes]) -> None:
"""Initialize the sensor."""
super().__init__(vehicle, "vehicle_state_rt")
if Scopes.VEHICLE_CMDS in scopes:
self._attr_supported_features = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE

# Require VEHICLE_CMDS to make changes
if Scopes.VEHICLE_CMDS not in scopes:
self._attr_supported_features = CoverEntityFeature(0)

@property
def is_closed(self) -> bool | None:
Expand Down

0 comments on commit 6913275

Please sign in to comment.