Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
jontofront authored Dec 20, 2023
1 parent d2aadd5 commit f6334bf
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion custom_components/econet300/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,35 @@
@dataclass
class EconetSensorEntityDescription(SensorEntityDescription):
"""Describes Econet sensor entity."""

process_val: Callable[[Any], Any] = lambda x: x


class EconetSensor(SensorEntity):
"""Econet Sensor"""

def __init__(self, entity_description, unique_id):
super().__init__(name=None, unique_id=unique_id)
self.entity_description = entity_description
self._attr_native_value = None
_LOGGER.debug("EconetSensor initialized with name: %s, unique_id: %s", self.name, self.unique_id)
_LOGGER.debug(
"EconetSensor initialized with name: %s, unique_id: %s",
self.name,
self.unique_id,
)

@property
def name(self):
"""Return the name of the sensor."""
if self.entity_description.translation_key:
_LOGGER.debug(
"Using translation key for sensor: %s",
self.entity_description.translation_key,
)
return f"entity.sensor.{self.entity_description.translation_key}"
else:
_LOGGER.debug("Using name for sensor: %s", self.entity_description.name)
return self.entity_description.name

def _sync_state(self, value):
"""Sync state"""
Expand Down

0 comments on commit f6334bf

Please sign in to comment.