Fix onvif error with non ptz cameras (#32783)

This commit is contained in:
Aidan Timson 2020-03-13 22:58:14 +00:00 committed by Paulus Schoutsen
parent 706607f1d2
commit b5c8b5b91f

View file

@ -375,7 +375,7 @@ class ONVIFHassCamera(Camera):
def setup_ptz(self): def setup_ptz(self):
"""Set up PTZ if available.""" """Set up PTZ if available."""
_LOGGER.debug("Setting up the ONVIF PTZ service") _LOGGER.debug("Setting up the ONVIF PTZ service")
if self._camera.get_service("ptz") is None: if self._camera.get_service("ptz", create=False) is None:
_LOGGER.debug("PTZ is not available") _LOGGER.debug("PTZ is not available")
else: else:
self._ptz_service = self._camera.create_ptz_service() self._ptz_service = self._camera.create_ptz_service()