With this instruction a have an error after starting service:
```
# sysrc homeassistant_enable="YES"
homeassistant_enable: -> YES
# service homeassistant start
install: : No such file or directory
Starting homeassistant.
daemon: open: Permission denied
/usr/local/etc/rc.d/homeassistant: WARNING: failed to start homeassistant
```
There is needs to define logfile variable in rc.d script
* updated rc.d script
Add extra_commands
check_config - checks config using `hass --script check_config`
upgrade - stops HA / upgrade / checks config / starts HA (only starts if config check passes)
test - simple test to check directories / activate venv / check version of python and homeassistant
restart - (modified) check_config / stop HA /start HA (only restart if config check passes)
NOTE: All extra_commands REQUIRE bash to be installed
`pkg install bash`
I also removed the check_config from the pre_start function because because it will prevent HA from starting
if the configuration is missing (Like a clean install from example). NO BUENO!
Another case to consider haveing no configuration even after initial install is troubleshooting or testing.
For instance with rc.d script createing a fresh config is simple.
Let's suppose my working config is at
`/home/hass/homeassistant`
Now to get a clean configuration I can just do this
service homeassistant stop
sysrc sysrc homeassistant_config_dir="/home/hass/ha_test_config"
service homeassistant start
That's it! Configuration wise, it's a clean install. To switch back to working config I just
service homeassistant stop
sysrc sysrc homeassistant_config_dir="/home/hass/homeassistant"
service homeassistant start
Awesome right?! But that doesn't work if check_config fails during pre_start
* add pkgs
These are not required to install HA but they are quickly missed once you start to actual use it. Let's just avoid
some fustration from the start. I don't think this list should be all inclusive but these basic things seem to be
frequently needed from the start.
autoconf |
gmake | - looking at you Z-Wave, Stream, IKEA Tradfri
pkgconf |
bash - Give me bash or give me death! Seriously, it makes life easier. There's not alot of *BSD focus
around HA. I only use *BSD because of FreeNAS -- Typically (with the exception of jails) FreeNAS is webui.
I'm ok with Linux cli and it's very similiar to FreeNAS but not the same. It's not bash. I don't think it
needs to be for the root user either. But having bash installed and used by the HA user makes it easier
to follow along with exising documentation for other virtualenv type installs when trying to further expand
your HA installation
* give me bash or give me death!
Most people won't notice a differene but we'll know in our hearts we did the right thing.
* fix typo
I'm lucky I can spell my name
* whitespace
* use venv
Use the built-in venv instead of virtualenv which must be installed seperate.
* Update with working instructions
Old instructions failed to include virtualenv, also failed to actually start HA as the config directory it default creates was wrong, and empty.
* Minor changes
* Sets front matter defaults
* Removes default front matter from section templates/pages
* Removes default front matter from addon pages
* Removes default front matter from integration pages
* Removes default front matter from posts
* Removes default front matter from docs pages
* Removes default front matter from other pages
* Fixes blog category pages
I'm guessing the -y was meant to be on pkg upgrade, instead?
from pkg help update:
pkg update [-fq] [-r reponame]
pkg update [--{force,quiet}] [--repository reponame]
* Update install docs for FreeNAS 11.2
This includes some best-practice improvements (such as running Home
Assistant as a limited-access user vs root), using Python 3.7 to install
and adding a BSD-style service to manage and test configuration.
* Fix typo
* Update freenas.markdown
The example provided for a chained command to mkdir /home and /home/.homeassistant was missing the second mkdir command. A copy and paste of this example would fail.
* Update freenas.markdown
Updated mkdir commands to use '-p' option.