Home Assistant Core -- TrueNAS CORE Community Plugin

:stop_sign: This plugin has been removed from TrueNAS CORE

Home Assistant only supports Linux, OSX and Windows using WSL. FreeBSD is not supported. This plugin runs in a FreeBSD jail; therefore it is an unsupported installation method. As Home Assistant continues to grow and add new integrations, installation on FreeBSD no longer “just works” as reliably as it had for many years. With installation issues and sudden breaking changes becoming more frequent on FreeBSD, it was no longer feasible to continue maintaining this plugin.

To install HAOS in a VM (bhyve) on TrueNAS CORE (FreeBSD based) see this post by @Petrica

To install HAOS in a VM (KVM) on TrueNAS SCALE (Linux based) see this post by @troy


This plugin will create an iocage jail for Home Assistant Core

  • Home Assistant Core will be installed using a Python Virtualenv
  • Updates for Home Assistant are performed using the jail’s console
  • Also includes options to create separate Python Virtualenvs for the following
  • A separate directory for each virtualenv ( service ) will be created under /usr/local/share
  • The plugin’s provided services run as non-root user homeassistant with a UID of 8123
  • Separate configuration directories for each service are located in /home/homeassistant

This plugin provides these basic configuration files to help get started

A simple console menu is provided to help with basic tasks


Quick Start for Home Assistant Core on TrueNAS CORE

Installation - Community Plugin

:warning: No longer available. This plugin has been removed from TrueNAS CORE. With issues on FreeBSD becoming more frequent, it is no longer feasible to continue maintaining this plugin.

Initial Startup

Initial startup may take 5-10 minutes before the Home Assistant UI is reachable. It takes my TrueNAS about 10 minutes from the time I press install until I can log in for the first time. This time will vary depending on your setup and hardware. After the initial startup is complete, you can reach Home Assistant Core from the Plugins page by pressing MANAGE.

Installing optional services

Click Here

You can install HACS, or the optional services using the jail’s console menu. I tried to make this work easily from the browser. In TrueNAS, your Home Assistant Core plugin will show up under both, Plugins and Jails. It is still a jail after all. Enter the console from the Jails page by pressing SHELL.

Install the Configurator and AppDaemon

From the main menu, number 2 will be the Configurator. Use option 8 to install.

After the installation has finished, use the given link to open the Configurator in a new browser tab. We’re going to use it in the following steps to add the long-lived access token(s) to the configuration file(s). Leave the Configurator open and head back over to the Home Assistant tab in your browser.

We’re gonna create two tokens at this point. One for the Configurator and one AppDaemon. Hopefully, this is where the included configuration starts to make things easy. You can create your long-lived access token from your profile page.

Start by creating an access token for the Configurator and copy it to your clipboard.

Using the Configurator, add the token you just created to configurator/config.json. Paste your access token to the second line where indicated. Be sure to save the file!

Next, if you plan to install AppDaemon, you should also set that up. The example configuration included with AppDaemon is set up to share the Home Assistant secrets file to store its access token and location information. Go back to your Home Assistant profile page and create another long-live access token for AppDaemon. Use the Configurator to add the token to homeassistant/secrets.yaml. While you are there, you should also configure your correct location information as well. Make sure you save your changes!

We are done with the Configurator for now. You can close its browser tab and head back over to FreeNAS. From the Configurator service menu, select 3 to restart the Configurator.

After the Configurator restarts, press 1 to return to the main menu, then press 3 to enter the AppDaemon service menu. Use option 8 to install


Install HACS

There’s one more step before you restart Home Assistant. Installing HACS. There’s no service menu since HACS is a custom integration. This is just a little shortcut to download the latest HACS release and extract it to homeassistant/custom_components/hacs.

At the main console menu of the jail, type install hacs and press enter.


Now head into the Home Assistant Core service menu and select 3 to restart Home Assistant. Notice here that option 8 is check_config. The service will also check_config automatically before restarting Home Assistant. The first time check_config is used, you may see an additional package or two get installed. This is normal and only happens the first time.

After you restart Home Assistant, you should have links for File Editor and AppDaemon added to the side panel. These are simply iframes that have been enabled in homeassistant/packages/truenas_plugin

Finally, head to the integrations and finish adding HACS.

That’s it, Happy Automating!

Have Fun! :slightly_smiling_face:


For additional information about using this plugin visit the wiki

11 Likes

Troy, your work is amazing for the Freenas-User-Community. I’ve been following your installation guides since version 11 (your initial post from 2017) and you’ve been a great (!) help! Keep on this fabulous work, please! Thank you!

1 Like

Thanks for posting this. I had no trouble installing this on FreeNAS 11.2-U7. I have these jails installed per your 11.2 manual. I decided to follow this guide and fstab the hass folder to install data from 11.2. I was on Home Assistant 0.95 or 0.96. Everything upgraded and I had to fix some of my configuration due to Home Assistant changes.

Does anyone have an issue with the GUI in 0.105.4 refreshing every 30 seconds? This causes problems when I’m trying to use the Configurator or and GUI in HA. This bug causes you to lose any unsaved changes because it’s like you press refresh in your browser.

Looks like other system installs have similar issues: https://github.com/home-assistant/home-assistant-polymer/issues/4894

The strikeout issue was due to my http settings and HAProxy. I was able to fix this.

1 Like

Hi, I’m struggiling to get the appdaemon installed, after installation it cannot start. Where can I find any logs for what’s wrong? During installation I am receiving a message: ERROR: requests 2.22.0 has requirement idna<2.9,>=2.5, but you'll have idna 2.9which is incompatible. But even installing previous version of idna component (2.8) does not resolve this problem. Still getting the same error message during appdaemon installation and still the appdaemon service won’t start. Any hints?

I’ve installed it with pip3 install appdaemon in the /srv/appdaemon virtual environment and works ok, no problem with this dependency occured anymore. There was another one, i had to downgrade the astral component as per advise here
All good now but seems that the plugin requires some fixing

@adorobis

Thanks for reporting this.

I did know about the need to downgrade astral ( that already happens in the plugin script )

:thinking: This is weird… I mean, the plugin creates a new virtualenv for appdaemon. I just did a clean install of the plugin and installed appdaemon. Everything worked as expected and appdaemon started as soon as the install was finished. I’ll need to do some further investigating on this one…

1 Like

Hey thank you for years of great guidance! i have a homeassistant jail created with the old guide, how would i go about uprgrading/ migrating? what is the best way?

@lop3r Hello

It really depends on what you want to do and if you’re using a separate dataset for /home/hass

Having that separate dataset changes everything – I’ll assume as most people, you do not…

If you want to upgrade your existing jail, it is possible to do that and then copy some updated files into place. ( nothing by itself is difficult but this would likely be the most “advanced” )

If you want to migrate from your existing jail to the plugin, basically you just need to install the plugin and then copy your existing configuration into place. There are numerous ways to go about this depending on how comfortable you are on the command line.

The very first thing to consider is the name you want to use for the new plugin-jail. If you want to use the exact name of your existing jail, then you will need to destroy it before you can use the name again.

IMO, the easiest approach is to use a different name for the plugin. This way you can be sure the plugin is setup and working before you destroy the existing HA jail. Taking this approach I would basically do these steps.

  1. Install new plugin-jail, let Home Assistant finish installing and do initial onboarding
  2. Stop plugin-jail – Stop existing jail
  3. Use the FreeNAS console to rename (or remove) /home/hass in the new plugin-jail
  4. Use rsync from FreeNAS console to copy /home/hass from the existing jail to the new plugin
  5. Start plugin – Install Configurator – Install Appdaemon

If you want to use the exact name that’s already in use then you would basically

  1. Backup the existing /home/hass ( use a zip or tar ) and copy the backup to somewhere safe
  2. Export the the existing HA jail ( this makes a backup you can restore later if necessary )
  3. Destroy the existing HA jail
  4. Install new plugin-jail, let Home Assistant finish installing and do initial onboarding
  5. Stop Home Assistant service – restore config
  6. Start Home Assistant – Install Configurator – Install Appdaemon

Let me know, I can help with more detailed steps depending on what you want to do or if you are using a separate dataset for /home/hass

1 Like

Omg man youre amazing! Ill try when i get home!

Thank you for this! One question though (apologies in adv. if this is stupid) but when creating the USB controller to use the stick you mention
I used the FreeNAS console to create the script in my user’s home directory.

Where would I be installing this, in root or the homeassistant jail or where else?

Hi @slickbeerd

I used the FreeNAS console to create the script in my user’s home directory

On my FreeNAS, I have created myself a normal user and I also have created dataset that I use as a “home directory”. I store my zwave-ruleset in my “home directory” dataset

Really this can stored almost anywhere on your FreeNAS. I have found only these consideration.

  • It should be stored inside a dataset of your main zpool.
  • It should not be stored anywhere inside the iocage dataset. ( This means you can not use the Home Assistant directory )

So turns out i had created a separate dataset for it as per youre instructions. i had just forgotten about it caus it was so long ago. Made the upgrade a breeze.
Thanx man!

1 Like

Hi Troy, been using your guides for the last couple of years now, thanks for all your hard work and time spent making this simple!

If I were to use the new plugin method do I still have the ability to manually upgrade home assistant and the other tools as I would in a custom jail?

Absolutely! There is even a new menu when you login to the jail console to make it even easier. Basically everything from the manual jails still applies to the plugin. They both use the same script to install

Additionally the plugin itself can be updated using the FreeNAS webui. To be clear, when you update the plugin, it will only update the system files I have provided ( like the console menu or the rc.d/startup scripts ). The plugin update will not update Home Assistant or the other services that can be individually updated from the jails console menu.

This is great! The only thing not working is installing HACS.


Archive:  /var/tmp/hacs.zip
unzip: open('homeassistant/custom_components/hacs/const.py'): No such file or directory

Press ENTER to continue...

Worked here. Used winSCP to updload the files.
Followed the instructions here.

To update to latest version of HA do i have to wait for the plugin manager to update it? or is there anyway to update it manualy?

Yes – I added a console menu to make it easier to use from the FreeNAS webui
When you log into the HA plugin console – there should see main menu

Use number 1 for Home Assistant

Use number 4 to upgrade HA

OR – You can use the command line

service homeassistant upgrade

No – The plugin manager will never update HA or any other virtualenv

  • I will always leave this in your control

The plugin manager will only update the FreeBSD system packages. It will also update the system files I provided with the plugin. For example, when I add ( or need to fix ) something in the console menu – or when there is an update to the service script

1 Like

Uau :smiley: damn you’re the MAN! :smiley: thanks

1 Like

Troy - really appreciate the massive effort you’ve put into making a Freenas plugin for HA. Can’t thank you enough.

Does anyone have any experience of installing Zigbee2mqtt on Freenass? I’m trying to hook up some Xiaomi sensors. The official instructions over at www.zigbee2mqtt.io give guidance on running on a bare-metal Linux and virtualized environments, but as we know Freenas is basically Freebsd and I am out of my depth with that, the syntax and commands are not the same and although I can handle using the command line I tend to struggle a bit at the best of times.

Is it necessary to install Zigbee2mqtt in a separate jail from the main HA jail?
Is it possible to install Hass.io on freenas? Zigbee2mqtt is available as an official addon for that.

Any help much appreciated

@shanghaiultra

  • What kind of zigbee hub do you have? Is it a USB device?

With a few extra steps – USB devices like the HUSBZB-1 can be used by HA directly.

  • Is there a reason you do not connect directly to HA?
  • Is there a reason you want ( or need ) to use Zigbee2mqtt?

I’m asking so I can understand if you have a different use case that would require Zigbee2mqtt.


If you want to install Zigbee2mqtt I would strongly recommend a separate jail –


In any case – To connect a USB zigbee or zwave hub, to any jail on FreeNAS



This is something separate – I can only say where to look.

Yes – but there is no way to access your usb zigbee device

1 Like