Disable esphome stopping a cover if the cover doesn't support stopping (#80104)
* Make "CoverEntityFeature.STOP" conditional * Check APIVersion before checking false by default flag * sort --------- Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
3662c651c9
commit
abe60375b3
1 changed files with 5 additions and 4 deletions
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from aioesphomeapi import CoverInfo, CoverOperation, CoverState
|
||||
from aioesphomeapi import APIVersion, CoverInfo, CoverOperation, CoverState
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
|
@ -41,9 +41,10 @@ class EsphomeCover(EsphomeEntity[CoverInfo, CoverState], CoverEntity):
|
|||
@property
|
||||
def supported_features(self) -> CoverEntityFeature:
|
||||
"""Flag supported features."""
|
||||
flags = (
|
||||
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
||||
)
|
||||
flags = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
|
||||
|
||||
if self._api_version < APIVersion(1, 8) or self._static_info.supports_stop:
|
||||
flags |= CoverEntityFeature.STOP
|
||||
if self._static_info.supports_position:
|
||||
flags |= CoverEntityFeature.SET_POSITION
|
||||
if self._static_info.supports_tilt:
|
||||
|
|
Loading…
Add table
Reference in a new issue