mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Use shorthand attributes in Progetti (#99772)
Use shorthand attributes in Progetti shorthand
This commit is contained in:
parent
b0e46f425f
commit
61b02e9c66
@ -62,14 +62,9 @@ class ProgettihwswBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
|||||||
def __init__(self, coordinator, name, sensor: Input) -> None:
|
def __init__(self, coordinator, name, sensor: Input) -> None:
|
||||||
"""Set initializing values."""
|
"""Set initializing values."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._name = name
|
self._attr_name = name
|
||||||
self._sensor = sensor
|
self._sensor = sensor
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the sensor name."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Get sensor state."""
|
"""Get sensor state."""
|
||||||
|
@ -64,7 +64,7 @@ class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity):
|
|||||||
"""Initialize the values."""
|
"""Initialize the values."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._switch = switch
|
self._switch = switch
|
||||||
self._name = name
|
self._attr_name = name
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch on."""
|
"""Turn the switch on."""
|
||||||
@ -81,11 +81,6 @@ class ProgettihwswSwitch(CoordinatorEntity, SwitchEntity):
|
|||||||
await self._switch.toggle()
|
await self._switch.toggle()
|
||||||
await self.coordinator.async_request_refresh()
|
await self.coordinator.async_request_refresh()
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the switch name."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Get switch state."""
|
"""Get switch state."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user