mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use EntityFeature enum in components (s** 1/2) (#69439)
This commit is contained in:
parent
e6d8aa34fa
commit
d5ab7e7525
@ -24,21 +24,11 @@ from wakeonlan import send_magic_packet
|
|||||||
from homeassistant.components.media_player import (
|
from homeassistant.components.media_player import (
|
||||||
MediaPlayerDeviceClass,
|
MediaPlayerDeviceClass,
|
||||||
MediaPlayerEntity,
|
MediaPlayerEntity,
|
||||||
|
MediaPlayerEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_APP,
|
MEDIA_TYPE_APP,
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
|
||||||
SUPPORT_PAUSE,
|
|
||||||
SUPPORT_PLAY,
|
|
||||||
SUPPORT_PLAY_MEDIA,
|
|
||||||
SUPPORT_PREVIOUS_TRACK,
|
|
||||||
SUPPORT_SELECT_SOURCE,
|
|
||||||
SUPPORT_TURN_OFF,
|
|
||||||
SUPPORT_TURN_ON,
|
|
||||||
SUPPORT_VOLUME_MUTE,
|
|
||||||
SUPPORT_VOLUME_SET,
|
|
||||||
SUPPORT_VOLUME_STEP,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
|
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -72,15 +62,15 @@ from .const import (
|
|||||||
SOURCES = {"TV": "KEY_TV", "HDMI": "KEY_HDMI"}
|
SOURCES = {"TV": "KEY_TV", "HDMI": "KEY_HDMI"}
|
||||||
|
|
||||||
SUPPORT_SAMSUNGTV = (
|
SUPPORT_SAMSUNGTV = (
|
||||||
SUPPORT_PAUSE
|
MediaPlayerEntityFeature.PAUSE
|
||||||
| SUPPORT_VOLUME_STEP
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
| SUPPORT_VOLUME_MUTE
|
| MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
| SUPPORT_PREVIOUS_TRACK
|
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
| SUPPORT_SELECT_SOURCE
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
| SUPPORT_NEXT_TRACK
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
| SUPPORT_TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
| SUPPORT_PLAY
|
| MediaPlayerEntityFeature.PLAY
|
||||||
| SUPPORT_PLAY_MEDIA
|
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||||
)
|
)
|
||||||
|
|
||||||
# Since the TV will take a few seconds to go to sleep
|
# Since the TV will take a few seconds to go to sleep
|
||||||
@ -145,9 +135,9 @@ class SamsungTVDevice(MediaPlayerEntity):
|
|||||||
self._attr_supported_features = SUPPORT_SAMSUNGTV
|
self._attr_supported_features = SUPPORT_SAMSUNGTV
|
||||||
if self._on_script or self._mac:
|
if self._on_script or self._mac:
|
||||||
# Add turn-on if on_script or mac is available
|
# Add turn-on if on_script or mac is available
|
||||||
self._attr_supported_features |= SUPPORT_TURN_ON
|
self._attr_supported_features |= MediaPlayerEntityFeature.TURN_ON
|
||||||
if self._ssdp_rendering_control_location:
|
if self._ssdp_rendering_control_location:
|
||||||
self._attr_supported_features |= SUPPORT_VOLUME_SET
|
self._attr_supported_features |= MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
name=self.name,
|
name=self.name,
|
||||||
|
@ -8,10 +8,7 @@ import logging
|
|||||||
from satel_integra.satel_integra import AlarmState
|
from satel_integra.satel_integra import AlarmState
|
||||||
|
|
||||||
import homeassistant.components.alarm_control_panel as alarm
|
import homeassistant.components.alarm_control_panel as alarm
|
||||||
from homeassistant.components.alarm_control_panel.const import (
|
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntityFeature
|
||||||
SUPPORT_ALARM_ARM_AWAY,
|
|
||||||
SUPPORT_ALARM_ARM_HOME,
|
|
||||||
)
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_ALARM_ARMED_AWAY,
|
STATE_ALARM_ARMED_AWAY,
|
||||||
STATE_ALARM_ARMED_HOME,
|
STATE_ALARM_ARMED_HOME,
|
||||||
@ -64,6 +61,11 @@ async def async_setup_platform(
|
|||||||
class SatelIntegraAlarmPanel(alarm.AlarmControlPanelEntity):
|
class SatelIntegraAlarmPanel(alarm.AlarmControlPanelEntity):
|
||||||
"""Representation of an AlarmDecoder-based alarm panel."""
|
"""Representation of an AlarmDecoder-based alarm panel."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
AlarmControlPanelEntityFeature.ARM_HOME
|
||||||
|
| AlarmControlPanelEntityFeature.ARM_AWAY
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, controller, name, arm_home_mode, partition_id):
|
def __init__(self, controller, name, arm_home_mode, partition_id):
|
||||||
"""Initialize the alarm panel."""
|
"""Initialize the alarm panel."""
|
||||||
self._name = name
|
self._name = name
|
||||||
@ -147,11 +149,6 @@ class SatelIntegraAlarmPanel(alarm.AlarmControlPanelEntity):
|
|||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Return the list of supported features."""
|
|
||||||
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
|
|
||||||
|
|
||||||
async def async_alarm_disarm(self, code=None):
|
async def async_alarm_disarm(self, code=None):
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
if not code:
|
if not code:
|
||||||
|
@ -11,12 +11,12 @@ from homeassistant.components.climate import (
|
|||||||
SCAN_INTERVAL,
|
SCAN_INTERVAL,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
ClimateEntity,
|
ClimateEntity,
|
||||||
|
ClimateEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
CURRENT_HVAC_IDLE,
|
CURRENT_HVAC_IDLE,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL
|
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -80,18 +80,14 @@ async def async_setup_platform(
|
|||||||
class SchluterThermostat(CoordinatorEntity, ClimateEntity):
|
class SchluterThermostat(CoordinatorEntity, ClimateEntity):
|
||||||
"""Representation of a Schluter thermostat."""
|
"""Representation of a Schluter thermostat."""
|
||||||
|
|
||||||
|
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
|
||||||
def __init__(self, coordinator, serial_number, api, session_id):
|
def __init__(self, coordinator, serial_number, api, session_id):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._serial_number = serial_number
|
self._serial_number = serial_number
|
||||||
self._api = api
|
self._api = api
|
||||||
self._session_id = session_id
|
self._session_id = session_id
|
||||||
self._support_flags = SUPPORT_TARGET_TEMPERATURE
|
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the list of supported features."""
|
|
||||||
return self._support_flags
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
|
|
||||||
from screenlogicpy.const import DATA as SL_DATA, EQUIPMENT, HEAT_MODE
|
from screenlogicpy.const import DATA as SL_DATA, EQUIPMENT, HEAT_MODE
|
||||||
|
|
||||||
from homeassistant.components.climate import ClimateEntity
|
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
ATTR_PRESET_MODE,
|
ATTR_PRESET_MODE,
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
@ -11,8 +11,6 @@ from homeassistant.components.climate.const import (
|
|||||||
CURRENT_HVAC_OFF,
|
CURRENT_HVAC_OFF,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
@ -26,7 +24,6 @@ from .const import DOMAIN
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORTED_FEATURES = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
|
||||||
|
|
||||||
SUPPORTED_MODES = [HVAC_MODE_OFF, HVAC_MODE_HEAT]
|
SUPPORTED_MODES = [HVAC_MODE_OFF, HVAC_MODE_HEAT]
|
||||||
|
|
||||||
@ -55,6 +52,10 @@ async def async_setup_entry(
|
|||||||
class ScreenLogicClimate(ScreenlogicEntity, ClimateEntity, RestoreEntity):
|
class ScreenLogicClimate(ScreenlogicEntity, ClimateEntity, RestoreEntity):
|
||||||
"""Represents a ScreenLogic climate entity."""
|
"""Represents a ScreenLogic climate entity."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, coordinator, body):
|
def __init__(self, coordinator, body):
|
||||||
"""Initialize a ScreenLogic climate entity."""
|
"""Initialize a ScreenLogic climate entity."""
|
||||||
super().__init__(coordinator, body)
|
super().__init__(coordinator, body)
|
||||||
@ -135,11 +136,6 @@ class ScreenLogicClimate(ScreenlogicEntity, ClimateEntity, RestoreEntity):
|
|||||||
HEAT_MODE.NAME_FOR_NUM[mode_num] for mode_num in self._configured_heat_modes
|
HEAT_MODE.NAME_FOR_NUM[mode_num] for mode_num in self._configured_heat_modes
|
||||||
]
|
]
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Supported features of the heater."""
|
|
||||||
return SUPPORTED_FEATURES
|
|
||||||
|
|
||||||
async def async_set_temperature(self, **kwargs) -> None:
|
async def async_set_temperature(self, **kwargs) -> None:
|
||||||
"""Change the setpoint of the heater."""
|
"""Change the setpoint of the heater."""
|
||||||
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
||||||
|
@ -10,9 +10,8 @@ from homeassistant import config_entries
|
|||||||
from homeassistant.components.fan import (
|
from homeassistant.components.fan import (
|
||||||
DIRECTION_FORWARD,
|
DIRECTION_FORWARD,
|
||||||
DIRECTION_REVERSE,
|
DIRECTION_REVERSE,
|
||||||
SUPPORT_DIRECTION,
|
|
||||||
SUPPORT_SET_SPEED,
|
|
||||||
FanEntity,
|
FanEntity,
|
||||||
|
FanEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -50,7 +49,7 @@ async def async_setup_entry(
|
|||||||
class HASensemeFan(SensemeEntity, FanEntity):
|
class HASensemeFan(SensemeEntity, FanEntity):
|
||||||
"""SenseME ceiling fan component."""
|
"""SenseME ceiling fan component."""
|
||||||
|
|
||||||
_attr_supported_features = SUPPORT_SET_SPEED | SUPPORT_DIRECTION
|
_attr_supported_features = FanEntityFeature.SET_SPEED | FanEntityFeature.DIRECTION
|
||||||
_attr_preset_modes = [PRESET_MODE_WHOOSH]
|
_attr_preset_modes = [PRESET_MODE_WHOOSH]
|
||||||
|
|
||||||
def __init__(self, device: SensemeFan) -> None:
|
def __init__(self, device: SensemeFan) -> None:
|
||||||
|
@ -8,7 +8,11 @@ from typing import Any, cast
|
|||||||
from aioshelly.block_device import Block
|
from aioshelly.block_device import Block
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN, ClimateEntity
|
from homeassistant.components.climate import (
|
||||||
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
|
ClimateEntity,
|
||||||
|
ClimateEntityFeature,
|
||||||
|
)
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
CURRENT_HVAC_IDLE,
|
CURRENT_HVAC_IDLE,
|
||||||
@ -16,8 +20,6 @@ from homeassistant.components.climate.const import (
|
|||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
PRESET_NONE,
|
PRESET_NONE,
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||||
@ -118,7 +120,9 @@ class BlockSleepingClimate(
|
|||||||
_attr_icon = "mdi:thermostat"
|
_attr_icon = "mdi:thermostat"
|
||||||
_attr_max_temp = SHTRV_01_TEMPERATURE_SETTINGS["max"]
|
_attr_max_temp = SHTRV_01_TEMPERATURE_SETTINGS["max"]
|
||||||
_attr_min_temp = SHTRV_01_TEMPERATURE_SETTINGS["min"]
|
_attr_min_temp = SHTRV_01_TEMPERATURE_SETTINGS["min"]
|
||||||
_attr_supported_features: int = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
|
_attr_supported_features: int = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||||
|
)
|
||||||
_attr_target_temperature_step = SHTRV_01_TEMPERATURE_SETTINGS["step"]
|
_attr_target_temperature_step = SHTRV_01_TEMPERATURE_SETTINGS["step"]
|
||||||
_attr_temperature_unit = TEMP_CELSIUS
|
_attr_temperature_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
|
@ -7,12 +7,9 @@ from aioshelly.block_device import Block
|
|||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
SUPPORT_CLOSE,
|
|
||||||
SUPPORT_OPEN,
|
|
||||||
SUPPORT_SET_POSITION,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
CoverDeviceClass,
|
CoverDeviceClass,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
@ -76,9 +73,11 @@ class BlockShellyCover(ShellyBlockEntity, CoverEntity):
|
|||||||
"""Initialize block cover."""
|
"""Initialize block cover."""
|
||||||
super().__init__(wrapper, block)
|
super().__init__(wrapper, block)
|
||||||
self.control_result: dict[str, Any] | None = None
|
self.control_result: dict[str, Any] | None = None
|
||||||
self._attr_supported_features: int = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
|
self._attr_supported_features: int = (
|
||||||
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
||||||
|
)
|
||||||
if self.wrapper.device.settings["rollers"][0]["positioning"]:
|
if self.wrapper.device.settings["rollers"][0]["positioning"]:
|
||||||
self._attr_supported_features |= SUPPORT_SET_POSITION
|
self._attr_supported_features |= CoverEntityFeature.SET_POSITION
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self) -> bool:
|
def is_closed(self) -> bool:
|
||||||
@ -150,9 +149,11 @@ class RpcShellyCover(ShellyRpcEntity, CoverEntity):
|
|||||||
"""Initialize rpc cover."""
|
"""Initialize rpc cover."""
|
||||||
super().__init__(wrapper, f"cover:{id_}")
|
super().__init__(wrapper, f"cover:{id_}")
|
||||||
self._id = id_
|
self._id = id_
|
||||||
self._attr_supported_features: int = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
|
self._attr_supported_features: int = (
|
||||||
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
||||||
|
)
|
||||||
if self.status["pos_control"]:
|
if self.status["pos_control"]:
|
||||||
self._attr_supported_features |= SUPPORT_SET_POSITION
|
self._attr_supported_features |= CoverEntityFeature.SET_POSITION
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self) -> bool | None:
|
def is_closed(self) -> bool | None:
|
||||||
|
@ -23,10 +23,7 @@ from homeassistant.components.alarm_control_panel import (
|
|||||||
FORMAT_NUMBER,
|
FORMAT_NUMBER,
|
||||||
FORMAT_TEXT,
|
FORMAT_TEXT,
|
||||||
AlarmControlPanelEntity,
|
AlarmControlPanelEntity,
|
||||||
)
|
AlarmControlPanelEntityFeature,
|
||||||
from homeassistant.components.alarm_control_panel.const import (
|
|
||||||
SUPPORT_ALARM_ARM_AWAY,
|
|
||||||
SUPPORT_ALARM_ARM_HOME,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -118,6 +115,11 @@ async def async_setup_entry(
|
|||||||
class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
|
class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
|
||||||
"""Representation of a SimpliSafe alarm."""
|
"""Representation of a SimpliSafe alarm."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
AlarmControlPanelEntityFeature.ARM_HOME
|
||||||
|
| AlarmControlPanelEntityFeature.ARM_AWAY
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, simplisafe: SimpliSafe, system: SystemType) -> None:
|
def __init__(self, simplisafe: SimpliSafe, system: SystemType) -> None:
|
||||||
"""Initialize the SimpliSafe alarm."""
|
"""Initialize the SimpliSafe alarm."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
@ -131,7 +133,7 @@ class SimpliSafeAlarm(SimpliSafeEntity, AlarmControlPanelEntity):
|
|||||||
self._attr_code_format = FORMAT_NUMBER
|
self._attr_code_format = FORMAT_NUMBER
|
||||||
else:
|
else:
|
||||||
self._attr_code_format = FORMAT_TEXT
|
self._attr_code_format = FORMAT_TEXT
|
||||||
self._attr_supported_features = SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
|
|
||||||
self._last_event = None
|
self._last_event = None
|
||||||
|
|
||||||
self._set_state_from_system_data()
|
self._set_state_from_system_data()
|
||||||
|
@ -4,17 +4,9 @@ from __future__ import annotations
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
from sisyphus_control import Track
|
from sisyphus_control import Track
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerEntity
|
from homeassistant.components.media_player import (
|
||||||
from homeassistant.components.media_player.const import (
|
MediaPlayerEntity,
|
||||||
SUPPORT_NEXT_TRACK,
|
MediaPlayerEntityFeature,
|
||||||
SUPPORT_PAUSE,
|
|
||||||
SUPPORT_PLAY,
|
|
||||||
SUPPORT_PREVIOUS_TRACK,
|
|
||||||
SUPPORT_SHUFFLE_SET,
|
|
||||||
SUPPORT_TURN_OFF,
|
|
||||||
SUPPORT_TURN_ON,
|
|
||||||
SUPPORT_VOLUME_MUTE,
|
|
||||||
SUPPORT_VOLUME_SET,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -32,18 +24,6 @@ from . import DATA_SISYPHUS
|
|||||||
|
|
||||||
MEDIA_TYPE_TRACK = "sisyphus_track"
|
MEDIA_TYPE_TRACK = "sisyphus_track"
|
||||||
|
|
||||||
SUPPORTED_FEATURES = (
|
|
||||||
SUPPORT_VOLUME_MUTE
|
|
||||||
| SUPPORT_VOLUME_SET
|
|
||||||
| SUPPORT_TURN_OFF
|
|
||||||
| SUPPORT_TURN_ON
|
|
||||||
| SUPPORT_PAUSE
|
|
||||||
| SUPPORT_SHUFFLE_SET
|
|
||||||
| SUPPORT_PREVIOUS_TRACK
|
|
||||||
| SUPPORT_NEXT_TRACK
|
|
||||||
| SUPPORT_PLAY
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
@ -67,6 +47,18 @@ async def async_setup_platform(
|
|||||||
class SisyphusPlayer(MediaPlayerEntity):
|
class SisyphusPlayer(MediaPlayerEntity):
|
||||||
"""Representation of a Sisyphus table as a media player device."""
|
"""Representation of a Sisyphus table as a media player device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
|
| MediaPlayerEntityFeature.PAUSE
|
||||||
|
| MediaPlayerEntityFeature.SHUFFLE_SET
|
||||||
|
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
|
| MediaPlayerEntityFeature.PLAY
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, name, host, table):
|
def __init__(self, name, host, table):
|
||||||
"""Initialize the Sisyphus media device."""
|
"""Initialize the Sisyphus media device."""
|
||||||
self._name = name
|
self._name = name
|
||||||
@ -163,11 +155,6 @@ class SisyphusPlayer(MediaPlayerEntity):
|
|||||||
"""Return the last time we got a position update."""
|
"""Return the last time we got a position update."""
|
||||||
return self._table.active_track_remaining_time_as_of
|
return self._table.active_track_remaining_time_as_of
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the features supported by this table."""
|
|
||||||
return SUPPORTED_FEATURES
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_image_url(self):
|
def media_image_url(self):
|
||||||
"""Return the URL for a thumbnail image of the current track."""
|
"""Return the URL for a thumbnail image of the current track."""
|
||||||
|
@ -7,7 +7,11 @@ import logging
|
|||||||
|
|
||||||
from pysmartthings import Attribute, Capability
|
from pysmartthings import Attribute, Capability
|
||||||
|
|
||||||
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN, ClimateEntity
|
from homeassistant.components.climate import (
|
||||||
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
|
ClimateEntity,
|
||||||
|
ClimateEntityFeature,
|
||||||
|
)
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
ATTR_HVAC_MODE,
|
ATTR_HVAC_MODE,
|
||||||
ATTR_TARGET_TEMP_HIGH,
|
ATTR_TARGET_TEMP_HIGH,
|
||||||
@ -23,9 +27,6 @@ from homeassistant.components.climate.const import (
|
|||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
HVAC_MODE_HEAT_COOL,
|
HVAC_MODE_HEAT_COOL,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
SUPPORT_FAN_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
@ -159,16 +160,19 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
|
|||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Init the class."""
|
"""Init the class."""
|
||||||
super().__init__(device)
|
super().__init__(device)
|
||||||
self._supported_features = self._determine_features()
|
self._attr_supported_features = self._determine_features()
|
||||||
self._hvac_mode = None
|
self._hvac_mode = None
|
||||||
self._hvac_modes = None
|
self._hvac_modes = None
|
||||||
|
|
||||||
def _determine_features(self):
|
def _determine_features(self):
|
||||||
flags = SUPPORT_TARGET_TEMPERATURE | SUPPORT_TARGET_TEMPERATURE_RANGE
|
flags = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||||
|
)
|
||||||
if self._device.get_capability(
|
if self._device.get_capability(
|
||||||
Capability.thermostat_fan_mode, Capability.thermostat
|
Capability.thermostat_fan_mode, Capability.thermostat
|
||||||
):
|
):
|
||||||
flags |= SUPPORT_FAN_MODE
|
flags |= ClimateEntityFeature.FAN_MODE
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
async def async_set_fan_mode(self, fan_mode):
|
async def async_set_fan_mode(self, fan_mode):
|
||||||
@ -296,11 +300,6 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
|
|||||||
"""Return the list of available operation modes."""
|
"""Return the list of available operation modes."""
|
||||||
return self._hvac_modes
|
return self._hvac_modes
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the supported features."""
|
|
||||||
return self._supported_features
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
@ -333,6 +332,10 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
|
|||||||
class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
|
class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
|
||||||
"""Define a SmartThings Air Conditioner."""
|
"""Define a SmartThings Air Conditioner."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Init the class."""
|
"""Init the class."""
|
||||||
super().__init__(device)
|
super().__init__(device)
|
||||||
@ -465,11 +468,6 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
|
|||||||
"""Return the list of available operation modes."""
|
"""Return the list of available operation modes."""
|
||||||
return self._hvac_modes
|
return self._hvac_modes
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the supported features."""
|
|
||||||
return SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
"""Return the temperature we try to reach."""
|
"""Return the temperature we try to reach."""
|
||||||
|
@ -12,11 +12,9 @@ from homeassistant.components.cover import (
|
|||||||
STATE_CLOSING,
|
STATE_CLOSING,
|
||||||
STATE_OPEN,
|
STATE_OPEN,
|
||||||
STATE_OPENING,
|
STATE_OPENING,
|
||||||
SUPPORT_CLOSE,
|
|
||||||
SUPPORT_OPEN,
|
|
||||||
SUPPORT_SET_POSITION,
|
|
||||||
CoverDeviceClass,
|
CoverDeviceClass,
|
||||||
CoverEntity,
|
CoverEntity,
|
||||||
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_BATTERY_LEVEL
|
from homeassistant.const import ATTR_BATTERY_LEVEL
|
||||||
@ -77,9 +75,11 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
|
|||||||
self._device_class = None
|
self._device_class = None
|
||||||
self._state = None
|
self._state = None
|
||||||
self._state_attrs = None
|
self._state_attrs = None
|
||||||
self._supported_features = SUPPORT_OPEN | SUPPORT_CLOSE
|
self._attr_supported_features = (
|
||||||
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
|
||||||
|
)
|
||||||
if Capability.switch_level in device.capabilities:
|
if Capability.switch_level in device.capabilities:
|
||||||
self._supported_features |= SUPPORT_SET_POSITION
|
self._attr_supported_features |= CoverEntityFeature.SET_POSITION
|
||||||
|
|
||||||
async def async_close_cover(self, **kwargs):
|
async def async_close_cover(self, **kwargs):
|
||||||
"""Close cover."""
|
"""Close cover."""
|
||||||
@ -99,7 +99,7 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
|
|||||||
|
|
||||||
async def async_set_cover_position(self, **kwargs):
|
async def async_set_cover_position(self, **kwargs):
|
||||||
"""Move the cover to a specific position."""
|
"""Move the cover to a specific position."""
|
||||||
if not self._supported_features & SUPPORT_SET_POSITION:
|
if not self._attr_supported_features & CoverEntityFeature.SET_POSITION:
|
||||||
return
|
return
|
||||||
# Do not set_status=True as device will report progress.
|
# Do not set_status=True as device will report progress.
|
||||||
await self._device.set_level(kwargs[ATTR_POSITION], 0)
|
await self._device.set_level(kwargs[ATTR_POSITION], 0)
|
||||||
@ -144,7 +144,7 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
|
|||||||
@property
|
@property
|
||||||
def current_cover_position(self):
|
def current_cover_position(self):
|
||||||
"""Return current position of cover."""
|
"""Return current position of cover."""
|
||||||
if not self._supported_features & SUPPORT_SET_POSITION:
|
if not self._attr_supported_features & CoverEntityFeature.SET_POSITION:
|
||||||
return None
|
return None
|
||||||
return self._device.status.level
|
return self._device.status.level
|
||||||
|
|
||||||
@ -157,8 +157,3 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
|
|||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Get additional state attributes."""
|
"""Get additional state attributes."""
|
||||||
return self._state_attrs
|
return self._state_attrs
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return self._supported_features
|
|
||||||
|
@ -6,7 +6,7 @@ import math
|
|||||||
|
|
||||||
from pysmartthings import Capability
|
from pysmartthings import Capability
|
||||||
|
|
||||||
from homeassistant.components.fan import SUPPORT_SET_SPEED, FanEntity
|
from homeassistant.components.fan import FanEntity, FanEntityFeature
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -50,6 +50,8 @@ def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None:
|
|||||||
class SmartThingsFan(SmartThingsEntity, FanEntity):
|
class SmartThingsFan(SmartThingsEntity, FanEntity):
|
||||||
"""Define a SmartThings Fan."""
|
"""Define a SmartThings Fan."""
|
||||||
|
|
||||||
|
_attr_supported_features = FanEntityFeature.SET_SPEED
|
||||||
|
|
||||||
async def async_set_percentage(self, percentage: int | None) -> None:
|
async def async_set_percentage(self, percentage: int | None) -> None:
|
||||||
"""Set the speed percentage of the fan."""
|
"""Set the speed percentage of the fan."""
|
||||||
if percentage is None:
|
if percentage is None:
|
||||||
@ -93,8 +95,3 @@ class SmartThingsFan(SmartThingsEntity, FanEntity):
|
|||||||
def speed_count(self) -> int:
|
def speed_count(self) -> int:
|
||||||
"""Return the number of speeds the fan supports."""
|
"""Return the number of speeds the fan supports."""
|
||||||
return int_states_in_range(SPEED_RANGE)
|
return int_states_in_range(SPEED_RANGE)
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_SET_SPEED
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
"""Platform for climate integration."""
|
"""Platform for climate integration."""
|
||||||
from smarttub import Spa
|
from smarttub import Spa
|
||||||
|
|
||||||
from homeassistant.components.climate import ClimateEntity
|
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
CURRENT_HVAC_IDLE,
|
CURRENT_HVAC_IDLE,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
PRESET_ECO,
|
PRESET_ECO,
|
||||||
PRESET_NONE,
|
PRESET_NONE,
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||||
@ -53,6 +51,11 @@ async def async_setup_entry(
|
|||||||
class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
||||||
"""The target water temperature for the spa."""
|
"""The target water temperature for the spa."""
|
||||||
|
|
||||||
|
# Only target temperature is supported.
|
||||||
|
_attr_supported_features = (
|
||||||
|
ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, coordinator, spa):
|
def __init__(self, coordinator, spa):
|
||||||
"""Initialize the entity."""
|
"""Initialize the entity."""
|
||||||
super().__init__(coordinator, spa, "Thermostat")
|
super().__init__(coordinator, spa, "Thermostat")
|
||||||
@ -102,14 +105,6 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
|||||||
max_temp = DEFAULT_MAX_TEMP
|
max_temp = DEFAULT_MAX_TEMP
|
||||||
return convert_temperature(max_temp, TEMP_CELSIUS, self.temperature_unit)
|
return convert_temperature(max_temp, TEMP_CELSIUS, self.temperature_unit)
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the set of supported features.
|
|
||||||
|
|
||||||
Only target temperature is supported.
|
|
||||||
"""
|
|
||||||
return SUPPORT_PRESET_MODE | SUPPORT_TARGET_TEMPERATURE
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def preset_mode(self):
|
def preset_mode(self):
|
||||||
"""Return the current preset mode."""
|
"""Return the current preset mode."""
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from homeassistant.components.fan import SUPPORT_SET_SPEED, FanEntity
|
from homeassistant.components.fan import FanEntity, FanEntityFeature
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -40,6 +40,8 @@ async def async_setup_platform(
|
|||||||
class SmartyFan(FanEntity):
|
class SmartyFan(FanEntity):
|
||||||
"""Representation of a Smarty Fan."""
|
"""Representation of a Smarty Fan."""
|
||||||
|
|
||||||
|
_attr_supported_features = FanEntityFeature.SET_SPEED
|
||||||
|
|
||||||
def __init__(self, name, smarty):
|
def __init__(self, name, smarty):
|
||||||
"""Initialize the entity."""
|
"""Initialize the entity."""
|
||||||
self._name = name
|
self._name = name
|
||||||
@ -61,11 +63,6 @@ class SmartyFan(FanEntity):
|
|||||||
"""Return the icon to use in the frontend."""
|
"""Return the icon to use in the frontend."""
|
||||||
return "mdi:air-conditioner"
|
return "mdi:air-conditioner"
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the list of supported features."""
|
|
||||||
return SUPPORT_SET_SPEED
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return state of the fan."""
|
"""Return state of the fan."""
|
||||||
|
@ -8,11 +8,10 @@ import snapcast.control
|
|||||||
from snapcast.control.server import CONTROL_PORT
|
from snapcast.control.server import CONTROL_PORT
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
from homeassistant.components.media_player import (
|
||||||
from homeassistant.components.media_player.const import (
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_SELECT_SOURCE,
|
MediaPlayerEntity,
|
||||||
SUPPORT_VOLUME_MUTE,
|
MediaPlayerEntityFeature,
|
||||||
SUPPORT_VOLUME_SET,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -45,13 +44,6 @@ from .const import (
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORT_SNAPCAST_CLIENT = (
|
|
||||||
SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET | SUPPORT_SELECT_SOURCE
|
|
||||||
)
|
|
||||||
SUPPORT_SNAPCAST_GROUP = (
|
|
||||||
SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET | SUPPORT_SELECT_SOURCE
|
|
||||||
)
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
{vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT): cv.port}
|
{vol.Required(CONF_HOST): cv.string, vol.Optional(CONF_PORT): cv.port}
|
||||||
)
|
)
|
||||||
@ -124,6 +116,12 @@ async def handle_set_latency(entity, service_call):
|
|||||||
class SnapcastGroupDevice(MediaPlayerEntity):
|
class SnapcastGroupDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Snapcast group device."""
|
"""Representation of a Snapcast group device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, group, uid_part):
|
def __init__(self, group, uid_part):
|
||||||
"""Initialize the Snapcast group device."""
|
"""Initialize the Snapcast group device."""
|
||||||
group.set_callback(self.schedule_update_ha_state)
|
group.set_callback(self.schedule_update_ha_state)
|
||||||
@ -164,11 +162,6 @@ class SnapcastGroupDevice(MediaPlayerEntity):
|
|||||||
"""Volume muted."""
|
"""Volume muted."""
|
||||||
return self._group.muted
|
return self._group.muted
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag media player features that are supported."""
|
|
||||||
return SUPPORT_SNAPCAST_GROUP
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source_list(self):
|
def source_list(self):
|
||||||
"""List of available input sources."""
|
"""List of available input sources."""
|
||||||
@ -215,6 +208,12 @@ class SnapcastGroupDevice(MediaPlayerEntity):
|
|||||||
class SnapcastClientDevice(MediaPlayerEntity):
|
class SnapcastClientDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Snapcast client device."""
|
"""Representation of a Snapcast client device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, client, uid_part):
|
def __init__(self, client, uid_part):
|
||||||
"""Initialize the Snapcast client device."""
|
"""Initialize the Snapcast client device."""
|
||||||
client.set_callback(self.schedule_update_ha_state)
|
client.set_callback(self.schedule_update_ha_state)
|
||||||
@ -255,11 +254,6 @@ class SnapcastClientDevice(MediaPlayerEntity):
|
|||||||
"""Volume muted."""
|
"""Volume muted."""
|
||||||
return self._client.muted
|
return self._client.muted
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag media player features that are supported."""
|
|
||||||
return SUPPORT_SNAPCAST_CLIENT
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source_list(self):
|
def source_list(self):
|
||||||
"""List of available input sources."""
|
"""List of available input sources."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user