Installation of Home Assistant on your FreeNAS

PERFECT!

Looks like it is all working? (So far so good)

Found that when I set up the share, it wouldn’t save the additional parameters set so I think it was that all this time as I can now modify all files!

Thank you so much for your help, I re-built the whole jail and HA - now to get back to working out how to automatically backup the config etc

Can I ask, I noticed on one of my builds I could add the samba addon via service homeassistant install samba does this mean that plugins work with this version of HA? I’ve always had dedicated hardware to HA and not really worked with having it running on Free/TrueNAS but after updating the hardware in my NAS I decided to get it running on this shared hardware.

Thanks again for your help - this was bugging me for some time!!

Dave

Edit: I realise that this command works only on the plugin, my question is can I install other addons with this version?

Please forgive if I misunderstand your question – I think you are confusing the terminology; I do not mean to be picky but I think it is important to have this part correct – Technically I understand “add-ons” to be specific to Home Assistant OS and Home Assistant Supervised - In such case, an “add-on” is a docker container providing an additional piece of software, that has been customized to be installed and managed from the Home Assistant UI. Add-ons are typically pre-configured to work nearly “out-of-the-box” with Home Assistant – Keep in mind, Docker is a Linux technology. Docker is simply not available on FreeBSD / FreeNAS / TrueNAS (unless you run Linux in a VM)

Instead we have jails, that provide the same concept as a docker container – On FreeNAS / TrueNAS we have “plugins”. - In this case a “plugin” is a jail providing an additional piece of software to expand the functionality of our NAS. A “plugin” can provide some basic controls from the NAS UI but these are mostly standalone jails. Regarding Home Assistant, the “plugin” is really nothing more than a scripted installation.

To answer what I think you’re asking – yes you can add the same additional software provided by “add-on”, but it will not have the convenience to “just work” with Home Assistant – Instead of an “add-on”, you could first look for a “plugin” that provides what software you need, then manually configure it’s integration with Home Assistant. If there is not a “plugin” available, you could manually create a separate jail for it.

In the case of two common “add-ons” samba and ssh – These services are already provided by the NAS host system. Although you could do so if you really wanted, I think it is unnecessary to install these a second time from inside of a jail.

– Hope that kind of helps.

And to answer your edited question regarding the plugin – This is not a command intended install samba.

service homeassistant install [SOMETHING]

That is equal to

su - $homeassistant_user
source $homeassistant_venv/bin/activate
pip install [SOMETHING]
deactivate

Some typical use cases

  • Upgrading pip
  • Upgrade Home Assistant
  • Install the next beta release
  • Install a specific Home Assistant version
service homeassistant install --upgrade pip
service homeassistant install --upgrade homeassistant
service homeassistant install --pre --upgrade homeassistant
service homeassistant install homeassistant==0.118.3
1 Like

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