Use shorthand attributes in Progetti (#99772)

Use shorthand attributes in Progetti shorthand
This commit is contained in:
Joost Lekkerkerker 2023-09-06 23:34:39 +02:00 committed by GitHub
parent b0e46f425f
commit 61b02e9c66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 12 deletions

View file

@ -62,14 +62,9 @@ class ProgettihwswBinarySensor(CoordinatorEntity, BinarySensorEntity):
def __init__(self, coordinator, name, sensor: Input) -> None:
"""Set initializing values."""
super().__init__(coordinator)
self._name = name
self._attr_name = name
self._sensor = sensor
@property
def name(self):
"""Return the sensor name."""
return self._name
@property
def is_on(self):
"""Get sensor state."""

View file

@ -64,7 +64,7 @@ class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity):
"""Initialize the values."""
super().__init__(coordinator)
self._switch = switch
self._name = name
self._attr_name = name
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on."""
@ -81,11 +81,6 @@ class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity):
await self._switch.toggle()
await self.coordinator.async_request_refresh()
@property
def name(self):
"""Return the switch name."""
return self._name
@property
def is_on(self):
"""Get switch state."""