mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
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
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aioesphomeapi import CoverInfo, CoverOperation, CoverState
|
from aioesphomeapi import APIVersion, CoverInfo, CoverOperation, CoverState
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
@ -41,9 +41,10 @@ class EsphomeCover(EsphomeEntity[CoverInfo, CoverState], CoverEntity):
|
|||||||
@property
|
@property
|
||||||
def supported_features(self) -> CoverEntityFeature:
|
def supported_features(self) -> CoverEntityFeature:
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
flags = (
|
flags = CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
|
||||||
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
|
||||||
)
|
if self._api_version < APIVersion(1, 8) or self._static_info.supports_stop:
|
||||||
|
flags |= CoverEntityFeature.STOP
|
||||||
if self._static_info.supports_position:
|
if self._static_info.supports_position:
|
||||||
flags |= CoverEntityFeature.SET_POSITION
|
flags |= CoverEntityFeature.SET_POSITION
|
||||||
if self._static_info.supports_tilt:
|
if self._static_info.supports_tilt:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user