Skip to content

Fix 403 error when fetching spa data (wrong spa ID resolved from profile) - #2

Open
fsoderblom wants to merge 1 commit into
Lallassu:mainfrom
fsoderblom:fix-spa-id-403
Open

Fix 403 error when fetching spa data (wrong spa ID resolved from profile)#2
fsoderblom wants to merge 1 commit into
Lallassu:mainfrom
fsoderblom:fix-spa-id-403

Conversation

@fsoderblom

Copy link
Copy Markdown

Problem

Integration setup kept failing with:
403 Client Error: Forbidden for url: https://iot.controlmyspa.com/spas/<id>

Login and profile fetch succeeded, but fetching the actual spa data was
rejected with 403 (as opposed to 401, which is what invalid/missing auth
returns).

Root cause

get_profile() (introduced in 272786e) sets self.spa_id from the
user profile's data.user._id. That field is the account's own user ID,
not the spa ID — a different ID namespace. Requesting spa data with the
wrong ID returns 403 Forbidden even with valid credentials.

The existing fallback in fetch_spa_data() only handles the case where
the (wrong) ID returns an empty 200 response — it never triggers on 403,
so setup gets stuck retrying indefinitely.

Fix

get_profile() now resolves the spa ID from the /spas list (as the
integration did before 272786e), matching the ID namespace actually
used by the spa data endpoint.

Test plan

  • Reproduced the 403 on a real account/spa
  • Applied the fix, restarted Home Assistant
  • Integration now sets up successfully and exposes all sensor entities

get_profile() was using the account's own user "_id" as the spa ID,
which is a different ID namespace. Fetching spa data with that ID
returns 403 Forbidden even with valid credentials. Resolve the actual
spa ID from the /spas list instead, as done prior to 272786e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant