Home Assistant Core -- TrueNAS CORE Community Plugin

Many thanks. That worked.

1 Like

Hi there, I recently installed the community plugin on FreeNAS. Trying to set up the SSL so home kit will work as outlined here: openssl and HomeKit Ā· tprelog/iocage-homeassistant Wiki Ā· GitHub

All works fine except for the part where I have no /srv/homeassistant/bin/ directory. So all the steps from this part onwards donā€™t work

Finally, still as user hass (or who ever runs HA), activate the virtualenv and reinstall homeassistant using the updated openssl
source /srv/homeassistant/bin/activate

I just get this error
-su: /srv/homeassistant/bin/activate: No such file or directory

Is there an alternative filepath? How do I complete the remaining steps.

source /srv/homeassistant/bin/activate
pip install --force-reinstall homeassistant
deactivate && exit

Appreciate the help.

Solved my own problem. Itā€™s in a completely different place on mine.
I found the location with

service homeassistant reinstall

Which then throws up the location of the virtualenvironment and asks you to confirm you want to re-install it.

[homeassistant@homeassistant ~]$ source /usr/local/share/homeassistant/bin/activate
(homeassistant) [homeassistant@homeassistant ~]$ pip install --force-reinstall homeassistant
1 Like

Hi @veridian

Sorry for the confusion. I recently updated this plugin to better follow standard BSD conventions. The openssl wiki page had not been updated to match. I took care of that now though.

By the way, you can use service homeassistant rcvar to see whatā€™s set for homeassistant. There are more possible, but these are the ones I set during the plugin installation

example output

root@homeassistant:~ # service homeassistant rcvar

homeassistant_config_dir: /home/homeassistant/homeassistant
homeassistant_enable: yes
homeassistant_group: homeassistant
homeassistant_python: /usr/local/bin/python3.8
homeassistant_umask: 002
homeassistant_user: homeassistant
homeassistant_venv: /usr/local/share/homeassistant

After updating to 0.115.2, HA refused to connect on xxx.xxx.xxx.xxx:8123. Running the above fixed the problem.

1 Like

I have the same issue, set the community plugin up with version 0.115.4 had to manually update with above method you describe. Now same happens when I want to upgrade to 0.115.6.
Upgrading using below command also works:

service homeassistant install --upgrade homeassistant

Do I now always have to use above method or can I fix the menu option in my setup?

Hi @wmn79 ā€“ Sorry, I realize I still need to add a plugin version, or some other way to determine which files (most important are the menu and rc.d scripts) you currently have installed with the plugin.

The menu is a shortcut for

service homeassistant upgrade

which internally, should be equal to using

service homeassistant install --upgrade homeassistant

:thinking: I have a suspicion. Can you confirm a few things please?

Before looking at the actual files, please make some simple checks

  1. Your menu has added 9) exit menu

  2. Using 2) status also shows the ip address if HA is running

Next please check line 237 in the rc.d/homeassistant script

# Exit the menu
ee /usr/local/etc/rc.d/homeassistant

You might find the following on Line 237

homeassistant_install --upgrade "${name}"

If so, please try changing it to the following and let me know if the menu option works again.

run_rc_command install --upgrade "${name}"

Also are you using FreeNAS 11.3 or TrueNAS Core?


By the way, menu options 2 - 8 are all just shortcuts to run service commands from the rc.d script. For example 8) check_config can also be run from the command line using.

service homeassistant check_config

Ok I checked the things you mentioned:

  1. Yes it has exit menu option
  2. Yes, status shows IP:port
  3. Yes line 237 had
homeassistant_install --upgrade "${name}"

changed it as proposed.
Downgraded to previous version and upgrading via the menu now works. So this seems to be the solution.

I am running FreeNAS-11.3-U4.1 btw

Thanks a lot for the help and quick reply! And of course your awesome work with creating this plugin!

1 Like

So I just realized that I fixed this on TrueNAS Core two months ago but must have forgot to updated the 11.3-RELEASE as well :man_facepalming: - Anyways, itā€™s done now. Thanks for letting me know @wmn79 ā€“ Iā€™m surprised it gone this long without being reported. Although Iā€™m now wondering if @elyobelyob might be having the same issue.

I assume the menu option 4) upgrade is broke for everyone that has recently installed or updated the plugin on FreeNAS 11.3 :man_facepalming: :man_facepalming: :man_facepalming:

Simply running an UPDATE from the Plugins page on FreeNAS will now fix the issue, however, due to the amount of time it can take, I think this may be a bit extreme for a relatively easy fix. ā€“ If your plugin is recent, it may be preferred to save time by manually editing one line of code.

Hi, thanks for the update.

I did an update via the plugins page and the update now works (updated from 0.115.5 to -0.115.6).

Nice work!

Cheers

1 Like

Python 37 will be depreciated with the release of Home Assistant 0.118

Within the next few weeks, Iā€™ll be updating the FreeNAS (11.3-RELEASE) plugin to use Python 38 (for clean installs only).

If youā€™ve installed this plugin on FreeNAS 11.3 after 10/09/2020, you should already using Python 38

If youā€™ve installed this plugin on TrueNAS Core, you should already using Python 38 :slightly_smiling_face:


You can check the Python version currently being used by going to :gear: Configuration -> Info in the Home Assistant UI.

Updating an existing installation to use Python 38 will require manual intervention to reinstall the Home Assistant virtualenv. Assuming your Home Assistant instance is up and running, these steps should be all thatā€™s required. (when asked, answer YES to also clear the pip cache)

iocage console $_JAIL_NAME
# Press 0 to exit the menu
pkg install -y python38 py38-sqlite3
sysrc homeassistant_python=/usr/local/bin/python3.8
service homeassistant reinstall

Please note, the command

service homeassistant reinstall

will reinstall the same version of Home Assistant that you are currently running.

If there is a more recent version of Home Assistant available and you would like to reinstall using the latest version you should use

service homeassistant reinstall homeassistant
1 Like

Worked like a charm here, thanks!

1 Like

I am trying to install a new jail for ozwdaemon as instructed here. No when installing ozwdaemon it gives some errors see below:

Project MESSAGE: Final Installation Directories:
Project MESSAGE: LibDir: /usr/local/lib/qt5
Project MESSAGE: IncDir: /usr/local/include/qt5/qt-openzwave/
WARNING: Failure to find: /usr/local/src/qt-openzwave/qt-openzwave/rep_qtozwmanager_replica.h
WARNING: Failure to find: /usr/local/src/qt-openzwave/qt-openzwave/rep_qtozwmanager_source.h
WARNING: Failure to find: /usr/local/src/qt-openzwave/qt-openzwave/rep_qtozwoptions_replica.h
WARNING: Failure to find: /usr/local/src/qt-openzwave/qt-openzwave/rep_qtozwoptions_source.h
WARNING: Failure to find: /usr/local/src/qt-openzwave/qt-openzwave/rep_qtozwlog_source.h
WARNING: Failure to find: /usr/local/src/qt-openzwave/qt-openzwave/rep_qtozwlog_replica.h
WARNING: Failure to find: include/qt-openzwave/rep_qtozwmanager_replica.h
WARNING: Failure to find: include/qt-openzwave/rep_qtozwoptions_replica.h
WARNING: Failure to find: include/qt-openzwave/rep_qtozwmanager_source.h
WARNING: Failure to find: include/qt-openzwave/rep_qtozwoptions_source.h
WARNING: Failure to find: include/qt-openzwave/rep_qtozwlog_replica.h
WARNING: Failure to find: include/qt-openzwave/rep_qtozwlog_source.h

ā€¦ compiling a lot of things and in the end the following:

linking ā€¦/ozwdaemon
/usr/bin/ld: cannot find -lresolv
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[1]: stopped in /usr/local/src/qt-openzwave/qt-ozwdaemon
*** Error code 1

Stop.
make: stopped in /usr/local/src/qt-openzwave

Any tips in where to look and how to fix these issues?

I remember this error myself - /usr/bin/ld: cannot find -lresolv - Thatā€™s why I addedā€¦

sed -i .orig 's| -lresolv||g' qt-ozwdaemon/Makefile

Can you try these steps again from here. I suspect you might have missed the line shown above.

setenv BUILDNUMBER 0

git clone https://github.com/OpenZWave/qt-openzwave.git /usr/local/src/qt-openzwave \
  && cd /usr/local/src/qt-openzwave \
  && sed -i .orig 's|-Wno-deprecated-copy|-Wno-deprecated|g' qt-openzwave.pri \
  && /usr/local/lib/qt5/bin/qmake "BUILDNUMBER=$BUILDNUMBER" \
  && sed -i .orig 's| -lresolv||g' qt-ozwdaemon/Makefile \
  && make && make install && cd

Otherwise Iā€™ll need to further investigate this evening. Iā€™m really noob when it comes to compiling software. I only figured this much out by trying to read the docker file and with trial / error.

Iā€™ve been looking through the FreeBSD Porterā€™s Handbook and Iā€™ve considered attempting a port of ozwdaemon. Itā€™s just that when I jump into something like this, it can get overwhelming.

Ran the lines again but one by one and now it seems to work. Will continue with the next steps.

ozwdaemon -s /dev/cuaU0 -c /usr/local/etc/openzwave -u /root --mqtt-server 192.168.10.15

The IP address of the mqtt server should be the ip of the home assistant install right?

No, should be your mqtt broker ā€“ Also youā€™ll want to use the rc service script so ozwdaemon will auto-start ā€“ You can either configure all options using sysrc or use a .profile

Thanks, I need to dig a bit more into how this open zwave beta works.

I did use a different devfs_ruleset btw. I used one that I had created earlier for one of my earlier jail installations. This has no issues with restarting jails and rebooting the server. It is placed on the FreeNAS host in /etc/devfs.rules and looks like this:

[usbrules=100]
add path ā€˜usbctlā€™ mode 660 group uucp
add path ā€˜usb/ā€™ mode 660 group uucp
add path 'ttyU
ā€™ mode 660 group uucp

Off course I also changed the jail creation command to use ruleset 100 instead of 99.

Quickly starting the ozwdaemon seemed to work just fine. Now need to study a bit on setting up mqtt etcetera.

1 Like

Clean installs of this plugin on FreeNAS 11.3 are now using python 3.8 by default.

For an existing install, see here to upgrade python.

Again this is for FreeNAS 11.3 only ā€“ If you installed this plugin on TrueNAS Core you are already using python 3.8

Hello, thank you very much for this great work and plugin, for me itā€™s much better to run home assistant on a jail than on a raspberry or a VM.

After a few days of configurations, I managed to do everything I was doing with domoticz.
I use zigbee, z-wave and RFX, gmail and push notifications, everything is ok.

Not having hassio, I created a new jail and installed node-red on it, but I get the error ā€œcan not get ha identitiesā€. But it does not matter because in my opinion node-red is not necessary.

My only real problem is that I canā€™t save my home assistantā€™s database without the supervisor tab.

I am running Freenas 11.3
Thanks a lot for your help

Hi @slim971 - Iā€™m not familiar with the supervisor

Are you talking about the file homeassistant/home-assistant_v2.db

One option is to make a backup of the configuration directory

  • This will include home-assistant_v2.db
iocage console $_JAIL_NAME
# Press 0 to exit the menu
service homeassistant config --backup

The default backup directory is /home/homeassistant/.homeassistant_zip.d

  • you can set a different location using
sysrc homeassistant_backup_dir=/path/to/directory

If the directory does not exist, it will be created the first time you make a backup


Example output

root@homeassistant:~ # service homeassistant config --backup

Creating Backup...

 Config Directory: /home/homeassistant/homeassistant
 Backup Directory: /home/homeassistant/.homeassistant_zip.d
 Backup file: HA_0.116.1_201010.090516.zip

Testing Backup... 
Backup Created /home/homeassistant/.homeassistant_zip.d/HA_0.116.1_201010.090516.zip

The name of the backup file above is HA_0.116.1_201010.090516

HA = Home Assistant
0.116.1 = Home Assistant version at time of backup
201010 = Date of backup ā€“ Year (20) month (10) day (10)
090516 = Time of backup ā€“ Hour (09) Minute (05) second (16)


EDIT ā€“ Sorry I donā€™t have time right now, but next week I will add an example of how to trigger this backup from Home Assistant using the shell command integration