Skip to content

Commit

Permalink
Explicitly set entity name for VenstarSensor (home-assistant#102158)
Browse files Browse the repository at this point in the history
VenstarSensor entity name

Set entity name using _attr_name instead of a name property, to
avoid warnings about name being implicitly set to None.
  • Loading branch information
dseven authored Oct 17, 2023
1 parent 474f432 commit 44a5a2d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions homeassistant/components/venstar/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,14 @@ def __init__(
super().__init__(coordinator, config)
self.entity_description = entity_description
self.sensor_name = sensor_name
self._attr_name = entity_description.name_fn(sensor_name)
self._config = config

@property
def unique_id(self):
"""Return the unique id."""
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
def native_value(self) -> int:
"""Return state of the sensor."""
Expand Down

0 comments on commit 44a5a2d

Please sign in to comment.