Use shorthand attributes in Tuya camera platform (#63228)
parent
7de4801bfa
commit
76a7149a5e
|
@ -50,6 +50,9 @@ async def async_setup_entry(
|
|||
class TuyaCameraEntity(TuyaEntity, CameraEntity):
|
||||
"""Tuya Camera Entity."""
|
||||
|
||||
_attr_supported_features = SUPPORT_STREAM
|
||||
_attr_brand = "Tuya"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
device: TuyaDevice,
|
||||
|
@ -58,22 +61,13 @@ class TuyaCameraEntity(TuyaEntity, CameraEntity):
|
|||
"""Init Tuya Camera."""
|
||||
super().__init__(device, device_manager)
|
||||
CameraEntity.__init__(self)
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Flag supported features."""
|
||||
return SUPPORT_STREAM
|
||||
self._attr_model = device.product_name
|
||||
|
||||
@property
|
||||
def is_recording(self) -> bool:
|
||||
"""Return true if the device is recording."""
|
||||
return self.device.status.get(DPCode.RECORD_SWITCH, False)
|
||||
|
||||
@property
|
||||
def brand(self) -> str | None:
|
||||
"""Return the camera brand."""
|
||||
return "Tuya"
|
||||
|
||||
@property
|
||||
def motion_detection_enabled(self) -> bool:
|
||||
"""Return the camera motion detection status."""
|
||||
|
@ -101,11 +95,6 @@ class TuyaCameraEntity(TuyaEntity, CameraEntity):
|
|||
height=height,
|
||||
)
|
||||
|
||||
@property
|
||||
def model(self) -> str | None:
|
||||
"""Return the camera model."""
|
||||
return self.device.product_name
|
||||
|
||||
def enable_motion_detection(self) -> None:
|
||||
"""Enable motion detection in the camera."""
|
||||
self._send_command([{"code": DPCode.MOTION_SWITCH, "value": True}])
|
||||
|
|
Loading…
Reference in New Issue