Change Entity.name default to UNDEFINED (#94574)
* Change Entity.name default to UNDEFINED * Update typing * Update Pylint plugin * Update TTS test
This commit is contained in:
parent
d369d679c7
commit
334dacc322
17 changed files with 277 additions and 67 deletions
|
@ -115,10 +115,15 @@ class CupsSensor(SensorEntity):
|
|||
def __init__(self, data: CupsData, printer_name: str) -> None:
|
||||
"""Initialize the CUPS sensor."""
|
||||
self.data = data
|
||||
self._attr_name = printer_name
|
||||
self._name = printer_name
|
||||
self._printer: dict[str, Any] | None = None
|
||||
self._attr_available = False
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the entity."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
"""Return the state of the sensor."""
|
||||
|
@ -149,7 +154,6 @@ class CupsSensor(SensorEntity):
|
|||
def update(self) -> None:
|
||||
"""Get the latest data and updates the states."""
|
||||
self.data.update()
|
||||
assert self.name is not None
|
||||
assert self.data.printers is not None
|
||||
self._printer = self.data.printers.get(self.name)
|
||||
self._attr_available = self.data.available
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue