Skip to content

Stop encryption method detection when the router locks logins - #556

Open
manueltarouca wants to merge 1 commit into
iMicknl:mainfrom
manueltarouca:fix/stop-encryption-probe-on-login-retry
Open

manueltarouca wants to merge 1 commit into
iMicknl:mainfrom
manueltarouca:fix/stop-encryption-probe-on-login-retry

Conversation

@manueltarouca

@manueltarouca manueltarouca commented Oct 21, 2026 •

Copy link
Copy Markdown

Summary

get_encryption_method() keeps logging in after the router has locked logins.

Problem

XMO_LOGIN_RETRY_ERR (16777224) means "too many attempts, login locked".
The router's stock web UI handles it in js/scripts.js:
it sets loginRetryOvertime and shows the lock countdown (guiLockTime).

get_encryption_method() treats it as "wrong method" and tries the next one:

  • more failed logins while locked, which can extend the lock
  • returns None, which looks like "no supported method"

Reproduced with a local server that answers every login with XMO_LOGIN_RETRY_ERR:
3 login attempts, then None.

Fix

  • Stop on the first XMO_LOGIN_RETRY_ERR and raise LoginRetryErrorException.
  • XMO_AUTHENTICATION_ERR still moves on to the next method.
  • README: documents the new exception.

Behaviour change: callers get LoginRetryErrorException instead of None when the router
is locked. The ha-sagemcom-fast config flow already handles this exception (login_retry_error).

Tests

tests/unit/test_encryption_method.py, plus fixture login_retry_error.json:

  • login locked → raises after 1 attempt. Fails on main (3 attempts, returns None).
  • authentication error → next method is tried (existing behaviour kept).

XMO_LOGIN_RETRY_ERR is the router's "too many attempts, login locked"
response (the stock web UI shows a lock countdown for it). Detection treated
it like a wrong method and kept trying, adding failed logins to an active
lock and finally returning None as if no method were supported. It now
raises LoginRetryErrorException after the first locked response.
@github-actions github-actions Bot added the bug Something isn't working label Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant