Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion homeassistant/components/onvif/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import onvif
from onvif import ONVIFCamera, exceptions
import voluptuous as vol
from zeep.asyncio import AsyncTransport
from zeep.exceptions import Fault

from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
Expand All @@ -29,7 +30,10 @@
CONF_USERNAME,
)
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
from homeassistant.helpers.aiohttp_client import (
async_aiohttp_proxy_stream,
async_get_clientsession,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.service import async_extract_entity_ids
import homeassistant.util.dt as dt_util
Expand Down Expand Up @@ -146,12 +150,15 @@ def __init__(self, hass, config):
"Setting up the ONVIF camera device @ '%s:%s'", self._host, self._port
)

session = async_get_clientsession(hass)
transport = AsyncTransport(None, session=session)
self._camera = ONVIFCamera(
self._host,
self._port,
self._username,
self._password,
"{}/wsdl/".format(os.path.dirname(onvif.__file__)),
transport=transport,
)

async def async_initialize(self):
Expand Down