Remove unnecessary assignment of Template.hass from generic camera (#123767)
This commit is contained in:
parent
86322973d0
commit
04570edb3f
1 changed files with 3 additions and 10 deletions
|
@ -28,10 +28,10 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers import config_validation as cv, template as template_helper
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.httpx_client import get_async_client
|
||||
from homeassistant.helpers.template import Template
|
||||
|
||||
from . import DOMAIN
|
||||
from .const import (
|
||||
|
@ -91,18 +91,11 @@ class GenericCamera(Camera):
|
|||
self._password = device_info.get(CONF_PASSWORD)
|
||||
self._name = device_info.get(CONF_NAME, title)
|
||||
self._still_image_url = device_info.get(CONF_STILL_IMAGE_URL)
|
||||
if (
|
||||
not isinstance(self._still_image_url, template_helper.Template)
|
||||
and self._still_image_url
|
||||
):
|
||||
self._still_image_url = cv.template(self._still_image_url)
|
||||
if self._still_image_url:
|
||||
self._still_image_url.hass = hass
|
||||
self._still_image_url = Template(self._still_image_url, hass)
|
||||
self._stream_source = device_info.get(CONF_STREAM_SOURCE)
|
||||
if self._stream_source:
|
||||
if not isinstance(self._stream_source, template_helper.Template):
|
||||
self._stream_source = cv.template(self._stream_source)
|
||||
self._stream_source.hass = hass
|
||||
self._stream_source = Template(self._stream_source, hass)
|
||||
self._limit_refetch = device_info[CONF_LIMIT_REFETCH_TO_URL_CHANGE]
|
||||
self._attr_frame_interval = 1 / device_info[CONF_FRAMERATE]
|
||||
if self._stream_source:
|
||||
|
|
Loading…
Add table
Reference in a new issue