Use EntityFeature enum in components (r**) (#69437)
parent
cbb76824e9
commit
b8fc399882
|
@ -7,7 +7,11 @@ from socket import timeout
|
||||||
import radiotherm
|
import radiotherm
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
|
from homeassistant.components.climate import (
|
||||||
|
PLATFORM_SCHEMA,
|
||||||
|
ClimateEntity,
|
||||||
|
ClimateEntityFeature,
|
||||||
|
)
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
CURRENT_HVAC_COOL,
|
CURRENT_HVAC_COOL,
|
||||||
CURRENT_HVAC_HEAT,
|
CURRENT_HVAC_HEAT,
|
||||||
|
@ -20,9 +24,6 @@ from homeassistant.components.climate.const import (
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
PRESET_AWAY,
|
PRESET_AWAY,
|
||||||
PRESET_HOME,
|
PRESET_HOME,
|
||||||
SUPPORT_FAN_MODE,
|
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
|
@ -105,9 +106,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | SUPPORT_PRESET_MODE
|
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(
|
def setup_platform(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config: ConfigType,
|
config: ConfigType,
|
||||||
|
@ -141,6 +139,12 @@ def setup_platform(
|
||||||
class RadioThermostat(ClimateEntity):
|
class RadioThermostat(ClimateEntity):
|
||||||
"""Representation of a Radio Thermostat."""
|
"""Representation of a Radio Thermostat."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
| ClimateEntityFeature.FAN_MODE
|
||||||
|
| ClimateEntityFeature.PRESET_MODE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, device, hold_temp):
|
def __init__(self, device, hold_temp):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
self.device = device
|
self.device = device
|
||||||
|
@ -163,11 +167,6 @@ class RadioThermostat(ClimateEntity):
|
||||||
# Fan circulate mode is only supported by the CT80 models.
|
# Fan circulate mode is only supported by the CT80 models.
|
||||||
self._is_model_ct80 = isinstance(self.device, radiotherm.thermostat.CT80)
|
self._is_model_ct80 = isinstance(self.device, radiotherm.thermostat.CT80)
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Return the list of supported features."""
|
|
||||||
return SUPPORT_FLAGS
|
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
# Set the time on the device. This shouldn't be in the
|
# Set the time on the device. This shouldn't be in the
|
||||||
|
|
|
@ -5,15 +5,7 @@ import logging
|
||||||
|
|
||||||
import RFXtrx as rfxtrxmod
|
import RFXtrx as rfxtrxmod
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import CoverEntity, CoverEntityFeature
|
||||||
SUPPORT_CLOSE,
|
|
||||||
SUPPORT_CLOSE_TILT,
|
|
||||||
SUPPORT_OPEN,
|
|
||||||
SUPPORT_OPEN_TILT,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
SUPPORT_STOP_TILT,
|
|
||||||
CoverEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import STATE_OPEN
|
from homeassistant.const import STATE_OPEN
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
@ -91,14 +83,18 @@ class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
supported_features = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
|
supported_features = (
|
||||||
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE | CoverEntityFeature.STOP
|
||||||
|
)
|
||||||
|
|
||||||
if self._venetian_blind_mode in (
|
if self._venetian_blind_mode in (
|
||||||
CONST_VENETIAN_BLIND_MODE_US,
|
CONST_VENETIAN_BLIND_MODE_US,
|
||||||
CONST_VENETIAN_BLIND_MODE_EU,
|
CONST_VENETIAN_BLIND_MODE_EU,
|
||||||
):
|
):
|
||||||
supported_features |= (
|
supported_features |= (
|
||||||
SUPPORT_OPEN_TILT | SUPPORT_CLOSE_TILT | SUPPORT_STOP_TILT
|
CoverEntityFeature.OPEN_TILT
|
||||||
|
| CoverEntityFeature.CLOSE_TILT
|
||||||
|
| CoverEntityFeature.STOP_TILT
|
||||||
)
|
)
|
||||||
|
|
||||||
return supported_features
|
return supported_features
|
||||||
|
|
|
@ -4,12 +4,7 @@ import logging
|
||||||
from homeassistant.components.alarm_control_panel import (
|
from homeassistant.components.alarm_control_panel import (
|
||||||
FORMAT_NUMBER,
|
FORMAT_NUMBER,
|
||||||
AlarmControlPanelEntity,
|
AlarmControlPanelEntity,
|
||||||
)
|
AlarmControlPanelEntityFeature,
|
||||||
from homeassistant.components.alarm_control_panel.const import (
|
|
||||||
SUPPORT_ALARM_ARM_AWAY,
|
|
||||||
SUPPORT_ALARM_ARM_CUSTOM_BYPASS,
|
|
||||||
SUPPORT_ALARM_ARM_HOME,
|
|
||||||
SUPPORT_ALARM_ARM_NIGHT,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
@ -42,10 +37,10 @@ from .entity import RiscoEntity
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
STATES_TO_SUPPORTED_FEATURES = {
|
STATES_TO_SUPPORTED_FEATURES = {
|
||||||
STATE_ALARM_ARMED_AWAY: SUPPORT_ALARM_ARM_AWAY,
|
STATE_ALARM_ARMED_AWAY: AlarmControlPanelEntityFeature.ARM_AWAY,
|
||||||
STATE_ALARM_ARMED_CUSTOM_BYPASS: SUPPORT_ALARM_ARM_CUSTOM_BYPASS,
|
STATE_ALARM_ARMED_CUSTOM_BYPASS: AlarmControlPanelEntityFeature.ARM_CUSTOM_BYPASS,
|
||||||
STATE_ALARM_ARMED_HOME: SUPPORT_ALARM_ARM_HOME,
|
STATE_ALARM_ARMED_HOME: AlarmControlPanelEntityFeature.ARM_HOME,
|
||||||
STATE_ALARM_ARMED_NIGHT: SUPPORT_ALARM_ARM_NIGHT,
|
STATE_ALARM_ARMED_NIGHT: AlarmControlPanelEntityFeature.ARM_NIGHT,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ from homeassistant.components.media_player import (
|
||||||
BrowseMedia,
|
BrowseMedia,
|
||||||
MediaPlayerDeviceClass,
|
MediaPlayerDeviceClass,
|
||||||
MediaPlayerEntity,
|
MediaPlayerEntity,
|
||||||
|
MediaPlayerEntityFeature,
|
||||||
async_process_play_media_url,
|
async_process_play_media_url,
|
||||||
)
|
)
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
|
@ -24,17 +25,6 @@ from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_MUSIC,
|
MEDIA_TYPE_MUSIC,
|
||||||
MEDIA_TYPE_URL,
|
MEDIA_TYPE_URL,
|
||||||
MEDIA_TYPE_VIDEO,
|
MEDIA_TYPE_VIDEO,
|
||||||
SUPPORT_BROWSE_MEDIA,
|
|
||||||
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_STEP,
|
|
||||||
)
|
)
|
||||||
from homeassistant.components.stream.const import FORMAT_CONTENT_TYPE, HLS_PROVIDER
|
from homeassistant.components.stream.const import FORMAT_CONTENT_TYPE, HLS_PROVIDER
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
@ -68,20 +58,6 @@ from .helpers import format_channel_name, roku_exception_handler
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORT_ROKU = (
|
|
||||||
SUPPORT_PREVIOUS_TRACK
|
|
||||||
| SUPPORT_NEXT_TRACK
|
|
||||||
| SUPPORT_VOLUME_STEP
|
|
||||||
| SUPPORT_VOLUME_MUTE
|
|
||||||
| SUPPORT_SELECT_SOURCE
|
|
||||||
| SUPPORT_PAUSE
|
|
||||||
| SUPPORT_PLAY
|
|
||||||
| SUPPORT_PLAY_MEDIA
|
|
||||||
| SUPPORT_TURN_ON
|
|
||||||
| SUPPORT_TURN_OFF
|
|
||||||
| SUPPORT_BROWSE_MEDIA
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
STREAM_FORMAT_TO_MEDIA_TYPE = {
|
STREAM_FORMAT_TO_MEDIA_TYPE = {
|
||||||
"dash": MEDIA_TYPE_VIDEO,
|
"dash": MEDIA_TYPE_VIDEO,
|
||||||
|
@ -137,6 +113,20 @@ async def async_setup_entry(
|
||||||
class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
||||||
"""Representation of a Roku media player on the network."""
|
"""Representation of a Roku media player on the network."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
|
| MediaPlayerEntityFeature.PAUSE
|
||||||
|
| MediaPlayerEntityFeature.PLAY
|
||||||
|
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||||
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
|
| MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, unique_id: str | None, coordinator: RokuDataUpdateCoordinator
|
self, unique_id: str | None, coordinator: RokuDataUpdateCoordinator
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -148,7 +138,6 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
||||||
|
|
||||||
self._attr_name = coordinator.data.info.name
|
self._attr_name = coordinator.data.info.name
|
||||||
self._attr_unique_id = unique_id
|
self._attr_unique_id = unique_id
|
||||||
self._attr_supported_features = SUPPORT_ROKU
|
|
||||||
|
|
||||||
def _media_playback_trackable(self) -> bool:
|
def _media_playback_trackable(self) -> bool:
|
||||||
"""Detect if we have enough media data to track playback."""
|
"""Detect if we have enough media data to track playback."""
|
||||||
|
|
|
@ -4,23 +4,9 @@ import logging
|
||||||
from roonapi import split_media_path
|
from roonapi import split_media_path
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerEntity
|
from homeassistant.components.media_player import (
|
||||||
from homeassistant.components.media_player.const import (
|
MediaPlayerEntity,
|
||||||
SUPPORT_BROWSE_MEDIA,
|
MediaPlayerEntityFeature,
|
||||||
SUPPORT_GROUPING,
|
|
||||||
SUPPORT_NEXT_TRACK,
|
|
||||||
SUPPORT_PAUSE,
|
|
||||||
SUPPORT_PLAY,
|
|
||||||
SUPPORT_PLAY_MEDIA,
|
|
||||||
SUPPORT_PREVIOUS_TRACK,
|
|
||||||
SUPPORT_SEEK,
|
|
||||||
SUPPORT_SHUFFLE_SET,
|
|
||||||
SUPPORT_STOP,
|
|
||||||
SUPPORT_TURN_OFF,
|
|
||||||
SUPPORT_TURN_ON,
|
|
||||||
SUPPORT_VOLUME_MUTE,
|
|
||||||
SUPPORT_VOLUME_SET,
|
|
||||||
SUPPORT_VOLUME_STEP,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
@ -44,24 +30,6 @@ from homeassistant.util.dt import utcnow
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
from .media_browser import browse_media
|
from .media_browser import browse_media
|
||||||
|
|
||||||
SUPPORT_ROON = (
|
|
||||||
SUPPORT_BROWSE_MEDIA
|
|
||||||
| SUPPORT_GROUPING
|
|
||||||
| SUPPORT_PAUSE
|
|
||||||
| SUPPORT_VOLUME_SET
|
|
||||||
| SUPPORT_STOP
|
|
||||||
| SUPPORT_PREVIOUS_TRACK
|
|
||||||
| SUPPORT_NEXT_TRACK
|
|
||||||
| SUPPORT_SHUFFLE_SET
|
|
||||||
| SUPPORT_SEEK
|
|
||||||
| SUPPORT_TURN_ON
|
|
||||||
| SUPPORT_TURN_OFF
|
|
||||||
| SUPPORT_VOLUME_MUTE
|
|
||||||
| SUPPORT_PLAY
|
|
||||||
| SUPPORT_PLAY_MEDIA
|
|
||||||
| SUPPORT_VOLUME_STEP
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SERVICE_TRANSFER = "transfer"
|
SERVICE_TRANSFER = "transfer"
|
||||||
|
@ -108,6 +76,24 @@ async def async_setup_entry(
|
||||||
class RoonDevice(MediaPlayerEntity):
|
class RoonDevice(MediaPlayerEntity):
|
||||||
"""Representation of an Roon device."""
|
"""Representation of an Roon device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.BROWSE_MEDIA
|
||||||
|
| MediaPlayerEntityFeature.GROUPING
|
||||||
|
| MediaPlayerEntityFeature.PAUSE
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.STOP
|
||||||
|
| MediaPlayerEntityFeature.PREVIOUS_TRACK
|
||||||
|
| MediaPlayerEntityFeature.NEXT_TRACK
|
||||||
|
| MediaPlayerEntityFeature.SHUFFLE_SET
|
||||||
|
| MediaPlayerEntityFeature.SEEK
|
||||||
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.PLAY
|
||||||
|
| MediaPlayerEntityFeature.PLAY_MEDIA
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_STEP
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, server, player_data):
|
def __init__(self, server, player_data):
|
||||||
"""Initialize Roon device object."""
|
"""Initialize Roon device object."""
|
||||||
self._remove_signal_status = None
|
self._remove_signal_status = None
|
||||||
|
@ -154,11 +140,6 @@ class RoonDevice(MediaPlayerEntity):
|
||||||
"""Return True if entity is available."""
|
"""Return True if entity is available."""
|
||||||
return self._available
|
return self._available
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag media player features that are supported."""
|
|
||||||
return SUPPORT_ROON
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def group_members(self):
|
def group_members(self):
|
||||||
"""Return the grouped players."""
|
"""Return the grouped players."""
|
||||||
|
|
|
@ -4,15 +4,12 @@ from __future__ import annotations
|
||||||
from russound_rio import Russound
|
from russound_rio import Russound
|
||||||
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,
|
||||||
MEDIA_TYPE_MUSIC,
|
MediaPlayerEntity,
|
||||||
SUPPORT_SELECT_SOURCE,
|
MediaPlayerEntityFeature,
|
||||||
SUPPORT_TURN_OFF,
|
|
||||||
SUPPORT_TURN_ON,
|
|
||||||
SUPPORT_VOLUME_MUTE,
|
|
||||||
SUPPORT_VOLUME_SET,
|
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.media_player.const import MEDIA_TYPE_MUSIC
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -26,14 +23,6 @@ import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
SUPPORT_RUSSOUND = (
|
|
||||||
SUPPORT_VOLUME_MUTE
|
|
||||||
| SUPPORT_VOLUME_SET
|
|
||||||
| SUPPORT_TURN_ON
|
|
||||||
| SUPPORT_TURN_OFF
|
|
||||||
| SUPPORT_SELECT_SOURCE
|
|
||||||
)
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_HOST): cv.string,
|
vol.Required(CONF_HOST): cv.string,
|
||||||
|
@ -81,6 +70,14 @@ async def async_setup_platform(
|
||||||
class RussoundZoneDevice(MediaPlayerEntity):
|
class RussoundZoneDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Russound Zone."""
|
"""Representation of a Russound Zone."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, russ, zone_id, name, sources):
|
def __init__(self, russ, zone_id, name, sources):
|
||||||
"""Initialize the zone device."""
|
"""Initialize the zone device."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -141,11 +138,6 @@ class RussoundZoneDevice(MediaPlayerEntity):
|
||||||
if status == "OFF":
|
if status == "OFF":
|
||||||
return STATE_OFF
|
return STATE_OFF
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag media player features that are supported."""
|
|
||||||
return SUPPORT_RUSSOUND
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self):
|
def source(self):
|
||||||
"""Get the currently selected source."""
|
"""Get the currently selected source."""
|
||||||
|
|
|
@ -6,13 +6,10 @@ import logging
|
||||||
from russound import russound
|
from russound import russound
|
||||||
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_TURN_OFF,
|
MediaPlayerEntityFeature,
|
||||||
SUPPORT_TURN_ON,
|
|
||||||
SUPPORT_VOLUME_MUTE,
|
|
||||||
SUPPORT_VOLUME_SET,
|
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, STATE_OFF, STATE_ON
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
@ -25,13 +22,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
CONF_ZONES = "zones"
|
CONF_ZONES = "zones"
|
||||||
CONF_SOURCES = "sources"
|
CONF_SOURCES = "sources"
|
||||||
|
|
||||||
SUPPORT_RUSSOUND = (
|
|
||||||
SUPPORT_VOLUME_MUTE
|
|
||||||
| SUPPORT_VOLUME_SET
|
|
||||||
| SUPPORT_TURN_ON
|
|
||||||
| SUPPORT_TURN_OFF
|
|
||||||
| SUPPORT_SELECT_SOURCE
|
|
||||||
)
|
|
||||||
|
|
||||||
ZONE_SCHEMA = vol.Schema({vol.Required(CONF_NAME): cv.string})
|
ZONE_SCHEMA = vol.Schema({vol.Required(CONF_NAME): cv.string})
|
||||||
|
|
||||||
|
@ -81,6 +71,14 @@ def setup_platform(
|
||||||
class RussoundRNETDevice(MediaPlayerEntity):
|
class RussoundRNETDevice(MediaPlayerEntity):
|
||||||
"""Representation of a Russound RNET device."""
|
"""Representation of a Russound RNET device."""
|
||||||
|
|
||||||
|
_attr_supported_features = (
|
||||||
|
MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
|
| MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, hass, russ, sources, zone_id, extra):
|
def __init__(self, hass, russ, sources, zone_id, extra):
|
||||||
"""Initialise the Russound RNET device."""
|
"""Initialise the Russound RNET device."""
|
||||||
self._name = extra["name"]
|
self._name = extra["name"]
|
||||||
|
@ -129,11 +127,6 @@ class RussoundRNETDevice(MediaPlayerEntity):
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag media player features that are supported."""
|
|
||||||
return SUPPORT_RUSSOUND
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source(self):
|
def source(self):
|
||||||
"""Get the currently selected source."""
|
"""Get the currently selected source."""
|
||||||
|
|
Loading…
Reference in New Issue