Installation of Home Assistant on your FreeNAS

The community plugin on TrueNAS Core is a scripted installation of this guide with a few extra functions for convenience. Among other things, there’s a simple console menu for common functions like upgrading or restarting Home Assistant. It also has a function to rebuild the virtualenv with one command.

Hi troy,
Given your excellent work in creating the plugin, I’m not sure why this thread exists.
I’ve only used your plugin but keep reading about a Supervisor; is that worthwhile addition and, if so, can you point me in the way of installing it, please?

I’ve updated to TrueNas, installed HomeAssistant from the plugin menu and got it up and running! Thank you for the help!

2 Likes

Here’s my TL;DR take on it

The Supervisor comes with Home Assistant OS, it not something you can just add. It also requires Docker, which is not available on FreeBSD at this time. Home Assistant OS is designed to be an appliance and provides addons, which are simply other Docker containers, that have been pre-configured to work with Home Assistant, mostly “out-of-the-box”. It’s my understanding, the Supervisor is responsible for managing all the addons (Docker containers) and provides a means to configure them from within the Home Assistant UI.

Addons are similar to plugins on FreeNAS / TrueNAS Core. Basically, the purpose is to provide some additional piece of software. Unlike addons, plugins are typically a standalone service, meaning they not pre-configured to work with other plugins. – So do you need these addons? I don’t know… Do you need plugins? :man_shrugging: In either case, 99% percent of the time, the software can be installed manually and configured to work as needed.

If you’d like to consider running Home Assistant OS on TrueNAS CORE, see this guide. ( On the other hand, TrueNAS SCALE is based on Debian and will include Docker. )

I am newbie. I am trying to install the Home Assistant on my TrueNAS server. I manage to create the jail but not able to run the “python3.8 -m venv . source ./bin/activate”. Please help? I am stuck her and not sure how to create virtualenv or the syntax is wrong??

I am not able to start the service on Shell (not jail shell). failed precmd routine for homeassistant.
image

Why not just install the plugin and save yourself a lot of grief?
The plugin works out of the box, does everything you need, and is hassle free, thanks to the work of @troy.

1 Like

Hi @MrTeaIOT – Sorry your having trouble.

Installing the community plugin is the easiest solution. If you would like to continue with a manual installation…

The answer to your question about the failed pre-cmd routine. It looks like you have not created the homeassistant user group inside the jail. Are you trying to run Home Assistant as a different user or have you created the homeassistant user with a different group? There a solutions for all of these cases but I need to know what your trying to accomplish…

Again, if you just want to get Home Assistant installed, use the plugin… The most important thing with any installation method will be moving your configuration to a separate dataset. This will move your configuration safely outside the jail, allowing you to easily switch from the plugin to a manual jail at any time.

I did follow the instructions and created user and group under same 8123. I am not able to run using the plug-in because I tried it 2 times and my TrueNAS server GUI screen froze up and kill my internet network down. After I reboot the TrueNAS from console, the internet back online. I like to do plugin if it works. Any video instruction to do manually in the jail will be okay too?

A couple things here…

First you are not using the suggested name. That’s OK though, you can use any user name you want, however you will need to configure the Home Assistant service accordingly.

Before we get to that… From your screen shot, it looks as though you’ve created this user on TrueNAS. I realize this may be confusing, let me briefly try to explain.

For the Home Assistant service to run, you need to create the user inside the jail. This is not the same user you created on TrueNAS. Think of the jail as a separate computer and you have the same account on two computers.

  • The user is required to exist inside the jail.
  • The user on TrueNAS is optional. We only create this user for convenience

I’m not sure what would cause that. The plugin only provides the installation script. The delivery system for files and what you click on in the UI, is all handled by TrueNAS itself. I don’t control any part of the delivery system or how the jail is created from the manifest.


To solve the pre-cmd error using the hassio user name you have already created on TrueNAS,

Please try the following to also create the hassio user inside your Home Assistant jail.

iocage console $JAIL

## Create empty home directory and add user
install -d -g 8123 -o 8123 -m 775 -- /home/hassio
pw adduser -u 8123 -n hassio -d /home/hassio -w no -s /usr/local/bin/bash -G dialer

## Configure the Home Assistant service to use a different user or group
sysrc homeassistant_user=hassio
sysrc homeassistant_group=hassio

## Set a path to the configuration directory
sysrc homeassistant_config_dir=/home/hassio/homeassistant

I also have a guide in plugin wiki page for using the rc.d/homeassistant script to install Home Assistant in a manual jail. It is the middle ground between this guide and using the plugin

A post was split to a new topic: Connecting Node Red to Home Assistant

Now that HA has dropped support for python 3.7 is anyone else having issues upgrading? I just tried upgrading to 2021.3.2 but even after updating my Python env to 3.9, I can’t install cryptography. Looking on freshports, it looks like there isn’t a version for FreeBSD that supports python 3.8 or 3.9… Anyone find a work around?

What I did in the TrueNAS community plugin, was to add a pip.conf file (this stops pip from nagging about the available update, which should not be updated) and I started using requirements and constraints during pip install.

Basically download both files inside you HA jail, then you need to edit the first line of requirements.txt so it points to the constraints.txt file you also downloaded.

Then to install Home Assistant, activate a new virtualenv and use the following

pip install wheel
pip install homeassistant -r /path/to/requirements.txt

I can’t install cryptography . Looking on freshports, it looks like there isn’t a version for FreeBSD that supports python 3.8 or 3.9

FYI, I don’t install cryptography from fresh ports in the TN plugin, it gets compiled and installed automatically by Home Assistant, inside the virtualenv

Worth upgrading the instructions to Python v 3.9? I’m a little hesitant of just changing 38 to 39 without knowing its been tested … thanks

Python version

Support for the running Python version 3.8.8 is deprecated and will be removed in Home Assistant 2022.1. Please upgrade Python to 3.9.0 or higher.

You have no choice

Python 3.8 has been deprecated because Python 3.10 has been released. Support will be dropped in Home Assistant 2022.1.

I have the choice of waiting up to two months and making sure the instructions are up-to-date and tested before updating my core system. I also would like to help other users by asking the question publicly. I also have the choice of not being facetious.

The answer wasn’t facetious … but if you want to take it that way, have at it.

If your using the community plugin you can do this

iocage console $JAIL_NAME
# press 0 to exit menu
pkg install -y python39 py39-sqlite3
sysrc homeassistant_python=/usr/local/bin/python3.9
service homeassistant reinstall homeassistant

If you installed HA manually in a jail you can follow this post

I also updated the OP for Python 3.9

1 Like

Thanks Troy, very useful for confirmation. Have run this and it all works great.

1 Like

Me too. All works a treat.