FreeNAS Plugin: Demo includes Home Assistant + AppDaemon + Configurator


#1

Edit: 06-12-2018
Learning in progress!

I’ve been thinking that creating a “plugin” is incorrect when used in the context of FreeNAS. Traditionally a plugin in FreeNAS is installed and managed (ie updates) using the web GUI of FreeNAS. When it’s time for the application (in this case HA for example) to update. I, as the plugin creator, would somehow update my “plugin” which would intern allow user to update HA using the “update plugin” in FreeNAS GUI. This is not gonna work that way. This unofficial plugin is safe to use. However you should consider this just an easy install method. If you plan to move forward with this any updates to Home Assistant or App Daemon will still need to be performed manually, on the command line, just like if you installed HA following my guide.

With regards to “iocage plugin” vs “iocage jail” They are technically both jails but the “plugin” is a “somewhat specialized jail” I don’t completely understand what “specialized” implies and that discussion is beyond the scope of this forum. So what does it mean? If you already installed this and it’s setup and you can’t change it, no biggie. Just be aware again that you have to perform your own updates. Don’t expect a “plugin update” to perform updates for you.

So a plugin is still a jail but “it’s a specialized jail” blah blah blah. So here’s the bottom line. In my guide we create a “jail”… plain and simple, nothing specialized about it. I like that because it’s easy to understand. That being said I am working on a better approach that will still provide a script to install Home Assistant but it will be installed in a regular “jail”. There’s really nothing complicated happening here. I would just just like to help save some time cut down on the amount of copy and paste from various guides just to get things installed. Still I learned a lot making this “plugin” and got a few new ideas. Hopefully what’s coming next will help lots of people get Home Assistant going FreeNAS. I don’t think anybody uses HA alone which is why this plugin has included AppDaemon and Configurator. I still have things to do but I have a roughly finished a few things including some simple bash scripts to create jails and install Home Assistant and some friends. at this time I Mosquitto, TasmoAdmin. AppDaemon, Configurator, Dasher and Node-Red Im working on next. Also I figured out some tricks that will allow for easier updating. For example to update to update HA would be as simple as entering in your FreeNAS console one command iocage exec homeassistant bash /root/ha.sh upgrade And even better than that will be having a simple little menu to choose update homeassistant so you don’t even have to remember what that nifty single command is. So that’s what coming from me next.

In the meantime I’m going to leave this “plugin” here. Give it try if you’d like but let’s just consider this a DEMO.
Also AppDaemon (includes HADashboard) and Configurator are installed as well. I included a sample Dashboard (sized for a fire 7 tablet) and both the configurator and my sample dashboard have been pre-configured to show up in HA

Just two lines to copy and paste. This should take less than 5 min. ( It really only takes 3 min for this to install in a VM on my laptop )


ssh into your FreeNAS

wget https://raw.githubusercontent.com/tprelog/iocage_plugings_freenas/master/homeassistant-demo.json
sudo iocage fetch -P dhcp=on vnet=on bpf=yes -n homeassistant-demo.json



Installing HASS in virtualenv on FreeNAS 11.1-U3 w/ iocage jail
#2

Thanks you, i will give these a try


#3

How do i go about accessing the yaml file ?


#4

You can use the Configurator to edit the yaml files. Sorry I don’t have time to better explain but hopefully a pictures can help.


#5

Can you do docker containers on FreeNAS? I only played with it for a couple days but ended up on unRaid last year and it just has a docker tab on the GUI where you just search and pick which containers you want to install in the GUI. Figured FreeNAS might have something similar?


#6

Thank you Troy, Everything works


#7

EDIT: Sorry I just re-read your question… Yes you can run docker on FreeNAS but there is NOT a “docker tab” I think you have would have to configure docker manually.

The short answer I think is yes. I’ve only played with docker a few years ago when it first released. Now getting Hass.io running, for example, might not be so straightforward. I’m sorry I don’t have the knowledge to better speak about this. For my current use case docker is just to much overhead. And there is overlap between what FreeNAS already provides and the add-ons provided with Hass.io. For example Samba and ssh are already available and easily configured through the native FreeNAS GUI. I have only briefly looked at trying to get Hass.io running on FreeNAS but at this time it’s just been much easier to get the components (like AppDaemon, Node Red, Mosquitto…) running by themselves. For me it’s just easier to make a new Jail. I have been slowly working on some other scripts make installing these other “add-ons” easier but work is getting in the way


#8

Right, I had the same overlap issues as well and with the docker containers already ready to go it was a simple 2-3 minute install and setup for my first HomeAssistant install with MQTT running.


#9

@digiblur. I know it’s off topic but FreeNAS 11.2 Beta released this week. Have a look here for some new features in the GUI related to docker http://doc.freenas.org/11.2/vms.html#docker-rancher-vms


#10

Ahh… They have to do VMs, guess that’s due to FresBSD? Makes sense now.


#11

Last question lol how did you install Mosquitto Mqtt?


#12

@fvargasfrank I install mosquitto in a separate plugin/jail.

Try this to install as a plugin

wget https://raw.githubusercontent.com/tprelog/iocage_plugings_freenas/master/mosquitto-mqtt.json
sudo iocage fetch -P dhcp=on vnet=on bpf=yes -n mosquitto-mqtt.json

Or if you prefer this is a great example to create and install in a jail manually. Here’s a link that if your interested


#13

Thank you i did manually need to learn anyway lol, do i need to do anything special for it to auto start in case of a reboot or something ?


#14

If you followed all steps you are already good to go! Just fyi this is the exact command that enables mosquitto to auto start on reboot

sysrc mosquitto_enable=yes

#15

Hello Troy,
So yesterday i had a power outage and I’m unable to get Home assistant running, not able to console in the hass-3io, I cant stop it and start it. It gets an IP but home assistant is not running,
[email protected]:~ # iocage console hass-3io
[email protected]:~ #
[email protected]:~ # iocage stop hass-3io

  • Stopping hass-3io
    • Running prestop OK
    • Stopping services OK
    • Tearing down VNET OK
    • Removing jail process OK
    • Running poststop OK
      [email protected]:~ # iocage start hass-3io
  • Starting hass-3io
    • Started OK
    • Configuring VNET OK
    • DHCP Address: 192.168.1.147/24
    • Starting services OK
      [email protected]:~ # iocage console hass-3io

#16

@fvargasfrank I’m not really sure but hopefully I can help figure it out.

What’s the output if you run iocage list -l

It’s weird you cant even get to the console. Since the console is connecting to the plugin OS. Even if homeassistant was completely corrupted or not even installed you should still be able to get in the hass-3io console.

Have you tried restarting your entire FreeNAS system? This seems like something wrong with jail itself not directly a problem with homeassistant

Also just curious what returns if you run this command?
iocage exec hass-3io service homeassistant status


#17

Here are the output
I restarted several time but not luck
I can always destroy it and start clean i dont have much, but dont know if there is something wrong with the script or my system lol

[email protected]:~ # iocage list -l
±----±---------------±-----±------±---------±-----------------±----------------------±----±---------+
| JID | NAME | BOOT | STATE | TYPE | RELEASE | IP4 | IP6 | TEMPLATE |
+=====+================+======+=======+==========+==================+=======================+=====+==========+
| 2 | hass-3io | on | up | pluginv2 | 11.1-RELEASE-p11 | epair0b|192.168.1.147 | - | - |
±----±---------------±-----±------±---------±-----------------±----------------------±----±---------+
| 1 | mosquitto-mqtt | on | up | pluginv2 | 11.1-RELEASE-p11 | epair0b|192.168.1.126 | - | - |
±----±---------------±-----±------±---------±-----------------±----------------------±----±---------+
[email protected]:~ #

[email protected]:~ # iocage exec hass-3io service homeassistant status
homeassistant is not running.
True
[email protected]:~ #
[email protected]:~ # iocage console hass-3io [email protected]:~ # iocage exec hass-3io service homeassistant start
Starting homeassistant.
login class ‘daemon’ non-existent, using default
su: pam_start: system error
/usr/local/etc/rc.d/homeassistant: WARNING: failed to start homeassistant
True


#18

So that definitely looks like the jail is up… When you run iocage console hass-3io Do you get to the hass-3io console?

If not can you test iocage console mosquitto-mqtt to see if that works


#19

When i console to the mosquitto it works fine but the hass one does not it just goes back
[email protected]:~ # iocage console hass-3io
[email protected]:~ #


#20

So right there makes me think its the jail. I also have no idea what this is either.

Honestly it’s probably much quicker (probably about 10 minutes) to just backup you config files you’ve edited in homeassistant and just reinstall rather than troubleshooting a broken jail. I can help you do that. It’s very simple and good to know how anyways. Not the best answer I know… but its probably the easiest. I did figure out how to make a plugin but I’m by no means and expert when it comes to the FreeNAS system itself