Failing to setup Wifi: 500 internal error

Setup:

  • Brand new Raspberry Pi 4
  • Installed on SSD card using Rasperry Pi Imager
  • No extra hardware, addons or integrations installed except the Terminal.
  • Running Home Assistant 2023.6.1 Supervisor 2023.06.1 Operating System 10.2 Frontend 20230608.0

Problem
I’m trying to enable Wifi, but when I go into Settings/System/Network/WLAN0, select IPv4 ‘Automatic’ I get ‘Unknown error, see supervisor logs’.
In the logs I see:

* Failed to to call /network/interface/wlan0/update -
* Failed to to call /ingress/validate_session -
* /network/interface/wlan0/update return code 500
* /ingress/validate_session return code 401

When doing the same via the command line in the terminal:


➜  ~ ha network update wlan0 --ipv4-method=auto  --log-level debug
DEBU[0000] Adding homedir to searchpath                  homedir=/root
INFO[0000] No configfile found
DEBU[0000] Debug flags                                   apiToken=471b0c5e747254017a8153e7749eea0daf965059df763f5eb34d0a07e1ee636b4c91f2633f64fccdc5fe8bebbca999901af96e6a699444ce cfgFile= endpoint=supervisor logLevel=debug noProgress=false rawJSON=false
DEBU[0000] network update                                args="[wlan0]"
DEBU[0000] [GenerateURI]                                 base=supervisor command="interface/{interface}/update" section=network
DEBU[0000] [GenerateURI] Result                          uri="http://supervisor/network/interface/{interface}/update" url="http://supervisor/network/interface/%7Binterface%7D/update" url(string)="http://supervisor/network/interface/{interface}/update"
DEBU[0000] Request body                                  options="map[enabled:true ipv4:map[method:auto]]"
DEBU[0000] Response                                      body="500 Internal Server Error\n\nServer got itself in trouble" fields.time=11.352634ms headers="map[Content-Length:[55] Content-Type:[text/plain; charset=utf-8] Date:[Tue, 13 Jun 2023 19:35:51 GMT] Server:[Python/3.11 aiohttp/3.8.4]]" received-at="2023-06-13 21:35:51.390271997 +0200 CEST m=+0.017803176" request="&{POST http://supervisor/network/interface/wlan0/update HTTP/1.1 1 1 map[Accept:[application/json] Authorization:[Bearer 471b0c5e747254017a8153e7749eea0daf965059df763f5eb34d0a07e1ee636b4c91f2633f64fccdc5fe8bebbca999901af96e6a699444ce] Content-Type:[application/json] User-Agent:[go-resty/2.7.0 (https://github.com/go-resty/resty)]] 0x40001b6120 0x2a6340 41 [] false supervisor map[] map[] <nil> map[]   <nil> <nil> <nil> 0x4000022150}" status="500 Internal Server Error" statuscode=500
ERRO[0000] Unexpected server response
Unexpected server response

Any ideas what I can try out next?

Having exact the same issue with 2023.6.1. No solution so far for me

I wouldn’t recommend running HA (or any other server for that matter) over Wifi, or are you simply trying to enable the Wifi for some other purpose?

I’ve heard people say that before, but I’m not quite sure why. In this case I’m not running any mission critical automations, just capturing data, where I think wifi should be enough? Or is the RPI / HA Wifi implementation more flaky than your average computer?

Hi, just experience :slight_smile: YMMV

If you aren’t using it for automations etc. then I guess Wifi would be ok …

I have an RPI4 running on Wifi for Dump1090 and it times out quite often when HA queries it.

As others said, WIFI isn’t ideal, just because the connection to your HA isn’t as stable as with an ethernet connection. To make a long story short, if you run HA with WIFI, your response times can be long, eg your light doesn’t toggle or switch on, as fast as it could.

Back to the WIFI enabling: have you setup your WIFI in RaspberryPi imager? Before you can enable WIFI in HA, you need to set it up in RaspberryOS. WIFI is disabled be default in all Raspberrys, as you need to select a country first, before WIFI gets enabled (country regulations). You can do that before you write the image to card/SSD or, if you haven’t done that, you need to run raspi-config on your PI to set things up. :slight_smile:

Hope that helps!

I use Wifi as a second network connection to Connect HA to my Huawei inverter. The primary connection is wired.

Thanks for the hints! I tried creating a new image using RP imager and using the secret shortcut to enable Wifi, but no difference.

However! I did find a solution: Instead of just trying to enable IPv4 on WLAN, I instead chose WiFi / “Scan for accesspoints”. Now suddenly I saw the SSID of my Wifi and added the credentials and connected. And after this, I could set Automatic vs Static on IPv4!?

Great you got it working, that’s the most important part. :+1: And thanks for providing an update of your solution. :slight_smile:

Have fun playing around with HA tonight, it is such an adictive hobby :rofl: :rofl: