Skip to content

Commit 0eefa43

Browse files
committed
Ignore when there is no software version info on DCL
Don't raise an exception when there is no software version info on DCL. It is perfectly fine to operate such nodes. An informational message is good enough for this case.
1 parent 3332de3 commit 0eefa43

File tree

1 file changed

+8
-1
lines changed
  • matter_server/server/ota

1 file changed

+8
-1
lines changed

matter_server/server/ota/dcl.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Handle OTA software version endpoints of the DCL."""
22

3+
from http import HTTPStatus
34
import logging
45
from typing import Any, cast
56

@@ -13,11 +14,14 @@
1314

1415
async def _get_software_versions(vid: int, pid: int) -> Any:
1516
"""Check DCL if there are updates available for a particular node."""
16-
async with ClientSession(raise_for_status=True) as http_session:
17+
async with ClientSession(raise_for_status=False) as http_session:
1718
# fetch the paa certificates list
1819
async with http_session.get(
1920
f"{DCL_PRODUCTION_URL}/dcl/model/versions/{vid}/{pid}"
2021
) as response:
22+
if response.status == HTTPStatus.NOT_FOUND:
23+
return None
24+
response.raise_for_status()
2125
return await response.json()
2226

2327

@@ -85,6 +89,9 @@ async def check_for_update(
8589

8690
# Get all versions and check each one of them.
8791
versions = await _get_software_versions(vid, pid)
92+
if versions is None:
93+
LOGGER.info("There is no update information for this device on the DCL.")
94+
return None
8895

8996
all_software_versions: list[int] = versions["modelVersions"]["softwareVersions"]
9097
newer_software_versions = [

0 commit comments

Comments
 (0)