Response status code was unacceptable: 400

Hello,

Have been using home assistant for a few years now and it has been great :slight_smile: That being said, I’ve been able to overcome several issues; however the current one has me a bit stumped.

I have had the ios app running on my iPhone XSM (after a icloud data migration from my old iPhone 7) with no issues outside of push notifications not working. As part of a test, I tried to do a few things, the first of which was removing the app from the new iPhone XSM and reinstalling and re-linking it to my home assistant instance.

Most of the process went through fine, including authentication and allowing notifications, location tracking etc. However, at the step where it says ‘Connecting to ____ Home’ (and all the green checks show connected, authenticated, integrated, etc) the app consistently fails with:

  • Error - Response status code was unacceptable: 400 *

Post first experiencing this error I have tried:

  • Restarted the iPhone XSM
  • Changed the iPhone’s name from iphone_username to iphone_xsm_username, then iphonexsm_username (which in theory should change the device ID)
  • Checked the Home Assistant base URL config for trailing slashes (no trailing slash in my conf)
  • Restarted the docker container with home assistant
  • All the items above have not provided any relief (aka still can’t get thru the enrollment process in the app)
  • Web UI via safari works just fine both on WAN and LAN
  • I’ve noticed that when it tries authenticating thru the app (regardless of me trying enrollment on LAN or WAN) the app tries to auth thru homeassistant.io NOT via my own domain (if I log in to my home assistant instance thru safari the local auth screen shows my URL instead of homeassistant.io)
  • Let’sEncrypt cert used, updated and managed automatically via proprietary automation (never had any cert errors or problems related to this).
  • Looking in the HA logs via web ui shows an error the very consistently correlates with the failed app enrollment (both timestamp, and times attempted):
## Log Details (ERROR)
Sat Jun 20 2020 14:03:37 GMT-0600 (Mountain Daylight Time)
Data does not match schema: extra keys not allowed @ data['device_id']

Also, not sure it matters but I’m running Home Assistant in Docker.

Any help or guidance around this would be immensely helpful as this error is a bit of a ‘production down’ at home, luckily its only my IOS app acting up, but if this starts impacting my wife I start to have real problems lol…

Hi, just a couple of easy checks to start with:

  1. Check the phone name doesn’t consist solely of emoji (I don’t think that’s the case here).
  2. Go through the setting up the app again. Follow these steps:
    a. In the App Configuration scroll to the bottom and tap reset.
    b. Force quit the app so it isn’t running in the background.
    c. From another browser or machine open Home Assistant and in Configuration>Integrations delete the appropriate Mobile App.
    d. Restart Home Assistant
    e. When Home Assistant has fully restarted, re open the app and try going through set up again.

Also looks like you might have a colon in your phone’s name

Ok I was on the wrong track there. I think you’re running a version of Home Assistant Core earlier than 0.104. Are you able to update

Hi Tom,

Thank you so much for taking the time to follow up.

I ended up figuring this out later that evening. It was a combination of several things causing the problem:

You are correct, doing a docker pull to update the container resolved the initial 400 issue. After I was able to login I still observed that push notifications were not working to my device.

It looks like the iCloud migration to the new phone kept the same phone name (device ID). As a result some further testing showed that there was a discrepancy between the device ID linked to the active phone and the mobile app service that is generated based on the device ID.

For example I leveraged an existing automation I had to push a short message to my phone and the log entry I received was similar to (paraphrased):

Unable to find service notify.iphone_xxxxx_3 (however the device is for the phone was device_tracker.iphone_xxxxx ). I tried to make the device ID on the phone match but that did not help even after re-registering the device.

Finally, what I ended up doing is removing the Home Assistant app entirely from the phone. Changing the phones name to something different from before (in this case iphone_xsm_xxxxx) And then relinking the app through the enrollment process. At this point notifications are working great with no problems on my phone. What is particularly interesting is that my wife’s phone, which went through a very similar process, did not have any of these issues. In fact, her notifications worked just fine right after the migration.

Thanks again for the follow up and suggestions!