Don't override methods marked as final (#57477)

This commit is contained in:
Marc Mueller 2021-10-11 15:24:06 +02:00 committed by GitHub
parent a827521138
commit 748d915909
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 38 deletions

View file

@ -35,11 +35,6 @@ class BleBoxCoverEntity(BleBoxEntity, CoverEntity):
stop = SUPPORT_STOP if feature.has_stop else 0 stop = SUPPORT_STOP if feature.has_stop else 0
self._attr_supported_features = position | stop | SUPPORT_OPEN | SUPPORT_CLOSE self._attr_supported_features = position | stop | SUPPORT_OPEN | SUPPORT_CLOSE
@property
def state(self):
"""Return the equivalent HA cover state."""
return BLEBOX_TO_HASS_COVER_STATES[self._feature.state]
@property @property
def current_cover_position(self): def current_cover_position(self):
"""Return the current cover position.""" """Return the current cover position."""
@ -83,5 +78,5 @@ class BleBoxCoverEntity(BleBoxEntity, CoverEntity):
await self._feature.async_stop() await self._feature.async_stop()
def _is_state(self, state_name): def _is_state(self, state_name):
value = self.state value = BLEBOX_TO_HASS_COVER_STATES[self._feature.state]
return None if value is None else value == state_name return None if value is None else value == state_name

View file

@ -68,11 +68,6 @@ class DelugeSwitch(ToggleEntity):
"""Return the name of the switch.""" """Return the name of the switch."""
return self._name return self._name
@property
def state(self):
"""Return the state of the device."""
return self._state
@property @property
def is_on(self): def is_on(self):
"""Return true if device is on.""" """Return true if device is on."""

View file

@ -59,11 +59,6 @@ class EvoDHW(EvoChild, WaterHeaterEntity):
self._precision = PRECISION_TENTHS if evo_broker.client_v1 else PRECISION_WHOLE self._precision = PRECISION_TENTHS if evo_broker.client_v1 else PRECISION_WHOLE
self._supported_features = SUPPORT_AWAY_MODE | SUPPORT_OPERATION_MODE self._supported_features = SUPPORT_AWAY_MODE | SUPPORT_OPERATION_MODE
@property
def state(self):
"""Return the current state."""
return EVO_STATE_TO_HA[self._evo_device.stateStatus["state"]]
@property @property
def current_operation(self) -> str: def current_operation(self) -> str:
"""Return the current operating mode (Auto, On, or Off).""" """Return the current operating mode (Auto, On, or Off)."""

View file

@ -204,14 +204,11 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
return self._active return self._active
@property @property
def state_attributes(self): def extra_state_attributes(self):
"""Return the optional state attributes.""" """Return the optional state attributes."""
data = super().state_attributes
if self._saved_target_humidity: if self._saved_target_humidity:
data[ATTR_SAVED_HUMIDITY] = self._saved_target_humidity return {ATTR_SAVED_HUMIDITY: self._saved_target_humidity}
return None
return data
@property @property
def should_poll(self): def should_poll(self):

View file

@ -73,11 +73,6 @@ class HikvisionMotionSwitch(SwitchEntity):
"""Return the name of the device if any.""" """Return the name of the device if any."""
return self._name return self._name
@property
def state(self):
"""Return the state of the device if any."""
return self._state
@property @property
def is_on(self): def is_on(self):
"""Return true if device is on.""" """Return true if device is on."""

View file

@ -73,7 +73,7 @@ class HomeKitGarageDoorCover(HomeKitEntity, CoverEntity):
return SUPPORT_OPEN | SUPPORT_CLOSE return SUPPORT_OPEN | SUPPORT_CLOSE
@property @property
def state(self): def _state(self):
"""Return the current state of the garage door.""" """Return the current state of the garage door."""
value = self.service.value(CharacteristicsTypes.DOOR_STATE_CURRENT) value = self.service.value(CharacteristicsTypes.DOOR_STATE_CURRENT)
return CURRENT_GARAGE_STATE_MAP[value] return CURRENT_GARAGE_STATE_MAP[value]
@ -81,17 +81,17 @@ class HomeKitGarageDoorCover(HomeKitEntity, CoverEntity):
@property @property
def is_closed(self): def is_closed(self):
"""Return true if cover is closed, else False.""" """Return true if cover is closed, else False."""
return self.state == STATE_CLOSED return self._state == STATE_CLOSED
@property @property
def is_closing(self): def is_closing(self):
"""Return if the cover is closing or not.""" """Return if the cover is closing or not."""
return self.state == STATE_CLOSING return self._state == STATE_CLOSING
@property @property
def is_opening(self): def is_opening(self):
"""Return if the cover is opening or not.""" """Return if the cover is opening or not."""
return self.state == STATE_OPENING return self._state == STATE_OPENING
async def async_open_cover(self, **kwargs): async def async_open_cover(self, **kwargs):
"""Send open command.""" """Send open command."""

View file

@ -17,7 +17,7 @@ from homeassistant.components.vacuum import (
SUPPORT_STATUS, SUPPORT_STATUS,
SUPPORT_TURN_OFF, SUPPORT_TURN_OFF,
SUPPORT_TURN_ON, SUPPORT_TURN_ON,
VacuumEntity, StateVacuumEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF from homeassistant.const import STATE_OFF
@ -76,7 +76,7 @@ async def async_setup_entry(
) )
class LitterRobotCleaner(LitterRobotControlEntity, VacuumEntity): class LitterRobotCleaner(LitterRobotControlEntity, StateVacuumEntity):
"""Litter-Robot "Vacuum" Cleaner.""" """Litter-Robot "Vacuum" Cleaner."""
@property @property

View file

@ -47,11 +47,6 @@ class TransmissionSwitch(ToggleEntity):
"""Return the unique id of the entity.""" """Return the unique id of the entity."""
return f"{self._tm_client.api.host}-{self.name}" return f"{self._tm_client.api.host}-{self.name}"
@property
def state(self):
"""Return the state of the device."""
return self._state
@property @property
def should_poll(self): def should_poll(self):
"""Poll for status regularly.""" """Poll for status regularly."""