Refactor static attributes to class attrs for UniFi Protect (#63236)
This commit is contained in:
parent
50188e06ac
commit
4099d84fa4
3 changed files with 7 additions and 5 deletions
|
@ -39,6 +39,9 @@ async def async_setup_entry(
|
|||
class ProtectButton(ProtectDeviceEntity, ButtonEntity):
|
||||
"""A Ubiquiti UniFi Protect Reboot button."""
|
||||
|
||||
_attr_entity_registry_enabled_default = False
|
||||
_attr_device_class = ButtonDeviceClass.RESTART
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data: ProtectData,
|
||||
|
@ -47,8 +50,6 @@ class ProtectButton(ProtectDeviceEntity, ButtonEntity):
|
|||
"""Initialize an UniFi camera."""
|
||||
super().__init__(data, device)
|
||||
self._attr_name = f"{self.device.name} Reboot Device"
|
||||
self._attr_entity_registry_enabled_default = False
|
||||
self._attr_device_class = ButtonDeviceClass.RESTART
|
||||
|
||||
async def async_press(self) -> None:
|
||||
"""Press the button."""
|
||||
|
|
|
@ -56,6 +56,9 @@ def hass_to_unifi_brightness(value: int) -> int:
|
|||
class ProtectLight(ProtectDeviceEntity, LightEntity):
|
||||
"""A Ubiquiti UniFi Protect Light Entity."""
|
||||
|
||||
_attr_icon = "mdi:spotlight-beam"
|
||||
_attr_supported_features = SUPPORT_BRIGHTNESS
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data: ProtectData,
|
||||
|
@ -64,8 +67,6 @@ class ProtectLight(ProtectDeviceEntity, LightEntity):
|
|||
"""Initialize an UniFi light."""
|
||||
self.device: Light = device
|
||||
super().__init__(data)
|
||||
self._attr_icon = "mdi:spotlight-beam"
|
||||
self._attr_supported_features = SUPPORT_BRIGHTNESS
|
||||
|
||||
@callback
|
||||
def _async_update_device_from_protect(self) -> None:
|
||||
|
|
|
@ -73,7 +73,7 @@ CAMERA_NUMBERS: tuple[ProtectNumberEntityDescription, ...] = (
|
|||
),
|
||||
ProtectNumberEntityDescription(
|
||||
key=_KEY_ZOOM_POS,
|
||||
name="Zoom Position",
|
||||
name="Zoom Level",
|
||||
icon="mdi:magnify-plus-outline",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
ufp_min=0,
|
||||
|
|
Loading…
Add table
Reference in a new issue