Add EntityFeature enum to Remote (#69120)
This commit is contained in:
parent
17403f930f
commit
27b48573ea
1 changed files with 13 additions and 1 deletions
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from enum import IntEnum
|
||||||
import functools as ft
|
import functools as ft
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, cast, final
|
from typing import Any, cast, final
|
||||||
|
@ -61,6 +62,17 @@ DEFAULT_NUM_REPEATS = 1
|
||||||
DEFAULT_DELAY_SECS = 0.4
|
DEFAULT_DELAY_SECS = 0.4
|
||||||
DEFAULT_HOLD_SECS = 0
|
DEFAULT_HOLD_SECS = 0
|
||||||
|
|
||||||
|
|
||||||
|
class RemoteEntityFeature(IntEnum):
|
||||||
|
"""Supported features of the remote entity."""
|
||||||
|
|
||||||
|
LEARN_COMMAND = 1
|
||||||
|
DELETE_COMMAND = 2
|
||||||
|
ACTIVITY = 4
|
||||||
|
|
||||||
|
|
||||||
|
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
|
||||||
|
# Please use the RemoteEntityFeature enum instead.
|
||||||
SUPPORT_LEARN_COMMAND = 1
|
SUPPORT_LEARN_COMMAND = 1
|
||||||
SUPPORT_DELETE_COMMAND = 2
|
SUPPORT_DELETE_COMMAND = 2
|
||||||
SUPPORT_ACTIVITY = 4
|
SUPPORT_ACTIVITY = 4
|
||||||
|
@ -175,7 +187,7 @@ class RemoteEntity(ToggleEntity):
|
||||||
@property
|
@property
|
||||||
def state_attributes(self) -> dict[str, Any] | None:
|
def state_attributes(self) -> dict[str, Any] | None:
|
||||||
"""Return optional state attributes."""
|
"""Return optional state attributes."""
|
||||||
if not self.supported_features & SUPPORT_ACTIVITY:
|
if not self.supported_features & RemoteEntityFeature.ACTIVITY:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue