mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Explicitly set entity name for VenstarSensor (#102158)
VenstarSensor entity name Set entity name using _attr_name instead of a name property, to avoid warnings about name being implicitly set to None.
This commit is contained in:
parent
474f4329bc
commit
44a5a2dc06
@ -146,6 +146,7 @@ class VenstarSensor(VenstarEntity, SensorEntity):
|
|||||||
super().__init__(coordinator, config)
|
super().__init__(coordinator, config)
|
||||||
self.entity_description = entity_description
|
self.entity_description = entity_description
|
||||||
self.sensor_name = sensor_name
|
self.sensor_name = sensor_name
|
||||||
|
self._attr_name = entity_description.name_fn(sensor_name)
|
||||||
self._config = config
|
self._config = config
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -153,11 +154,6 @@ class VenstarSensor(VenstarEntity, SensorEntity):
|
|||||||
"""Return the unique id."""
|
"""Return the unique id."""
|
||||||
return f"{self._config.entry_id}_{self.sensor_name.replace(' ', '_')}_{self.entity_description.key}"
|
return f"{self._config.entry_id}_{self.sensor_name.replace(' ', '_')}_{self.entity_description.key}"
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the device."""
|
|
||||||
return self.entity_description.name_fn(self.sensor_name)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> int:
|
def native_value(self) -> int:
|
||||||
"""Return state of the sensor."""
|
"""Return state of the sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user