From 748d915909d6e73f9d6bc343551d6a195d239ef7 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 11 Oct 2021 15:24:06 +0200 Subject: [PATCH] Don't override methods marked as final (#57477) --- homeassistant/components/blebox/cover.py | 7 +------ homeassistant/components/deluge/switch.py | 5 ----- homeassistant/components/evohome/water_heater.py | 5 ----- homeassistant/components/generic_hygrostat/humidifier.py | 9 +++------ homeassistant/components/hikvisioncam/switch.py | 5 ----- homeassistant/components/homekit_controller/cover.py | 8 ++++---- homeassistant/components/litterrobot/vacuum.py | 4 ++-- homeassistant/components/transmission/switch.py | 5 ----- 8 files changed, 10 insertions(+), 38 deletions(-) diff --git a/homeassistant/components/blebox/cover.py b/homeassistant/components/blebox/cover.py index 5dc6a486ed3..b107dba1e7f 100644 --- a/homeassistant/components/blebox/cover.py +++ b/homeassistant/components/blebox/cover.py @@ -35,11 +35,6 @@ class BleBoxCoverEntity(BleBoxEntity, CoverEntity): stop = SUPPORT_STOP if feature.has_stop else 0 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 def current_cover_position(self): """Return the current cover position.""" @@ -83,5 +78,5 @@ class BleBoxCoverEntity(BleBoxEntity, CoverEntity): await self._feature.async_stop() 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 diff --git a/homeassistant/components/deluge/switch.py b/homeassistant/components/deluge/switch.py index 2aff1b5266c..bc94b7ad014 100644 --- a/homeassistant/components/deluge/switch.py +++ b/homeassistant/components/deluge/switch.py @@ -68,11 +68,6 @@ class DelugeSwitch(ToggleEntity): """Return the name of the switch.""" return self._name - @property - def state(self): - """Return the state of the device.""" - return self._state - @property def is_on(self): """Return true if device is on.""" diff --git a/homeassistant/components/evohome/water_heater.py b/homeassistant/components/evohome/water_heater.py index 495df9e697e..3d799a64e4d 100644 --- a/homeassistant/components/evohome/water_heater.py +++ b/homeassistant/components/evohome/water_heater.py @@ -59,11 +59,6 @@ class EvoDHW(EvoChild, WaterHeaterEntity): self._precision = PRECISION_TENTHS if evo_broker.client_v1 else PRECISION_WHOLE 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 def current_operation(self) -> str: """Return the current operating mode (Auto, On, or Off).""" diff --git a/homeassistant/components/generic_hygrostat/humidifier.py b/homeassistant/components/generic_hygrostat/humidifier.py index ee1c8f65d1a..726b6e654e7 100644 --- a/homeassistant/components/generic_hygrostat/humidifier.py +++ b/homeassistant/components/generic_hygrostat/humidifier.py @@ -204,14 +204,11 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity): return self._active @property - def state_attributes(self): + def extra_state_attributes(self): """Return the optional state attributes.""" - data = super().state_attributes - if self._saved_target_humidity: - data[ATTR_SAVED_HUMIDITY] = self._saved_target_humidity - - return data + return {ATTR_SAVED_HUMIDITY: self._saved_target_humidity} + return None @property def should_poll(self): diff --git a/homeassistant/components/hikvisioncam/switch.py b/homeassistant/components/hikvisioncam/switch.py index 2f1f89cd261..aa4a430e72e 100644 --- a/homeassistant/components/hikvisioncam/switch.py +++ b/homeassistant/components/hikvisioncam/switch.py @@ -73,11 +73,6 @@ class HikvisionMotionSwitch(SwitchEntity): """Return the name of the device if any.""" return self._name - @property - def state(self): - """Return the state of the device if any.""" - return self._state - @property def is_on(self): """Return true if device is on.""" diff --git a/homeassistant/components/homekit_controller/cover.py b/homeassistant/components/homekit_controller/cover.py index dd25e32b3c4..7e71edd6a75 100644 --- a/homeassistant/components/homekit_controller/cover.py +++ b/homeassistant/components/homekit_controller/cover.py @@ -73,7 +73,7 @@ class HomeKitGarageDoorCover(HomeKitEntity, CoverEntity): return SUPPORT_OPEN | SUPPORT_CLOSE @property - def state(self): + def _state(self): """Return the current state of the garage door.""" value = self.service.value(CharacteristicsTypes.DOOR_STATE_CURRENT) return CURRENT_GARAGE_STATE_MAP[value] @@ -81,17 +81,17 @@ class HomeKitGarageDoorCover(HomeKitEntity, CoverEntity): @property def is_closed(self): """Return true if cover is closed, else False.""" - return self.state == STATE_CLOSED + return self._state == STATE_CLOSED @property def is_closing(self): """Return if the cover is closing or not.""" - return self.state == STATE_CLOSING + return self._state == STATE_CLOSING @property def is_opening(self): """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): """Send open command.""" diff --git a/homeassistant/components/litterrobot/vacuum.py b/homeassistant/components/litterrobot/vacuum.py index 2cfe104c753..e40a971f43f 100644 --- a/homeassistant/components/litterrobot/vacuum.py +++ b/homeassistant/components/litterrobot/vacuum.py @@ -17,7 +17,7 @@ from homeassistant.components.vacuum import ( SUPPORT_STATUS, SUPPORT_TURN_OFF, SUPPORT_TURN_ON, - VacuumEntity, + StateVacuumEntity, ) from homeassistant.config_entries import ConfigEntry 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.""" @property diff --git a/homeassistant/components/transmission/switch.py b/homeassistant/components/transmission/switch.py index 3d85a76f2bd..f706d703565 100644 --- a/homeassistant/components/transmission/switch.py +++ b/homeassistant/components/transmission/switch.py @@ -47,11 +47,6 @@ class TransmissionSwitch(ToggleEntity): """Return the unique id of the entity.""" return f"{self._tm_client.api.host}-{self.name}" - @property - def state(self): - """Return the state of the device.""" - return self._state - @property def should_poll(self): """Poll for status regularly."""