Remove temporary variable from supported_features (#42685)

* Remove temporary variable from supported_features

* Revert removing temp variable for supported features hunterdouglas
This commit is contained in:
springstan 2020-11-09 13:19:29 +01:00 committed by GitHub
parent b45fa29077
commit a7bd521768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 30 deletions

View File

@ -68,10 +68,9 @@ class AdsLight(AdsEntity, LightEntity):
@property
def supported_features(self):
"""Flag supported features."""
support = 0
if self._ads_var_brightness is not None:
support = SUPPORT_BRIGHTNESS
return support
return SUPPORT_BRIGHTNESS
return 0
@property
def is_on(self):

View File

@ -68,11 +68,9 @@ class BondLight(BondEntity, LightEntity):
@property
def supported_features(self) -> Optional[int]:
"""Flag supported features."""
features = 0
if self._device.supports_set_brightness():
features |= SUPPORT_BRIGHTNESS
return features
return SUPPORT_BRIGHTNESS
return 0
@property
def is_on(self) -> bool:

View File

@ -187,10 +187,9 @@ class Control4Light(Control4Entity, LightEntity):
@property
def supported_features(self) -> int:
"""Flag supported features."""
flags = 0
if self._is_dimmer:
flags |= SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
return flags
return SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
return 0
async def async_turn_on(self, **kwargs) -> None:
"""Turn the entity on."""

View File

@ -71,10 +71,9 @@ class LcnOutputLight(LcnDevice, LightEntity):
@property
def supported_features(self):
"""Flag supported features."""
features = SUPPORT_TRANSITION
if self.dimmable:
features |= SUPPORT_BRIGHTNESS
return features
return SUPPORT_TRANSITION | SUPPORT_BRIGHTNESS
return SUPPORT_TRANSITION
@property
def brightness(self):

View File

@ -84,10 +84,9 @@ class NestCamera(Camera):
@property
def supported_features(self):
"""Flag supported features."""
features = 0
if CameraLiveStreamTrait.NAME in self._device.traits:
features = features | SUPPORT_STREAM
return features
return SUPPORT_STREAM
return 0
async def stream_source(self):
"""Return the source of the stream."""

View File

@ -44,12 +44,9 @@ class SpiderThermostat(ClimateEntity):
@property
def supported_features(self):
"""Return the list of supported features."""
supports = SUPPORT_TARGET_TEMPERATURE
if self.thermostat.has_fan_mode:
supports |= SUPPORT_FAN_MODE
return supports
return SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE
return SUPPORT_TARGET_TEMPERATURE
@property
def unique_id(self):

View File

@ -68,10 +68,9 @@ class TuyaCover(TuyaDevice, CoverEntity):
@property
def supported_features(self):
"""Flag supported features."""
supported_features = SUPPORT_OPEN | SUPPORT_CLOSE
if self._tuya.support_stop():
supported_features |= SUPPORT_STOP
return supported_features
return SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
return SUPPORT_OPEN | SUPPORT_CLOSE
@property
def is_opening(self):

View File

@ -119,7 +119,6 @@ class TuyaFanDevice(TuyaDevice, FanEntity):
@property
def supported_features(self) -> int:
"""Flag supported features."""
supports = SUPPORT_SET_SPEED
if self._tuya.support_oscillate():
supports = supports | SUPPORT_OSCILLATE
return supports
return SUPPORT_SET_SPEED | SUPPORT_OSCILLATE
return SUPPORT_SET_SPEED

View File

@ -111,10 +111,9 @@ class XboxMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
@property
def supported_features(self):
"""Flag media player features that are supported."""
active_support = SUPPORT_XBOX
if self.state not in [STATE_PLAYING, STATE_PAUSED]:
active_support &= ~SUPPORT_NEXT_TRACK & ~SUPPORT_PREVIOUS_TRACK
return active_support
return SUPPORT_XBOX & ~SUPPORT_NEXT_TRACK & ~SUPPORT_PREVIOUS_TRACK
return SUPPORT_XBOX
@property
def media_content_type(self):