Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions custom_components/frigate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async_get_clientsession(hass),
entry.data.get(CONF_USERNAME),
entry.data.get(CONF_PASSWORD),
bool(entry.data.get("validate_ssl")),
)
coordinator = FrigateDataUpdateCoordinator(hass, client=client)
await coordinator.async_config_entry_first_refresh()
Expand Down
8 changes: 7 additions & 1 deletion custom_components/frigate/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ def __init__(
session: aiohttp.ClientSession,
username: str | None = None,
password: str | None = None,
validate_ssl: bool = True,
) -> None:
"""Construct API Client."""
self._host = host
self._session = session
self._username = username
self._password = password
self._token_data: dict[str, Any] = {}
self.validate_ssl = validate_ssl

async def async_get_version(self) -> str:
"""Get data from the API."""
Expand Down Expand Up @@ -347,7 +349,11 @@ async def api_wrapper(
func = getattr(self._session, method)
if func:
response = await func(
url, headers=headers, raise_for_status=True, json=data
url,
headers=headers,
raise_for_status=True,
json=data,
ssl=self.validate_ssl,
)
response.raise_for_status()
if is_login_request:
Expand Down
4 changes: 4 additions & 0 deletions custom_components/frigate/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ async def _handle_config_step(
session,
user_input.get(CONF_USERNAME),
user_input.get(CONF_PASSWORD),
bool(user_input.get("validate_ssl")),
)
await client.async_get_stats()
except FrigateApiClientError:
Expand Down Expand Up @@ -121,6 +122,9 @@ def _show_config_form(
vol.Required(
CONF_URL, default=user_input.get(CONF_URL, DEFAULT_HOST)
): str,
vol.Required(
"validate_ssl", default=user_input.get("validate_ssl", True)
): bool,
vol.Optional(
CONF_USERNAME, default=user_input.get(CONF_USERNAME, "")
): str,
Expand Down
1 change: 1 addition & 0 deletions custom_components/frigate/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "URL you use to access Frigate (ie. `http://frigate:5000/`)\n\nIf you are using HassOS with the addon, the URL should be `http://ccab4aaf-frigate:5000/`\n\nHome Assistant needs access to port 5000 (api) and 8554/8555 (rtsp, webrtc) for all features.\n\nThe integration will setup sensors, cameras, and media browser functionality.\n\nSensors:\n- Stats to monitor frigate performance\n- Object counts for all zones and cameras\n\nCameras:\n- Cameras for image of the last detected object for each camera\n- Camera entities with stream support\n\nMedia Browser:\n- Rich UI with thumbnails for browsing event clips\n- Rich UI for browsing 24/7 recordings by month, day, camera, time\n\nAPI:\n- Notification API with public facing endpoints for images in notifications",
"data": {
"url": "URL",
"validate_ssl": "Validate SSL",
"username": "Username (optional)",
"password": "Password (optional)"
}
Expand Down
1 change: 1 addition & 0 deletions custom_components/frigate/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "URL que vous utilisez pour accéder à Frigate (par exemple, `http://frigate:5000/`)\n\nSi vous utilisez HassOS avec l'addon, l'URL devrait être `http://ccab4aaf-frigate:5000/`\n\nHome Assistant a besoin d'accès au port 5000 (api) et 8554/8555 (rtsp, webrtc) pour toutes les fonctionnalités.\n\nL'intégration configurera des capteurs, des caméras et la fonctionnalité de navigateur multimédia.\n\nCapteurs :\n- Statistiques pour surveiller la performance de Frigate\n- Comptes d'objets pour toutes les zones et caméras\n\nCaméras :\n- Caméras pour l'image du dernier objet détecté pour chaque caméra\n- Entités de caméra avec support de flux\n\nNavigateur multimédia :\n- Interface riche avec miniatures pour parcourir les clips d'événements\n- Interface riche pour parcourir les enregistrements 24/7 par mois, jour, caméra, heure\n\nAPI :\n- API de notification avec des points de terminaison publics pour les images dans les notifications",
"data": {
"url": "URL",
"validate_ssl": "Valider SSL",
"username": "Nom d'utilisateur (facultatif)",
"password": "Mot de passe (facultatif)"
}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ async def test_user_success(hass: HomeAssistant) -> None:
CONF_URL: TEST_URL,
CONF_PASSWORD: "",
CONF_USERNAME: "",
"validate_ssl": True,
}
assert len(mock_setup_entry.mock_calls) == 1
assert mock_client.async_get_stats.called
Expand Down Expand Up @@ -90,6 +91,7 @@ async def test_user_success_with_auth(hass: HomeAssistant) -> None:
CONF_PASSWORD: TEST_PASSWORD,
CONF_URL: TEST_URL,
CONF_USERNAME: TEST_USERNAME,
"validate_ssl": True,
},
)
await hass.async_block_till_done()
Expand All @@ -100,6 +102,7 @@ async def test_user_success_with_auth(hass: HomeAssistant) -> None:
CONF_URL: TEST_URL,
CONF_PASSWORD: TEST_PASSWORD,
CONF_USERNAME: TEST_USERNAME,
"validate_ssl": True,
}
assert len(mock_setup_entry.mock_calls) == 1
assert mock_client.async_get_stats.called
Expand Down
Loading