Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix methods dict keyerror #153

Merged
merged 2 commits into from
Mar 25, 2024
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
2 changes: 1 addition & 1 deletion songpal/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async def get_supported_methods(self, *, default_latest: bool = False):
_LOGGER.debug("> %s", api)
if api.latest_supported_version is None:
_LOGGER.debug(
"No supported version for %s.%s, using %s",
"No supported version specified for %s.%s, using %s",
service.name,
api.name,
api.version,
Expand Down
9 changes: 8 additions & 1 deletion songpal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,14 @@ async def from_payload(cls, payload, endpoint, idgen, debug, force_protocol=None
# Populate supported versions for method if available
for api in payload["apis"]:
for v in api["versions"]:
methods[api["name"]].add_supported_version(v["version"])
if api["name"] in methods:
methods[api["name"]].add_supported_version(v["version"])
else:
_LOGGER.info(
"No matching method %s for supported version %s.",
api["name"],
v["version"],
)

service.methods = methods

Expand Down
Loading