core: 404 on SleepIQ Bed Enumeration

The problem

Issue: Receiving a 404 page when trying to enumerate beds after a successful configuration flow.

What version of Home Assistant Core has the issue?

core-2023.8.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

SleepIQ

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sleepiq

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:952 
First occurred: August 6, 2023 at 8:30:39 PM (1 occurrences) 
Last logged: August 7, 2023 at 5:57:08 PM

Config entry '[login_id_redacted]' for sleepiq integration not ready yet: API call error response 404 <bound method ClientResponse.text of <ClientResponse(https://prod-api.sleepiq.sleepnumber.com/rest/sn/v1/accounts/-[account_redacted]/beds/-[bed_id_redacted]/bamkey?_k=js5ec90RKEXqt) [404 Not Found]> <CIMultiDictProxy('Date': 'Tue, 08 Aug 2023 01:02:01 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': 'AWSALB=[cookie_redacted]; Expires=Tue, 15 Aug 2023 01:02:01 GMT; Path=/', 'Set-Cookie': 'AWSALBCORS=[cookie_redacted]; Expires=Tue, 15 Aug 2023 01:02:01 GMT; Path=/; SameSite=None; Secure', 'Server': 'Apache-Coyote/1.1', 'Strict-Transport-Security': 'max-age=2628000', 'Cache-Control': 'no-cache, no-store', 'X-Frame-Options': 'Deny', 'Content-Security-Policy': "frame-ancestors 'none'")> >; Retrying in background

Additional information

Issue was first noticed on 8/6/2023

On 8/5, the account in question changed from 1 bed to 3

The original bed was still working the night of 8/5 after the ordered beds were showing as ordered in the official app

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 27 (6 by maintainers)

Most upvoted comments

Ok, I made the change in the asyncsleepiq lib

So my guess what is happening here:

  1. SleepNumber adds a bed to an account immediately when it is purchased
  2. The new bed is missing the normal configuration and information options
  3. When querying the API, the bed shows up valid for the first check, but then the later expected checks for the foundation info and others come back with 404
  4. The Init phase fails because an error accessing the API usually means the API is broken for all beds

As a solution, we can just catch the error when setting up the beds and skip that bed when initializing the API. I believe that would solve the problem