Обновить custom_components/motion_recorder/sensor.py

This commit is contained in:
2026-07-05 13:33:27 +03:00
parent 792a185204
commit ea1b6e3916
+1 -4
View File
@@ -6,7 +6,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.device_registry import DeviceInfo
from .const import DOMAIN, CONF_CAMERA_ENTITY from .const import DOMAIN
async def async_setup_entry( async def async_setup_entry(
@@ -30,7 +30,6 @@ class MotionRecorderStatusSensor(CoordinatorEntity, SensorEntity):
self._attr_name = f"{entry.title} Статус" self._attr_name = f"{entry.title} Статус"
self._attr_translation_key = "motion_recorder_status" self._attr_translation_key = "motion_recorder_status"
# Добавляем информацию об устройстве
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, entry.entry_id)}, identifiers={(DOMAIN, entry.entry_id)},
name=entry.title, name=entry.title,
@@ -38,14 +37,12 @@ class MotionRecorderStatusSensor(CoordinatorEntity, SensorEntity):
model="Camera Recording Integration", model="Camera Recording Integration",
) )
# Icon mapping
self._icon_map = { self._icon_map = {
"idle": "mdi:sleep", "idle": "mdi:sleep",
"detecting": "mdi:motion-sensor", "detecting": "mdi:motion-sensor",
"recording": "mdi:record-rec", "recording": "mdi:record-rec",
"delaying": "mdi:timer-sand", "delaying": "mdi:timer-sand",
"finalizing": "mdi:file-check", "finalizing": "mdi:file-check",
"completed": "mdi:check-circle",
"error": "mdi:alert-circle", "error": "mdi:alert-circle",
"disabled": "mdi:video-off", "disabled": "mdi:video-off",
} }