Installation of Home Assistant on your FreeNAS

Yea you’ve confirmed my suspicions on how this version would work. I already have a Node-Red and few other jails running which provide access to the services I require to run HA in the way I intend.

I was more wanting to have a play with App Daemon as it seems to play more prettier with my tablets I had eyed up for a future project but alas I digress in creating a better lovelace UI instead - that is (BIG Thanks to you) now I can access the dam files!

Thank you again, I do appreciate all the help you’ve provided to get my HA running and my knowledge to grow bigger!

Dave

1 Like

The writeup here was top notch. I was able to get homeassistant up and running quickly. Thanks!

I’m curious what the best practice is for editing the main configuration file is.

I noticed that with this install method there’s no “Hass.io” tab on the left (like in many of the videos i see at 'The Hook Up on youtube). Does this mean I should just jexec into the jail and edit ./usr/home/homeassistant/.homeassistant/configuration.yaml manually? Is there a config-check tool like the “Configurator” plugin thing has?

Thanks!!

FWIW, editing the file with vi and then checking it with:
/usr/local/share/homeassistant/bin/hass --script check_config -c /usr/home/homeassistant/.homeassistant/
seems to work.

If others have a ways to install the configurator thing, that’d still be nice!

The Hass-Configurator ( :wrench: File Editor ) can be installed in a separate virtualenv. Basically follow the same steps you used to install homeassistant, except install hass-configurator instead. Just use the existing $homeassistant_user. For start-up, you can either adapt the RC script from this guide or download mine - The configuration file is technically option but I strongly recommend in order to define persistent setting.

It’s all pretty straight forward, but even easier still, the community plugin includes an option install the configurator from the jails console menu :wink:

Hi!
I had a problem with HA homebridge integration - the zeroconf was not accessing network and then the bridge or devices were not responding in iOS home app.

2020-11-01 14:20:55 WARNING (SyncWorker_29) [zeroconf] Error sending through socket 7
Traceback (most recent call last):
File "/usr/local/share/homeassistant/lib/python3.8/site-packages/zeroconf/__init__.py", line 2914, in send
bytes_sent = s.sendto(packet, 0, (real_addr, port))
OSError: [Errno 50] Network is down

The solution was to make jail use VNET. I am using XigmaNAS instead of FreeNAS, but I think the same issue and result will happen on both systems - since they are just FreeBSD. If you can see the same issue in logs without VNET, then maybe consider adding info about VNET to the guide.
Thanks!

Upgrading Python

Home Assistant will support the latest two released minor Python versions. When the Python version is updated, you will need to install a supported version of Python and create a new virtualenv for Home Assistant, using the update version.

At this time Python 3.8 is being deprecated. Use these steps for upgrading to Python 3.9

From the jail’s console, install the updated Python requirements.

iocage console $JAIL_NAME
pkg install python39 py39-sqlite3

Stop the Home Assistant service, then remove the current venv. I suggest you also remove the cache directory, however this may be optional.

service homeassistant stop
rm -r /usr/local/share/homeassistant
rm -r /home/homeassistant/.cache

Create a new virtualenv and reinstall Home Assistant.

install -d -g homeassistant -m 775 -o homeassistant -- /usr/local/share/homeassistant
su - homeassistant
python3.9 -m venv /usr/local/share/homeassistant
source /usr/local/share/homeassistant/bin/activate
pip install --upgrade wheel
pip install homeassistant

Next, use the check_config script, to make Home Assistant finish installing any additional Python dependencies. (This will speed-up the initial start-up)

hass --script check_config

Deactivate the virtualenv and logout from the homeassistant user

deactivate && exit

Finally, you can start the Home Assistant service again

service homeassistant start

Is anyone else having issues with OpenSSL versioning?

I recently rebuilt my jail with Release 11.4-RELEASE-p4 and when I try to run the check_config script, I get the following error

Fatal error while loading config: You are linking against OpenSSL 1.0.2, which is no longer supported by the OpenSSL project. To use this version of cryptography you need to upgrade to a  newer version of OpenSSL. For this version only you can also set the environment variable CRYPTOGRAPHY_ALLOW_OPENSSL_102 to allow OpenSSL 1.0.2.

indeed, 1.0.2 is what was included in the base jail.

I determined how to install OpenSSL alongside of the already existing library and rebuild python to use that version; however when I re-run the command it still somehow links to the old version. Has anyone been able to solve this problem?

Here are the rough commands that I used to get python ssl.OPENSSL_VERSION to register 1.1.1 instead of 1.0.2

pkg install git
pkg install openssl
su - homeassistant
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc
OPENSSL_ROOT=/usr/local
export CONFIGURE_OPTS="CPPFLAGS=-I"$OPENSSL_ROOT"/include LDFLAGS=-L"$OPENSSL_ROOT"/lib"
exec "$SHELL"
pyenv install 3.8.6
pyenv global 3.8.6

I have the same OpenSSL issue with a fresh install in a freenas jail.

Welcome VlcaSh to the fourms!

I actually think I figured it out!
You will need to update to TrueNAS 12.X then upgrade the jail to 12.X or rebuild it to regain support.

I am working on a script that I should be able to share that can build a new jail very close to this guide.
I will hopefully be able to post it tonight or tomorrow.

Thanks Weldfire!

I did a quick google search on TrueNas, am I right in assuming I need to buy the TrueNas hardware to run it as supposed to FreeNas running on my home (made) server?

Not at all.
TrueNAS Core is the free version of what was FREENAS. All you need to do is update to TrueNAS, which I did months ago when it was still in beta, and install the community plug-in, which is very easy, or use this guide.

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?