mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Catch the right nest stream refresh exception error (#43189)
This commit is contained in:
parent
d7f1deeb00
commit
3e46c42307
@ -4,10 +4,10 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from aiohttp.client_exceptions import ClientError
|
||||||
from google_nest_sdm.camera_traits import CameraImageTrait, CameraLiveStreamTrait
|
from google_nest_sdm.camera_traits import CameraImageTrait, CameraLiveStreamTrait
|
||||||
from google_nest_sdm.device import Device
|
from google_nest_sdm.device import Device
|
||||||
from haffmpeg.tools import IMAGE_JPEG
|
from haffmpeg.tools import IMAGE_JPEG
|
||||||
import requests
|
|
||||||
|
|
||||||
from homeassistant.components.camera import SUPPORT_STREAM, Camera
|
from homeassistant.components.camera import SUPPORT_STREAM, Camera
|
||||||
from homeassistant.components.ffmpeg import async_get_image
|
from homeassistant.components.ffmpeg import async_get_image
|
||||||
@ -130,7 +130,7 @@ class NestCamera(Camera):
|
|||||||
self._stream_refresh_unsub = None
|
self._stream_refresh_unsub = None
|
||||||
try:
|
try:
|
||||||
self._stream = await self._stream.extend_rtsp_stream()
|
self._stream = await self._stream.extend_rtsp_stream()
|
||||||
except requests.HTTPError as err:
|
except ClientError as err:
|
||||||
_LOGGER.debug("Failed to extend stream: %s", err)
|
_LOGGER.debug("Failed to extend stream: %s", err)
|
||||||
# Next attempt to catch a url will get a new one
|
# Next attempt to catch a url will get a new one
|
||||||
self._stream = None
|
self._stream = None
|
||||||
|
@ -8,9 +8,9 @@ pubsub subscriber.
|
|||||||
import datetime
|
import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
from aiohttp.client_exceptions import ClientConnectionError
|
||||||
from google_nest_sdm.auth import AbstractAuth
|
from google_nest_sdm.auth import AbstractAuth
|
||||||
from google_nest_sdm.device import Device
|
from google_nest_sdm.device import Device
|
||||||
from requests import HTTPError
|
|
||||||
|
|
||||||
from homeassistant.components import camera
|
from homeassistant.components import camera
|
||||||
from homeassistant.components.camera import STATE_IDLE
|
from homeassistant.components.camera import STATE_IDLE
|
||||||
@ -315,8 +315,8 @@ async def test_refresh_expired_stream_failure(hass, aiohttp_client):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
# Extending the stream fails
|
# Extending the stream fails with arbitrary error
|
||||||
FakeResponse(error=HTTPError(response="Some Error")),
|
FakeResponse(error=ClientConnectionError()),
|
||||||
# Next attempt to get a stream fetches a new url
|
# Next attempt to get a stream fetches a new url
|
||||||
FakeResponse(
|
FakeResponse(
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user