Installing home assistant in iocage jail

pomah

Explorer
Joined
Jul 30, 2012
Messages
55
Hello all

I am running 11.2 RC1, and I would like to install home assistant as a plugin and use it on my freenas sever. Could someone please just check and verify that the following instrucion below is still true for 11.2 rc1?

https://community.home-assistant.io...ualenv-on-freenas-11-1-u3-w-iocage-jail/48220

Is there any easy way to create a package that can be integrated into the freenas plugin system? I think an option like home assistant or domoticz could be a great step forward to make FreeNAS even better and more compelling.

EDIT: Created a feature request for it here: https://redmine.ixsystems.com/issues/54990

I wish you could vote for features, this would get my vote too: https://redmine.ixsystems.com/issues/30136
 
Last edited:

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
@pomah
I am running 11.2 RC1, and I would like to install home assistant as a plugin and use it on my freenas sever. Could someone please just check and verify that the following instrucion below is still true for 11.2 rc1?

https://community.home-assistant.io...ualenv-on-freenas-11-1-u3-w-iocage-jail/48220

I wrote that guide and also this one that has been updated for FreeNAS 11.2 and includes the plugin I made which is mentioned above and also includes instructions to install manually.

https://community.home-assistant.io...gurator-mosquitto-and-tasmoadmin/71882?u=troy
 
Last edited:

pomah

Explorer
Joined
Jul 30, 2012
Messages
55
@pomah


I wrote that guide and also this one that has been updated for FreeNAS 11.2 and includes the plugin I made which is mentioned above and also includes instructions to install manually.

https://community.home-assistant.io...gurator-mosquitto-and-tasmoadmin/71882?u=troy

Just a question, since I am totaly new, when doing this in the web gui, using the terminal i run into an error, I guess I have to create a jail and somehow open the terminal inside it? Any tips on that?
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
Just a question, since I am totaly new, when doing this in the web gui, using the terminal i run into an error, I guess I have to create a jail and somehow open the terminal inside it? Any tips on that?

@pomah --That guide does assume some level of experience. No worries, Can still try to help but you have not provided much useful information.

Just a question, since I am totaly new, when doing this in the web gui, using the termina i run into an errorl
Doing exactly what? There is a lot of things you could be doing in that guide. I'll assume you're trying to install Home Assistant?

There are 3 options listed there for installing Home Assistant. In case you wondering, all 3 (in the end) provide exactly the same installation of Home Assistant. For Home Assistant (My opinion here) I recommend creating a "standard jail" not the "plugin-jail". More so, I recommend using the iocage standard-jail (Scripted Install). <--- This is just a scripted version of the manual install method. Regardless any method should work.

How are you trying to install Home Assistant?
When does the error occur?
What is the error?

I guess I have to create a jail and somehow open the terminal inside it?

Yes... No... Maybe... Are three answers but since I don't know how you're trying to install HA I don't know which answer applies to you.

Yes -- Technically only the Manual install requires opening a terminal inside
No -- Plugin (script)
Maybe -- Standard Jail (script) Depends. You could be using the first two steps in this section to create your jail then trying to manually install HA

Any tips on that?
You'll need to provide a bit more information :)
 

pomah

Explorer
Joined
Jul 30, 2012
Messages
55
Hi, sorry for my lack of information :)

Following your guide, I have done the these things:

1) Created a group called "hass"
2) Created a dataset for "hass", permissions and all
3) shared it through smb
4) Installed first part of the script:
wNSohbd.png

5) Doing the second part of the script I get this error:
zu7P3us.png

I have tried to SSH into the server and install it that way but apparently the root user cant use sudo...
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
@pomah Fortunately this is an easy one. When I log into my FreeNAS (I use ssh, not the terminal in the GUI) I connect using a regular user account, not root.

The sudo command is used so a regular user can run commands that need `root` permissions. In your case, you are already the `root user`, so you get the error. You just need to remove sudo from the command as shown below.

iocage fetch -P dhcp=on vnet=on bpf=yes -n /tmp/homeassistant.json --branch 'master'
 

pomah

Explorer
Joined
Jul 30, 2012
Messages
55
@pomah Fortunately this is an easy one. When I log into my FreeNAS (I use ssh, not the terminal in the GUI) I connect using a regular user account, not root.

The sudo command is used so a regular user can run commands that need `root` permissions. In your case, you are already the `root user`, so you get the error. You just need to remove sudo from the command as shown below.

iocage fetch -P dhcp=on vnet=on bpf=yes -n /tmp/homeassistant.json --branch 'master'

So far so good :)

P8aooxW.png
 

pomah

Explorer
Joined
Jul 30, 2012
Messages
55
Well next problem...

@tprelog I followed this guide to get the z-wave stick accesable to the jail, thank you again, but I cant figure what adress to write in HASS to get it to show...

wXUXa5l.png


/dev/ugen1.3 should be it and it is accesable from the jail as far as i can see...

WRKa0nh.png
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
Glad you got it! :)
 

kustums

Cadet
Joined
Mar 29, 2019
Messages
4
@tprelog Followed your scripted install. Skipped the zwave/zigbee and the optional mount. everything installed correctly except the appdaemon will not run. Currently on Freenas-11.2-U2.1 if that helps, any ideas or suggestions?
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
@kustums appdaemon needs it's own configuration file. During the scripted install did you choose yes to use the example configuration files?
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
@kustums Ok I just did a quick run through and can verify appdaemon is not starting for me either. I'll have a look and report back asap
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
@kustums
I'll have to look into this more but it boils down to this. For some reason the secrets file is not working

Code:
ERROR Error loading configuration
ERROR parser says
ERROR   in "<unicode string>", line 13, column 15:
          ha_key: !secret ha_api_key
                  ^
ERROR could not determine a constructor for the tag '!secret'


You can still get appdaemon running now by moving the password to the appdaemon config file: /home/hass/appdaemon/conf/appdaemon.yaml - I have only provided the legacy api password so appdaemon would work "out of the box" I strongly recommend you change this to something of your own or disable it completely in favor of long live access tokens.

First thing you should do is create a long live access token for appdaemon. This is done from your account settings in HA
(Let me know if you don't know how I can make a quick step by step)

Then edit appdaemon.yaml (you can use configurator for this)
Locate and delete the line ha_key: !secret ha_api_key
Replace it with token: APPDAEMON_LONG_LIVE_TOKEN

Then restart the jail and appdaemon should hopefully now auto-start

Sorry I don't have time right now to provide more detailed help. Hopefully you can understand this without much difficulty. But again if your are novice and need more step-by-step let me know and I probably help more later this weekend
 

kustums

Cadet
Joined
Mar 29, 2019
Messages
4
@tprelog Thank you, that got it working for now. I'll keep checking back for updates. Thank you again for your help setting up HA.
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
291
@kustums
I think I have this narrowed down to changes made in pyyaml==5.1
If you would like to use the secrets file for appdaemon you can downgrade to pyyaml==3.1 and it will work again

Code:
iocage console homeassistant

su - hass
source /srv/appdaemon/bin/activate
pip install --upgrade pyyaml==3.13
deactivate && exit

service appdaemon restart

# To check if its actually started
service appdaemon status
 
Top