mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use CoverDeviceClass in ESPHome (#83395)
This commit is contained in:
parent
985c1b31e1
commit
04793978d3
@ -1,6 +1,7 @@
|
||||
"""Support for ESPHome covers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import suppress
|
||||
from typing import Any
|
||||
|
||||
from aioesphomeapi import CoverInfo, CoverOperation, CoverState
|
||||
@ -8,7 +9,7 @@ from aioesphomeapi import CoverInfo, CoverOperation, CoverState
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
DEVICE_CLASSES,
|
||||
CoverDeviceClass,
|
||||
CoverEntity,
|
||||
CoverEntityFeature,
|
||||
)
|
||||
@ -54,11 +55,11 @@ class EsphomeCover(EsphomeEntity[CoverInfo, CoverState], CoverEntity):
|
||||
return flags
|
||||
|
||||
@property
|
||||
def device_class(self) -> str | None:
|
||||
def device_class(self) -> CoverDeviceClass | None:
|
||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
||||
if self._static_info.device_class not in DEVICE_CLASSES:
|
||||
with suppress(ValueError):
|
||||
return CoverDeviceClass(self._static_info.device_class)
|
||||
return None
|
||||
return self._static_info.device_class
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
|
Loading…
x
Reference in New Issue
Block a user