Skip to content

Instantly share code, notes, and snippets.

@cogneato
Last active June 3, 2021 11:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cogneato/fbd7f9f5f7e5f162a1fae7cc1cc9a5b1 to your computer and use it in GitHub Desktop.
Save cogneato/fbd7f9f5f7e5f162a1fae7cc1cc9a5b1 to your computer and use it in GitHub Desktop.

Easiest method for Wifi on HassOS

If you are having problems creating a working network keyfile or importing the keyfile, this alternate method might work for you. It could also be that you have some other problem so this is not a "cure-all" for your wifi/network issues.

NOTE: This method assumes you already have a working ethernet connection

This page appears long but that's because I'm trying to cover all the small details. The process is very simple, really and doesn't take much time at all.

The short version:

  1. Install the SSH & Web Terminal Addon from the Community Repo (thanks, @frenck!)
  2. Turn off protected mode for the addon.
  3. Add the "networkmanager" package to the addon config.
  4. Open a connection to it and use nmcli to connect to your SSID.

Install the SSH & Web Terminal Addon from the Community Repo

This addon allows more customization than the official ssh server addon and you will be making use of the "packages" option.

Set "Protection Mode" to off

Protection

Create a good username and password or use a public and private key pair.

If you choose to use a user and password, save some time by coming up with something unique as the addon will check against the haveibeenpwned database and if your password choice exists there you'll have to come up with a new one.

Make sure you also fill out the user and password options for the web terminal.

The ssl option is set to "true" by default. Change it to "false" if you aren't using ssl.

Enter "networkmanager" in the packages section of the addon config.

config

Save and start the addon. It can take a minute to get going. Watch the logs below for any errors.

When you see this you are good to connect.

INFO: Starting the SSH daemon
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
INFO: Starting the ttyd daemon

Connect with your prefered ssh client or return to Open Web UI at the top of the page.

If the tab that opens does not connect, edit the url to http:// instead of https://

Connect to wifi using nmcli instead of making and importing your own profile

First check that your wifi is enabled

nmcli radio

radio

Now scan and list available wifi access

nmcli device wifi rescan

nmcli device wifi

wifi list

Connect to wifi

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...."

Check your current connections

nmcli con show

con show

You should be seeing at least two profiles and hopefully they are both green.

If you are seeing some profiles you'd like to get rid of you can remove them using

nmcli connection delete CONNECTION_NAME

delete con

These may have two separate ip addresses on your network: one for ethernet, one for wifi. You can check the ip addresses using

ip addr show

Now connect to http(s)://your_wifi_ip:8123 in your browser.

That's it! Now you have two connections which are properly formatted. You can edit them interactively with further use of nmcli (static ip, for example).

For setting static ip on either of your connections, skip to the nmcli commands at this link below. You can ignore the part about logging into HassOS because you are using the addon in unprotected mode instead.

As noted, you will need to reboot after making these changes.

https://github.com/home-assistant/hassos/blob/dev/Documentation/network.md#using-nmcli-to-set-a-static-ipv4-address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment