1 """The motionEye integration."""
3 from __future__
import annotations
5 from types
import MappingProxyType
8 from motioneye_client.client
import MotionEyeClient
9 from motioneye_client.const
import KEY_ID
15 DataUpdateCoordinator,
18 from .
import get_motioneye_device_identifier
22 config_entry_id: str, camera_id: int, entity_type: str
24 """Get the unique_id for a motionEye entity."""
25 return f
"{config_entry_id}_{camera_id}_{entity_type}"
29 """Base class for motionEye entities."""
31 _attr_has_entity_name =
True
37 camera: dict[str, Any],
38 client: MotionEyeClient,
39 coordinator: DataUpdateCoordinator,
40 options: MappingProxyType[str, Any],
41 entity_description: EntityDescription |
None =
None,
43 """Initialize a motionEye entity."""
54 self._camera: dict[str, Any] |
None = camera
56 if entity_description
is not None:
62 """Return a unique id for this instance."""
67 """Return the device information."""
72 """Return if entity is available."""
73 return self._camera
is not None and super().available
None __init__(self, str config_entry_id, str type_name, dict[str, Any] camera, MotionEyeClient client, DataUpdateCoordinator coordinator, MappingProxyType[str, Any] options, EntityDescription|None entity_description=None)
DeviceInfo device_info(self)
str get_motioneye_entity_unique_id(str config_entry_id, int camera_id, str entity_type)
tuple[str, str] get_motioneye_device_identifier(str config_entry_id, int camera_id)