Skip to content
Snippets Groups Projects
Unverified Commit abe60375 authored by Alexander Momchilov's avatar Alexander Momchilov Committed by GitHub
Browse files

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: default avatarJesse Hills <3060199+jesserockz@users.noreply.github.com>
parent 3662c651
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment