HA Companion App - Alamofire.AFError 9

Hi All,

I started today with a fresh install of HA because I wanted some stuff to test on a clean install, but since I am unable to connect my mobile devices to home assistant using the official Companion app.

Everything is set up correctly on the HA site, and my DNS address is working fine in all browsers. On y phone (iphone 12) the app force closes once my credentials are entered. On an iPad I received the following error: Alamofire.AFError 9.

I tried reinstalling the app, without succes.

In my logfile I find two strange things:

Logger: homeassistant.components.webhook
Source: components/webhook/__init__.py:92
Integration: Webhook (documentation, issues)
First occurred: 15:58:52 (1 occurrences)
Last logged: 15:58:52

Received message for unregistered webhook 3966be4b1fa26488d8cf9263db2ed5a042575e2f14515c94707b495e4adf96fe from 192.168.1.1

I never used webhooks on my old installation, so a bit strange…

and

Logger: homeassistant.components.http.security_filter
Source: components/http/security_filter.py:48
Integration: HTTP (documentation, issues)
First occurred: 16:03:29 (1 occurrences)
Last logged: 16:03:29

Filtered a potential harmful request to: /cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh

Running on the latest software:

core-2021.11.2
supervisor-2021.10.8

Update 1: also just tried the latest test flight app, but same issue…

Update 2: I started all over again with a clean install. Only after changing the IP address of my hassio instance and clearing all hostname records on my unifi controller, I was able to get access to my HA instance remotely again.

It looks like it was an internal network error with a problem with the hostname. Still, this should be resolved. All I did before getting these issues was removing the old SSD from my nuc and put another one in with a clean install of HASSOS.

Sooo… getting same issue today as well. Everything was working fine before, decided to do a clean install cause my laptop sensors stopped updating in HA (happens when new HA monthly version is released for some reason). The local url just spins and nothing happens when I try the external url I get the “Alamofire.AFError 9” just like you.

I am not changing IP address of my Hassio as so much stuff in my house hangs on this, hope there is another solution.

1 Like

Are you using any kind of reverse proxy in front of your Home Assistant instance? Can you verify the internal_url for your Home Assistant instance is the right IP address of your server?

Hi Team,
The same problem here. Only on ios app. android works fine.
Does not matter if I use IP address, url, external or internal. Always shows the error.

It works fine from browser. I always use the same credentials.

1 Like

Yes it was the same here. Also no reverse proxy. Luckily I only had to update a few mqtt devices to the new server ip.

For me, changing the ip, looked like the only working solution.

I am on a ubiquiti unifi network if this info helps in any way.

1 Like

I have ubiquity access point and switch but different router.
I tried to login from internal and external network.
I switched off “local network” access and error changed to “connection error” before logging screen.

As the problem appears after logging attempt, so the logging page is provided by server, I think this is logging/credential/device recognition problem rather than network issue.

I’m not sure this is for all cases but for me there was default_config: entry missing in configuration file.

I have copied the file from another instance (older) of HA to new setup.

I realised that when android apps on another devices stopped working as well (they were working for some time which is strange).

I hope it will help somone…

That makes sense. The only request that I can see which would result in that error (as of the time of writing in ios-2021.11) is mobile_app/registrations which is the API call that creates the integration, which would result in a 404 if the mobile_app component is not loaded.

If there’s more confirmation that adding mobile_app: or default_config: to configuration.yaml resolves this, I can make a note to update the error message in this scenario to be more clearly stating that as the underlying problem.

1 Like

Amazing stuff. :+1:t2:. I did comment out the default config as I didn’t had this in my old configuration.yaml file and didn’t understood why it was there.

No clue why changing my ip did help in the end, but I’ll definetly correct my file later.

hello everyone

my solution was to deactivate the private WiFi address on the iPhone and iPad in the WiFi settings. Then it worked again.

2 Likes

Thanks @Tristram turning off the “Private Address” for the WiFi network did fix the issue.
For others (and future reference) instructions to turn private address off can be found here: Use private Wi-Fi addresses on iPhone, iPad, iPod touch, and Apple Watch - Apple Support

I can confirm that by adding mobile_app: to the configuration.yml worked for me!

1 Like

Have both mobile_app and default_config in my configuration.yaml; no joy.

Get the same 404 error (except in English).

Only happening on my Rpi3/4 Rasbian Buster devices; not on AMD64 or ARM64 machines.

I switched to specifying the device’s Wifi connection IP versus the LAN connection IP and it now works.

Adding mobile_app: solved it for me as well.
I had the Alamofire error, but also intermittently a Webhook.Error 3.
Clearer error message would be superb!

1 Like

I am having the same issue, however I get a “403: Forbidden” issue in addition to the AlamofireAFError9. iOS device on Unifi networking hardware. Using cellular instead of local wifi works just fine from the same iOS device to the same server.

403 is either you’ve got a reverse proxy that’s looking for authentication but failing to get it, or your IP address is banned due to invalid logins. There’s currently an ongoing issue where authentication will unexpectedly fail irregularly which may have caught up your IP address in it.

thanks! this should help me track it down.