Home Assistant on a Pi Zero W in 30 minutes


#1

Saw the announcement yesterday for HASSbian 1.21 and got super excited?

Today we’ll flash the latest HASSbian to a Raspberry Pi Zero W. With an added bonus that besides for an USB cable for power, there’s no need for any cables!

What you’ll need:

  • a Raspberry Pi Zero W (an amazing tiny computer with built-in wifi)
  • a microSD card
  • some source of USB power
  • Wifi
  • a desktop or laptop

Let’s get to it!

First, download the HASSbian 1.21 image from here.

Unzip it.

Flash it to the microSD card. If you need a flash tool, try Etcher

When the flashing finishes, remove it and plug it back in. You should see a drive called “boot”.

Right in there, not in any folders, create a file called wpa_supplicant.conf.

The contents of the configuration file should be something like this: (You may have to adjust for your configuration, hints here )

network={
    ssid="YOUR_WIFI_NETWORK_NAME_HERE"
    psk="YOUR_WIFI_PASSWORD_HERE"
    key_mgmt=WPA-PSK
}

Next stick your SD card into the Raspberry Pi Zero W, and plug it in.

After about a minute, use your SSH client to connect to HASSbian (or hassbian.local from a Mac), with the username pi. The default password is raspberry.

It’s a good idea to change the password. To do so, use the passwd command.

Next, type the following two commands into the SSH console:

$ sudo systemctl enable install_homeassistant.service
$ sudo systemctl start install_homeassistant.service

Wait about 15-20 minutes and voilà you have your Home Assistant on your Raspberry Pi Zero W in 30 minutes.

To try it out, go to http://hassbian:8123 or http://hassbian.local:8123 if you’re using Mac.

For further details about HASSbian, take a look at the documentation.


This is a companion discussion topic for the original entry at https://home-assistant.io/blog/2017/05/01/home-assistant-on-raspberry-pi-zero-in-30-minutes/

#2

Just a minor point, but without it the Pi Zero won’t connect to your network. In the new file wpa_supplicant.conf a few extra lines are needed:

country=GB (or whichever your country is)
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="YOUR_WIFI_NETWORK_NAME_HERE"
psk="YOUR_WIFI_PASSWORD_HERE"
key_mgmt=WPA-PSK
}


#3

Hi,

After following your exact instructions to burn the image onto the 32G Micro SD card and created the wpa_supplicant.conf at the root level directory with my wifi network and password key. I can’t see it connect to my home wifi at all on my list of clients. I even included a couple parameter as suggested by other posters “papasierra” and modified the directory accordingly (i.e. at /) but still no luck. Could someone lead me in the right direction, please? THanks.

TV.


#4

Is you network hidden? I found that adding scan_ssid to the wpa_supplicant file seemed to help. For reference, here is an example wpa_supplicant.conf file:

country=XX
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid=“your_real_wifi_ssid”
scan_ssid=1
psk=“your_real_password”
key_mgmt=WPA-PSK
}

Just insert your country code in place of XX.

Hope that helps.


#5

One more thing to add. A Pi Zero W probably would not be my first choice to use to run Home Assistant. You might find yourself wanting something with a little more power later on.


#6

Gumbo,

Thank you for quick reply, my wifi is not hidden but I added the scan_ssid parameter per your suggestion anyway and the country code is US, still I get no luck at all. For now I just want to get a feel of it with Hassbian on my Pi Zero W but may upgrade to full size Rasberry Pi later.

TV.


#7

About the parameter “ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev”
I don’t see such a directory structure in the SD card “boot” volume at all but just “/overlay”. Unless they are file systems that get mount later while the system is boot up .

TV.


#8

That’s basically correct. There will be two partitions when you boot the card. There will be a fat partition and an ext4 partition. The fat partition is the one Windows can see. The ext4 will contain the files used by Linux including the wpa_supplicant file.