Skip to content

Commit 4b41f21

Browse files
committed
fix: Ignore unsupported command responses (cmd:Unknown, code:1)
Previously, responses with code:1 and cmd:Unknown would be processed and could cause issues. Now these responses are properly ignored with a debug log, matching the Python implementation behavior. This prevents error spam when polling for state on cameras that don't support certain features. Closes #1
1 parent 691b12b commit 4b41f21

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/api/host.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,12 @@ export class Host {
568568
if (item.code === 1 && item.cmd === "Login") {
569569
throw new CredentialsInvalidError(`Invalid credentials: ${item.detail || ""}`);
570570
}
571+
// Ignore responses for unsupported commands (cmd: "Unknown", code: 1)
572+
// This prevents error spam when polling for state on cameras that don't support certain features
573+
if (item.code === 1 && item.cmd === "Unknown") {
574+
debugLog(`Ignoring unsupported command response: ${JSON.stringify(item)}`);
575+
return [];
576+
}
571577
// For other commands, return the error response and let caller handle it
572578
// Don't throw here - the caller will check the code
573579
}

0 commit comments

Comments
 (0)