mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Add entity translations to Logi circle (#98797)
This commit is contained in:
parent
5ad97827cf
commit
08707b4abd
@ -53,7 +53,7 @@ async def async_setup_entry(
|
|||||||
devices = await hass.data[LOGI_CIRCLE_DOMAIN].cameras
|
devices = await hass.data[LOGI_CIRCLE_DOMAIN].cameras
|
||||||
ffmpeg = get_ffmpeg_manager(hass)
|
ffmpeg = get_ffmpeg_manager(hass)
|
||||||
|
|
||||||
cameras = [LogiCam(device, entry, ffmpeg) for device in devices]
|
cameras = [LogiCam(device, ffmpeg) for device in devices]
|
||||||
|
|
||||||
async_add_entities(cameras, True)
|
async_add_entities(cameras, True)
|
||||||
|
|
||||||
@ -64,12 +64,13 @@ class LogiCam(Camera):
|
|||||||
_attr_attribution = ATTRIBUTION
|
_attr_attribution = ATTRIBUTION
|
||||||
_attr_should_poll = True # Cameras default to False
|
_attr_should_poll = True # Cameras default to False
|
||||||
_attr_supported_features = CameraEntityFeature.ON_OFF
|
_attr_supported_features = CameraEntityFeature.ON_OFF
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, camera, device_info, ffmpeg):
|
def __init__(self, camera, ffmpeg):
|
||||||
"""Initialize Logi Circle camera."""
|
"""Initialize Logi Circle camera."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._camera = camera
|
self._camera = camera
|
||||||
self._name = self._camera.name
|
|
||||||
self._id = self._camera.mac_address
|
self._id = self._camera.mac_address
|
||||||
self._has_battery = self._camera.supports_feature("battery_level")
|
self._has_battery = self._camera.supports_feature("battery_level")
|
||||||
self._ffmpeg = ffmpeg
|
self._ffmpeg = ffmpeg
|
||||||
|
@ -37,28 +37,28 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="last_activity_time",
|
key="last_activity_time",
|
||||||
name="Last Activity",
|
translation_key="last_activity",
|
||||||
icon="mdi:history",
|
icon="mdi:history",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="recording",
|
key="recording",
|
||||||
name="Recording Mode",
|
translation_key="recording_mode",
|
||||||
icon="mdi:eye",
|
icon="mdi:eye",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="signal_strength_category",
|
key="signal_strength_category",
|
||||||
name="WiFi Signal Category",
|
translation_key="wifi_signal_category",
|
||||||
icon="mdi:wifi",
|
icon="mdi:wifi",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="signal_strength_percentage",
|
key="signal_strength_percentage",
|
||||||
name="WiFi Signal Strength",
|
translation_key="wifi_signal_strength",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
icon="mdi:wifi",
|
icon="mdi:wifi",
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="streaming",
|
key="streaming",
|
||||||
name="Streaming Mode",
|
translation_key="streaming_mode",
|
||||||
icon="mdi:camera",
|
icon="mdi:camera",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -97,13 +97,13 @@ class LogiSensor(SensorEntity):
|
|||||||
"""A sensor implementation for a Logi Circle camera."""
|
"""A sensor implementation for a Logi Circle camera."""
|
||||||
|
|
||||||
_attr_attribution = ATTRIBUTION
|
_attr_attribution = ATTRIBUTION
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(self, camera, time_zone, description: SensorEntityDescription) -> None:
|
def __init__(self, camera, time_zone, description: SensorEntityDescription) -> None:
|
||||||
"""Initialize a sensor for Logi Circle camera."""
|
"""Initialize a sensor for Logi Circle camera."""
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
self._camera = camera
|
self._camera = camera
|
||||||
self._attr_unique_id = f"{camera.mac_address}-{description.key}"
|
self._attr_unique_id = f"{camera.mac_address}-{description.key}"
|
||||||
self._attr_name = f"{camera.name} {description.name}"
|
|
||||||
self._activity: dict[Any, Any] = {}
|
self._activity: dict[Any, Any] = {}
|
||||||
self._tz = time_zone
|
self._tz = time_zone
|
||||||
|
|
||||||
|
@ -25,6 +25,25 @@
|
|||||||
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]"
|
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"entity": {
|
||||||
|
"sensor": {
|
||||||
|
"last_activity": {
|
||||||
|
"name": "Last activity"
|
||||||
|
},
|
||||||
|
"recording_mode": {
|
||||||
|
"name": "Recording mode"
|
||||||
|
},
|
||||||
|
"wifi_signal_category": {
|
||||||
|
"name": "Wi-Fi signal category"
|
||||||
|
},
|
||||||
|
"wifi_signal_strength": {
|
||||||
|
"name": "Wi-Fi signal strength"
|
||||||
|
},
|
||||||
|
"streaming_mode": {
|
||||||
|
"name": "Streaming mode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"services": {
|
"services": {
|
||||||
"set_config": {
|
"set_config": {
|
||||||
"name": "Set config",
|
"name": "Set config",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user