mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use shorthand attributes in Logi circle (#99592)
This commit is contained in:
parent
1f648feaef
commit
0ae12ad08f
@ -71,10 +71,17 @@ class LogiCam(Camera):
|
|||||||
"""Initialize Logi Circle camera."""
|
"""Initialize Logi Circle camera."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._camera = camera
|
self._camera = camera
|
||||||
self._id = self._camera.mac_address
|
self._has_battery = camera.supports_feature("battery_level")
|
||||||
self._has_battery = self._camera.supports_feature("battery_level")
|
|
||||||
self._ffmpeg = ffmpeg
|
self._ffmpeg = ffmpeg
|
||||||
self._listeners = []
|
self._listeners = []
|
||||||
|
self._attr_unique_id = camera.mac_address
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
identifiers={(LOGI_CIRCLE_DOMAIN, camera.id)},
|
||||||
|
manufacturer=DEVICE_BRAND,
|
||||||
|
model=camera.model_name,
|
||||||
|
name=camera.name,
|
||||||
|
sw_version=camera.firmware,
|
||||||
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Connect camera methods to signals."""
|
"""Connect camera methods to signals."""
|
||||||
@ -117,22 +124,6 @@ class LogiCam(Camera):
|
|||||||
for detach in self._listeners:
|
for detach in self._listeners:
|
||||||
detach()
|
detach()
|
||||||
|
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return a unique ID."""
|
|
||||||
return self._id
|
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self) -> DeviceInfo:
|
|
||||||
"""Return information about the device."""
|
|
||||||
return DeviceInfo(
|
|
||||||
identifiers={(LOGI_CIRCLE_DOMAIN, self._camera.id)},
|
|
||||||
manufacturer=DEVICE_BRAND,
|
|
||||||
model=self._camera.model_name,
|
|
||||||
name=self._camera.name,
|
|
||||||
sw_version=self._camera.firmware,
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
|
@ -106,16 +106,12 @@ class LogiSensor(SensorEntity):
|
|||||||
self._attr_unique_id = f"{camera.mac_address}-{description.key}"
|
self._attr_unique_id = f"{camera.mac_address}-{description.key}"
|
||||||
self._activity: dict[Any, Any] = {}
|
self._activity: dict[Any, Any] = {}
|
||||||
self._tz = time_zone
|
self._tz = time_zone
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
@property
|
identifiers={(LOGI_CIRCLE_DOMAIN, camera.id)},
|
||||||
def device_info(self) -> DeviceInfo:
|
|
||||||
"""Return information about the device."""
|
|
||||||
return DeviceInfo(
|
|
||||||
identifiers={(LOGI_CIRCLE_DOMAIN, self._camera.id)},
|
|
||||||
manufacturer=DEVICE_BRAND,
|
manufacturer=DEVICE_BRAND,
|
||||||
model=self._camera.model_name,
|
model=camera.model_name,
|
||||||
name=self._camera.name,
|
name=camera.name,
|
||||||
sw_version=self._camera.firmware,
|
sw_version=camera.firmware,
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user