Modify requirements for CameraStreamController in Alexa (#34470)

This commit is contained in:
ochlocracy 2020-04-21 13:46:56 -04:00 committed by Paulus Schoutsen
parent 59686274d7
commit 16e1b3772c
2 changed files with 6 additions and 7 deletions

View file

@ -791,19 +791,18 @@ class CameraCapabilities(AlexaEntity):
yield Alexa(self.hass)
def _check_requirements(self):
"""Check the hass URL for HTTPS scheme and port 443."""
"""Check the hass URL for HTTPS scheme."""
if "stream" not in self.hass.config.components:
_LOGGER.error(
_LOGGER.debug(
"%s requires stream component for AlexaCameraStreamController",
self.entity_id,
)
return False
url = urlparse(network.async_get_external_url(self.hass))
if url.scheme != "https" or (url.port is not None and url.port != 443):
_LOGGER.error(
"%s requires HTTPS support on port 443 for AlexaCameraStreamController",
self.entity_id,
if url.scheme != "https":
_LOGGER.debug(
"%s requires HTTPS for AlexaCameraStreamController", self.entity_id
)
return False

View file

@ -3806,9 +3806,9 @@ async def test_camera_discovery_without_stream(hass):
"url,result",
[
("http://nohttpswrongport.org:8123", 2),
("https://httpswrongport.org:8123", 2),
("http://nohttpsport443.org:443", 2),
("tls://nohttpsport443.org:443", 2),
("https://httpsnnonstandport.org:8123", 3),
("https://correctschemaandport.org:443", 3),
("https://correctschemaandport.org", 3),
],