Skip to content

Commit abef6f7

Browse files
davidrapanthecode
andauthored
Remove Shelly sensor name removal (home-assistant#157071)
Signed-off-by: David Rapan <[email protected]> Co-authored-by: Shay Levy <[email protected]>
1 parent 5556fb9 commit abef6f7

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

homeassistant/components/shelly/sensor.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ def __init__(
106106
"""Initialize select."""
107107
super().__init__(coordinator, key, attribute, description)
108108

109-
if hasattr(self, "_attr_name") and description.role != ROLE_GENERIC:
110-
delattr(self, "_attr_name")
111-
112109
if not description.role:
113110
translation_placeholders, translation_key = (
114111
get_entity_translation_attributes(
@@ -1819,10 +1816,6 @@ def __init__(
18191816
) -> None:
18201817
"""Initialize sensor."""
18211818
super().__init__(coordinator, block, attribute, description)
1822-
1823-
if hasattr(self, "_attr_name"):
1824-
delattr(self, "_attr_name")
1825-
18261819
self._attr_native_unit_of_measurement = description.native_unit_of_measurement
18271820

18281821
@property
@@ -1836,18 +1829,6 @@ class RestSensor(ShellyRestAttributeEntity, SensorEntity):
18361829

18371830
entity_description: RestSensorDescription
18381831

1839-
def __init__(
1840-
self,
1841-
coordinator: ShellyBlockCoordinator,
1842-
attribute: str,
1843-
description: RestSensorDescription,
1844-
) -> None:
1845-
"""Initialize sensor."""
1846-
super().__init__(coordinator, attribute, description)
1847-
1848-
if hasattr(self, "_attr_name"):
1849-
delattr(self, "_attr_name")
1850-
18511832
@property
18521833
def native_value(self) -> StateType:
18531834
"""Return value of sensor."""
@@ -1871,9 +1852,6 @@ def __init__(
18711852
super().__init__(coordinator, block, attribute, description, entry)
18721853
self.restored_data: SensorExtraStoredData | None = None
18731854

1874-
if hasattr(self, "_attr_name"):
1875-
delattr(self, "_attr_name")
1876-
18771855
async def async_added_to_hass(self) -> None:
18781856
"""Handle entity which will be added."""
18791857
await super().async_added_to_hass()
@@ -1920,9 +1898,6 @@ def __init__(
19201898
self.restored_data: SensorExtraStoredData | None = None
19211899

19221900
if coordinator.device.initialized:
1923-
if hasattr(self, "_attr_name"):
1924-
delattr(self, "_attr_name")
1925-
19261901
translation_placeholders, translation_key = (
19271902
get_entity_translation_attributes(
19281903
get_rpc_channel_name(coordinator.device, key),

0 commit comments

Comments
 (0)