Image entity key error when camera is ignored in EZVIZ (#134343)

pull/135846/head
Renier Moorcroft 2025-01-17 13:27:44 +02:00 committed by GitHub
parent 13a7ad759c
commit 23e04ced9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -8,7 +8,7 @@ from pyezviz.exceptions import PyEzvizError
from pyezviz.utils import decrypt_image
from homeassistant.components.image import Image, ImageEntity, ImageEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import SOURCE_IGNORE, ConfigEntry
from homeassistant.const import CONF_PASSWORD
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -57,7 +57,9 @@ class EzvizLastMotion(EzvizEntity, ImageEntity):
)
camera = hass.config_entries.async_entry_for_domain_unique_id(DOMAIN, serial)
self.alarm_image_password = (
camera.data[CONF_PASSWORD] if camera is not None else None
camera.data[CONF_PASSWORD]
if camera and camera.source != SOURCE_IGNORE
else None
)
async def _async_load_image_from_url(self, url: str) -> Image | None: