Home assistant with GUI and touch screen on a raspberry pi

Hello. I would Like to install Home Assistant on a raspberry pi 3 with a GUI (web GUI is ok) and a touch screen on the raspberry itself. Which method is the most appropriate for installing that? I tried hassos, but it doesn’t seem to expose a GUI on the raspberry server.

Raspbian, install home assistant in python venv or run docker.

Beat me to it while I was looking up the link.

The RPI3B+ (64-bit, 4-core processor) has enough power and RAM to run Raspian Stretch which comes with the GUI enabled. The GUI is very user friendly, with a browser that you can use to display the HA front-end, a text-editor (much like Windows Notepad) to edit YAML files, and a file-manager that lets you browse the file system with ease. One thing I especially like is that the file manager lets you open a terminal window or execute a command within the displayed folder.

I have HA running on the platform described above, (and an SD-card that can read 170MB/s and write 90MB/s) It performs very well … far beyond my expectations. When I work on HA, I work with an old 17" monitor with a keyboard and mouse (left over from a defunct Windows desktop). This gives me enough surface area to simultaneously display the HA front-end, search the internet, edit YAML files, and display log files as I work on my system.

When I am done working , I can simply disconnect the monitor, keyboard, and mouse, and I attach a 7" touch display. This is enough to display the HA front-end.

2 Likes

Thank you for the answer.

  1. do I need to install raspbian lite and then add a desktop env with the package manager, so that I can run the GUI on raspberry?

  2. is there an image which contains raspbian and home assistant together?

No, you can install Stretch directly from an image. I took detailed notes when I did my install. You will find those below. Note that they include the download links I used and the reference sites that my installation steps came from. After the install, I made my own “combined image” so that I had a recovery point. I restored the image to a second SD-card and started running from there to make sure the recovery point was solid.

After this point, I installed NTFS because I wanted to be able to write log files to a hard disk and I had a 1TB USB drive with it’s own power supply laying around. Note that you don’t want to plug a USB powered hard-drive into the RPi. For kicks, I tested plugging a USB Powered 4TB Seagate Backup+ into a powered USB hub that was connected to the RPi, and that worked just fine, but you can’t plug it directly into the RPi because the Pi can’t provide the power it requires.

I also installed Samba to share data with my Windows syste, and I installed Mosquitto MQTT to communicate with some of the home-made devices that I have built and installed in my home.

I need to redact a few tokens and passwords before I share that info.


Home Assistant Build 

Step 1: Install/configure Raspbian

	a)	Download ZIP file "Raspbian Stretch with desktop and recommended software" from
			https://www.raspberrypi.org/downloads/raspbian/
			
	b)	Download "BalenaEtcher" from
			https://www.balena.io/etcher/
			
	c)	Run Etcher to image the SD card
			Just select the .zip file ... Etcher reads the image directly from the .zip
			
	d)	Insert SD in RPi and boot
	
	e)  Follow Raspbian prompts
			Set pi password
			Configure localization settings
			Configure WiFi
			Download/apply updates
			Reboot
	
	f)	Under Raspberry/Preferences/Raspberry Pi Configuration/
			Rename Host: /system/Hostname
			Enable SSH: /interfaces/SSH
			Reboot
			
-------------------------------------------------------------------------------------------------------------
			
Step 2: Install and Activate Home Assistant
			Reference: https://www.home-assistant.io/docs/installation/raspberry-pi/
	
	a)	Create user: "homeassistant"
			sudo useradd -rm homeassistant -G dialout,gpio
				
	b)	Create homeassistant installation directory
			cd /srv
			sudo mkdir homeassistant
			sudo chown homeassistant:homeassistant homeassistant
				
	c)	Create and change to a virtual environment for Home Assistant
			sudo -u homeassistant -H -s
			cd /srv/homeassistant
			python3 -m venv .
			source bin/activate

		<note: command prompt changes when virtual environment is activated>
		
	d)	Install a required Python package
			python3 -m pip install wheel
		
	e)	Install homeassistant
			pip3 install homeassistant
			
	f)	Activate homeassistant to complete the installation
			hass (takes 5 - 10 minutes ... not obvious when it completes, so be patient and allow extra time)

	g)  Configure Home Assistant to start automatically when RPi is booted
		1)	Run the command: ps -p 1 -o comm=
			If "systemd" is not displayed, 
				consult: https://www.home-assistant.io/docs/autostart/
		2)	Create the file "/etc/systemd/system/[email protected]"
				file contents below:
_____________________
[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target
_____________________

		3)	Reload systemd
				sudo systemctl --system daemon-reload

		4)	Enable the service
				sudo systemctl enable home-assistant@homeassistant
		
	h)	Update to the latest version of Home Assistant
			sudo -u homeassistant -H -s
			source /srv/homeassistant/bin/activate
			pip3 install --upgrade homeassistant
				
	i)  Activate the virtual environment
			sudo -u homeassistant -H -s
			source /srv/homeassistant/bin/activate
				

    j) Start Home assistant ???   --- if we take an image next, why start HA now?
			sudo systemctl start home-assistant@homeassistant


			
Make an image of the SD with Win32DiskImager ... this will take a while ... how long depends on the size and speed of the SD card 64GB SD card took about 80 minutes. 
-------------------------------------------------------------------------------------------------------------
IMAGE FILE: ha installed on raspbian.img
-------------------------------------------------------------------------------------------------------------
4 Likes

Sorry for the dumb question, as im new to this.

How do you do point F?

Activate homeassistant to complete the installation
hass (takes 5 - 10 minutes … not obvious when it completes, so be patient and allow extra time)

Great instructions, thanks a lot!

I know it’s been a while, but in case somebody is asking the same:

Just type hass in the console. The text in parenthesis is a comment.

As described, it will take a while. You’ll know you are finished (or almost) when you read in the console

INFO (MainThread) [homeassistant.core] Starting Home Assistant

Once you see that, you can try logging in, and wait a minute if it’s not connecting yet.

Hi @rwpalmer,

Thanks for the explanation. I have followed your instructions and installed home assistan, however I dont have any hass.io button in my main menu. Do you have any suggestion how to configure it?

My instructions install native OS and a native home assistant, so you configure per native OS and native HA instructions.

One can install hass.io’s version of HA. There are advantages and disadvantages.
To create hass.io, the developers perform the native OS and HA install for you. That makes the install easy, but both the OS and HA are configured to their needs and preferences … which may not align with those of the user.

I believe that installing a native OS is the best options because it builds linux skills that can be used for other things in the future. It also allows users to tune tine install to their needs and preferences. In my case, I had a high-end RPi with lots of RAM and disk … and I wanted a GUI that lets me run a browser.
Now I can edit files in one window and the HA front-end in another … while I search the web in yet another window.

In my view hass code obfuscates both the OS and HA. Users end up learning how to use HASS and not the underlying OS and HA code. I think that is unfortunate.

Thanks for the prompt reply @rwpalmer. I am wondering then if it is possible to install these add-ons, available in the hass.io menu, manually to native OS or where to find the documentation.

Hi everyone…just confirming is it possible to output hassOS to a 3.5 inch touch screen or should i rather use Raspbian?
(can Raspbian boot from SSD?)

nice guide I’ll tried this night but the HA settings page is very poor respect the native HA docker standard setup.
It misses Backup, add-ons and much more other stuffs.
is there a way to merge them?

thanks

Sorry, but I stepped away from the HA world in early 2020 because another project required all of my attention. I hope to get back to HA and IOT later this year.

Being a software architect, I’m used to stepping in and out of things, and I have procedures to make stepping in and out easier. One of those procedures is taking notes like you see in the guide that you reference. To be honest, I can’t remember what I included in the guide that I published. Normally, I document a “OS base build” as I install the OS and what I deem as “essential” baseline software. In some cases I also uninstall some OS “fluff”. I then blow everything away and go back through the process to test and revise the documentation where appropriate. When I am satisfied, I take a disk image labeled “OS Base Build:” so I can readily return to this point.

I’d then document adding the next layer of software, which will vary by project. In this case, 'm guessing that I added HA, MQTT, SSL, Samba, and a few other things. Again, I take a disk image laeled something like “HA Base Build” once I am satisfied with the software and the documentation.

I’d then take additional disk image snap-shots on a regular basis … and whenever I start heading into areas where I sense danger ahead.

I like disk imaging because I use multiple operating systems and using multiple backup software packages is a pain. I also load Samba on Linux so I can expose text files to my Windows desktop … where I have a big monitor, advanced text editing tools, and a browser. That allows me to quickly copy/paste information between my email, github, forums, and other sites. It also allows me to automatically maintain copies of the Linux / HA files on my Windows system.

Anyway, That’s probably no help. I wish I could do more.

1 Like