Changing Connectivity to Wifi via cli

Had a situation where a lightning strike took out my ethernet controller on my NUC unit running HAOS. I connected a keyboard and monitor and confirmed HA was starting up, but “Network Manager Wait Online” failed to start. This made it impossible for me to get in via ssh or the web interface. I then used a Ubuntu usb drive to boot the unit and confirmed the ethernet was unresponsive. However, I found the wifi was working properly. After many hours of searching, I used this process to change the access to wifi, and now all is well (except for my preference of using ethernet).

  1. Connect monitor and keyboard
  2. at the ha> prompt, enter: login
    (literally type in the word login, this will get you to a # prompt)
  3. To assure wifi is functioning, enter: nmcli radio
  4. Scan available wifi access enter: nmcli device wifi rescan
  5. List available wifi access enter: nmcli device wifi
  6. Connect to your wifi (incude quotes) enter: nmcli device wifi connect “YOUR_SSID” password “YOUR_WIFI_PASSWORD”
    This will try to connect to your SSID and will generate a network profile for you if successfull.
    The output will be similar to
    "Device 'wlan0' successfully activated with...."
  7. Show connections enter: nmcli con show
    There may be two separate ip addresses on your network: one for ethernet, one for wifi.
  8. Check the ip addresses enter: ip addr show
    Now connect to http(s)://your_wifi_ip:8123 in your browser.

At this point, I went in to the GUI to Settings>System>Network and changed the wifi address to the static ip address my ethernet had been using. That way, my Duckdns and Alexa connections all worked again.

Hope this helps some of you…4 or 5 hours of scrounging and trying. Huge thanks to this post were much of this came from:

27 Likes

You are awesome! I had no ETH on site, only WiFi and this got me going 100%!

Thank you!

Thanks for this… had a very similar situation where I lost functionality of my ethernet interface… your answer was exactly what I needed!

Exactly what I was looking for. Thank you so much. It worked.

thank you so much for such clear and easy infos!

Thank you so much for writing up this guide. I had the exact same thing happening to me yesterday. It seems that the ethernet controller does not like to be struck by lightning.

Thanks for this post! I had just flashed the SD for a new Pi5 and did not see where to set the WiFi credentials in the Pi imager utility. I have very few places to connect physical Ethernet, and the modern mesh routers are very fast and reliable these days.
With a monitor and a keyboard and your instructions, this was very easy.

Multiple times my raspberry pi 4 ha was falling off my network, connected by ethernet. Occasionally it showed up, sometimes after restarting the firewall on my router, sometimes after restarting the router and sometimes after unplugging the ethernet cable and plugged it in again. But it always seems to fall off again at some point. Virgin Media hub 3.0.

ha network info
ha network eth0 disabled
ha network eth0 auto

Failed, mine appears to be end0 but as the second interface, the first was nameless.

So tried your nmcli instructions to turn on wifi, which didn’t appear to work, or at least my iOS companion app wouldn’t show it.

But wlan0 showed an ip, after ip addr show.

In Safari http://192.162.X.XXX:8123 said it couldn’t find a secure conection.

So I tried Fing and it showed up as Home (home assistant) on that IP address.

So back on the companion app, I clicked the cog where the debugging is when the rest of the screen/system won’t connect. Then in servers I saw that same Home Assistant instance, so I connected to it I was told there is already a phone with my name, so I added my phone again with today’s date as a new one. It let me login and all is fine.

My question is now, what can I do to try and stop this happening? The Virgin Media hub 3.0 admin section is not clear enough to me how I make a static IP for me to switch to that option.

Fing has a Wake on LAN option, do I risk pressing it?

Currently, I can’t view the console anymore as I pulled the power and plug it in again to try and get back to the original home assistant/screen hoping that my IP address would be shown there and not knowing how to scroll back up to it.

Sadly, I’m resigned to it not showing up again at some point this evening or when I try and use it tomorrow. Unless it doesn’t fall off this time because it’s connected by Wi-Fi.

Any help would be greatly appreciated!

Fix your network then. Things won’t get better by switching to wifi. Perhaps your DHCP is wonky. Perhaps your wiring is wonky.

i see this in not working on the new ha

What is not working, and what do you mean by “new HA”?

This thread was started a year ago, so I seriously doubt you’re seeing the same issue.

Can you please create your own thread and provide the details necessary to help you as per the pinned post?

does not matter if i try with my ip address i can not connect to home assistant. then i tried to set it up with cli screen and if you use wlan 0 it does not see it. the home assistant was update to the new version today. home assistant local does not work???

i just place a comment because i was reading the post and i have my own area under cjels

this literally saved me! Thank you!!

Worked for me! The commands really helped!

This post continues to save lives!

Thank you so much, your commands worked perfectly and saved me in a bind when I had to reconfigure my PC x64 install to use WIFI after doing a fresh HAOS install off a Ubuntu USB boot…
Much appreciated and I hope this post lives for eternity to continue assisting anyone who desperately needs to configure WiFi from the CLI :slight_smile:

Thank you! This was very useful.

But I am not out of the woods. My phone’s hotspot is my only internet connection, and to avoid blowing out the hotspot’s data cap, I need to also set the default TTL for the HAOS computer. Does anyone know how to set this from the cli?

Great help. Thank you. I used it on anew generic x86-64 installation on a laptop (Taichi 21) with no ethernet cable connection.