Setup Wifi Configuration

Hello,
I want to connect hassio on a raspi3 to wifi instead of lan.

I followed this Network Configuration.

After putting in the usb stuck and restarting, a file: “/config/network/my-network” was created on my raspi.

[connection]
id=my-network
uuid=XXXXXXX
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid= "XXXXXX"
# Uncomment below if your SSID is not broadcasted
#hidden=true

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk= "XXXXXXXXX"

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

But if I disconnect the ethernet cable I dont get a wifi connection. I also tried booting hassio without a etthernet connection.

I’d appreciate it if someone took the time to help me.

thanks

I don’t have the clue for you, but it seems that your route still going through the ethernet. Perhaps you might check whether another file exists in that folder.

Hey, thanks for the reply.

No, the folder /config/network contains only one file: my-network.

I’m struggling to get something started too. I re-flashed the image twice and I wrote on a pendrive the configuration. It gets started and connected to my router, but it fails to proceed to load the system.
I found that we can write the config on the same SD partition, formatted FAT32 and with the same directions. Perhaps that is my difficulty to go further.

Ah! I noted that you haven’t use the ID like that link. So there should be an
uuid=72111c67-4a5d-4d5c-925e-f8ee26efb3c3. But I can’t figure what is related to.

Use Fixed IP address. Just change ethernet to wifi.

Thank you for you answer Vlad!

I’m not sure if I understand correct should my file look like this?

[connection]
id=my-network
uuid=d55162b4-6152-4310-9312-8f4c54d86afa
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid= "XXXXXX"

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk= "XXXXXXXXX"

[ipv4]
address1=xxx.xxx.x.xxx/24,192.168.1.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual

[ipv6]
addr-gen-mode=stable-privacy
method=auto

For the IP-adress should I just use the one Hassio uses right now?
And do I need to import this via USB-Stick or can I just edit the file “/config/network/my-network”?

I know this is an old topic, but the WIFI boot config is really finicky and the fact that there was no resolution posted here almost made me give up, so I am reviving this thread. I was struggling with exactly the same issue. I was following this guide but for some reason, WiFi never came up.

Good news is, the following config which can be found all over the web actually does work:

[connection]
id=my-network
uuid=<UUID, no trailing spaces>
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid=<Your SSID to connect to - spaces allowed, but don not add trailing spaces>
# Uncomment below if your SSID is not broadcasted
#hidden=true

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk=<Your WiFi password - spaces allowed, but do not add trailing spaces>

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

If it doesn’t work don’t give up:

  • The config works. I have just tested it on a new install of HASSOS using RPI Imager. And it works for wpa2 out-of-the-box as well, no changes needed. I know, it only says “wpa-psk” but my network is WPA2 only, that’s how i configured it in OpenWRT.
  • The “type=802-11-wireless” and the “[802-11-wireless]” and “[802-11-wireless-security]” config style worked for me …
  • … as did the “type=wifi” parameter and “[wifi]” and “[wireless-security]” styke, which some people recommend. The latter is what nmcli generates on my machine.
  • The filename is irrelevant (tested only ASCII characters)
  • Whatever you enter behind id= is irrelevant (at least that’s what I think)
  • The last character of the file does not need to be a newline (LF) but it is POSIX standard and thus good practice.
  • Autoconfig / DHCP workds fine. No need to assign a static IP.

Now here is the rub. I assume most people’s problems are associated with the following peculiarities:

  • HASS was not happy with my windows line endings (i.e. it doesn’t convert Windows line-endings on boot when copying the file). If you have initially created a windows text file, Notepad++ can do these conversions for you by selecting EDIT>EOL Conversion>UNIX (LF).
  • Configuration parameters may not have trailing spaces. I pasted the template and values from the web and I didn’t pay attention. If you are on windows, you can display special characters in Notepad++ with View>Show Symbol>Show All Characters, which will show you where you have issues.

Troubleshooting:

  • You can immediately see if your HASSOS connects to the network when you plug a screen into the device.
  • If you want to find out why your file is not loading, you can always read the log of NetworkManager. Attach a mouse and keyboard and type in “login” at the CLI promt after boot. Afterwards, you have a basic shell with root privileges and you can use # journalctl -u NetworkManager.service to see what went wrong.
  • For example, look for “failed to load connection […]” if wifi doesn’t come up but the file was successfully copied.
  • On boot, the file is moved to /etc/NetworkManager/system-connections. Be aware, if you simply cat the file, you might not see the bad line endings. Use e.g. # vi /etc/NetworkManager/system-connections/my-connection to edit the file.
  • If your file gets read in correctly, it additional parameters are added after the first boot. If it doesn’t get read in correctly the file gets copied without modification. If the file is not there, check that you have placed it into the right folders on the SD card.
  • EDIT: if it still doesn’t work, check for hardware limitations like the inability to use certain WIFI channels or the inability to use WPA3 when your access point is configured to work only with WPA3. (Thanks @Nickduino for pointing this out below).
1 Like

Thanks for the writeup @AndBu, I’m sure it helped many people. I personally learnt a lot thanks to it!
It still didn’t work for me (after many attempts), though, even after having fetched an old monitor and keyboard to debug it, I could not set it up.

So I caved in and used an Ethernet cable (connected to a WiFi extender, since I can’t properly wire it where it’s at for testing) and Home Assistant started to work. I could finally use the GUI (BTW, using the terminal without a US keyboard is a nightmare) to setup my WiFi connection !

But HA could not see my network ! It could see the neighbors’ but not mine even though the RSSI was fantastic according to my WiFi analyser. The reason? I was using channel 13 and my Raspberry Pi 3B+ does not work with channels above 10. I switched to another one and boom, HA is working wirelessly. But this made me lose so much time I think you could consider adding a line about it (like “if it still doesn’t work, check your hardware doesn’t have a limitation like the inability to work with some WiFi channels or to use WPA3 if your access point is configured to work with these”).

1 Like