Use IntFlag for EntityFeature ()

pull/82186/head
epenet 2022-11-16 12:43:17 +01:00 committed by GitHub
parent e01115fd1f
commit a91abebea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 28 additions and 28 deletions
homeassistant/components
alarm_control_panel
climate
humidifier
media_player
update
water_heater

View File

@ -1,5 +1,5 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag
from typing import Final
from homeassistant.backports.enum import StrEnum
@ -23,7 +23,7 @@ FORMAT_TEXT: Final = "text"
FORMAT_NUMBER: Final = "number"
class AlarmControlPanelEntityFeature(IntEnum):
class AlarmControlPanelEntityFeature(IntFlag):
"""Supported features of the alarm control panel entity."""
ARM_HOME = 1

View File

@ -7,7 +7,7 @@ from collections.abc import Awaitable, Callable, Iterable
from contextlib import suppress
from dataclasses import asdict, dataclass
from datetime import datetime, timedelta
from enum import IntEnum
from enum import IntFlag
from functools import partial
import logging
import os
@ -95,7 +95,7 @@ STATE_STREAMING: Final = "streaming"
STATE_IDLE: Final = "idle"
class CameraEntityFeature(IntEnum):
class CameraEntityFeature(IntFlag):
"""Supported features of the camera entity."""
ON_OFF = 1

View File

@ -1,6 +1,6 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag
from homeassistant.backports.enum import StrEnum
@ -146,7 +146,7 @@ SERVICE_SET_SWING_MODE = "set_swing_mode"
SERVICE_SET_TEMPERATURE = "set_temperature"
class ClimateEntityFeature(IntEnum):
class ClimateEntityFeature(IntFlag):
"""Supported features of the climate entity."""
TARGET_TEMPERATURE = 1

View File

@ -4,7 +4,7 @@ from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, TypeVar, final
@ -86,7 +86,7 @@ DEVICE_CLASS_WINDOW = CoverDeviceClass.WINDOW.value
# mypy: disallow-any-generics
class CoverEntityFeature(IntEnum):
class CoverEntityFeature(IntFlag):
"""Supported features of the cover entity."""
OPEN = 1

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
import math
@ -41,7 +41,7 @@ SCAN_INTERVAL = timedelta(seconds=30)
ENTITY_ID_FORMAT = DOMAIN + ".{}"
class FanEntityFeature(IntEnum):
class FanEntityFeature(IntFlag):
"""Supported features of the fan entity."""
SET_SPEED = 1

View File

@ -1,5 +1,5 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag
MODE_NORMAL = "normal"
MODE_ECO = "eco"
@ -30,7 +30,7 @@ SERVICE_SET_MODE = "set_mode"
SERVICE_SET_HUMIDITY = "set_humidity"
class HumidifierEntityFeature(IntEnum):
class HumidifierEntityFeature(IntFlag):
"""Supported features of the alarm control panel entity."""
MODES = 1

View File

@ -5,7 +5,7 @@ from collections.abc import Iterable
import csv
import dataclasses
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import logging
import os
from typing import Any, cast, final
@ -41,7 +41,7 @@ DATA_PROFILES = "light_profiles"
ENTITY_ID_FORMAT = DOMAIN + ".{}"
class LightEntityFeature(IntEnum):
class LightEntityFeature(IntFlag):
"""Supported features of the light entity."""
EFFECT = 4

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, final
@ -48,7 +48,7 @@ MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
LOCK_SERVICE_SCHEMA = make_entity_service_schema({vol.Optional(ATTR_CODE): cv.string})
class LockEntityFeature(IntEnum):
class LockEntityFeature(IntFlag):
"""Supported features of the lock entity."""
OPEN = 1

View File

@ -1,5 +1,5 @@
"""Provides the constants needed for component."""
from enum import IntEnum
from enum import IntFlag
from homeassistant.backports.enum import StrEnum
@ -176,7 +176,7 @@ REPEAT_MODE_ONE = "one"
REPEAT_MODES = [REPEAT_MODE_OFF, REPEAT_MODE_ALL, REPEAT_MODE_ONE]
class MediaPlayerEntityFeature(IntEnum):
class MediaPlayerEntityFeature(IntFlag):
"""Supported features of the media player entity."""
PAUSE = 1

View File

@ -4,7 +4,7 @@ from __future__ import annotations
from collections.abc import Iterable
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, final
@ -61,7 +61,7 @@ DEFAULT_DELAY_SECS = 0.4
DEFAULT_HOLD_SECS = 0
class RemoteEntityFeature(IntEnum):
class RemoteEntityFeature(IntFlag):
"""Supported features of the remote entity."""
LEARN_COMMAND = 1

View File

@ -1,6 +1,6 @@
"""Constants for the siren component."""
from enum import IntEnum
from enum import IntFlag
from typing import Final
DOMAIN: Final = "siren"
@ -12,7 +12,7 @@ ATTR_DURATION: Final = "duration"
ATTR_VOLUME_LEVEL: Final = "volume_level"
class SirenEntityFeature(IntEnum):
class SirenEntityFeature(IntFlag):
"""Supported features of the siren entity."""
TURN_ON = 1

View File

@ -1,13 +1,13 @@
"""Constants for the update component."""
from __future__ import annotations
from enum import IntEnum
from enum import IntFlag
from typing import Final
DOMAIN: Final = "update"
class UpdateEntityFeature(IntEnum):
class UpdateEntityFeature(IntFlag):
"""Supported features of the update entity."""
INSTALL = 1

View File

@ -4,7 +4,7 @@ from __future__ import annotations
from collections.abc import Mapping
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
from functools import partial
import logging
from typing import Any, final
@ -74,7 +74,7 @@ STATES = [STATE_CLEANING, STATE_DOCKED, STATE_RETURNING, STATE_ERROR]
DEFAULT_NAME = "Vacuum cleaner robot"
class VacuumEntityFeature(IntEnum):
class VacuumEntityFeature(IntFlag):
"""Supported features of the vacuum entity."""
TURN_ON = 1

View File

@ -4,7 +4,7 @@ from __future__ import annotations
from collections.abc import Mapping
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
from enum import IntFlag
import functools as ft
import logging
from typing import Any, final
@ -56,7 +56,7 @@ STATE_HEAT_PUMP = "heat_pump"
STATE_GAS = "gas"
class WaterHeaterEntityFeature(IntEnum):
class WaterHeaterEntityFeature(IntFlag):
"""Supported features of the fan entity."""
TARGET_TEMPERATURE = 1