Home Assistant Core -- TrueNAS CORE Community Plugin

@mhm69 @shandogs

2020-06-21 21:06:44 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Z-Wave (import from configuration.yaml) for zwave
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 217, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/zwave/__init__.py", line 341, in async_setup_entry
    from openzwave.option import ZWaveOption
  File "/srv/homeassistant/lib/python3.7/site-packages/openzwave/option.py", line 29, in <module>
    import libopenzwave
ImportError: /srv/homeassistant/lib/python3.7/site-packages/libopenzwave.so: Undefined symbol "libiconv"

There’s certainly something going on here – I think I have almost narrowed down the cause now. I’ll be sending you both a PM soon

Is there anyway to edit the IP address of the File editor in the side bar? I changed the IP address for the home assistant jail and now the file editor side bar link doesn’t work.

Absolutely. In fact File Editor and AppDaemon that you see in the side panel are simply iframes that have been enabled in homeassistant/packages/freenas_plugin.yaml

You can still reach the File Editor directly at http://new.ip.add.ress:3218 to make changes.

Troy, Thanks for your continued work on this plugin for FreeNAS/TrueNAS. I looked at your temp page on your wiki and I think you have a lot of good ideas in the works. I am looking forward to the final result! Here are a few things that I thought of that would help me and possibly a few others:

  • Maintain a Manual Install Guide along side of the plugin. This will allow those of us that need to adjust some things to our specific situation. For example: I don’t use DHCP for server jails and I have multiple VLANs in my jail. This guide could also provide a good starting point for someone that needed to install on raw FreeBSD or in a jail not managed by iocage.
  • Provide instructions for use with the plugin and the Manual Guide to keeping the Home Assistant configuration and data in datasets outside of the jail.
  • Consider creating a FreeBSD port with your scripts. This would mean that the Plugin only had to create the correct jail environment and install the package created from your port and it would make Home Assistant available to a lot of FreeBSD users that are not using FreeNAS.

Thanks again for all your work on this,
Kelly

1 Like

amazing!! thankyou

@jkhii Thank you for your feedback :confetti_ball:

I’m already working on this :wink:

3 years ago, my first guide was a manual guide and shortly there after I made the first version of this plugin but having the usual concerns about “plugins” on FreeNAS, I quickly backed away from that in favor of a “scripted install” for a standard-jail for FreeNAS 11.2. When FN 11.3 was released with the community plugins page, and I realized I could still have full control of the artifact repo, I figured I would re-release this as a “plugin”

This was already in my 11.2 guide but I never updated anything as far as a manual guide for the 11.3 release. ( the previous guide is really only outed in terminology and screenshots more than anything else ) We can talk about my excuses for that delay another time… Anyways for TrueNAS Core, my goal is finally bring everything back together once and for all. Hopefully the new service script mentioned on the temp wiki page is going to be the start. –

This already, is not the typical “plugin” you may expect or be used to. I think in general, it’s easy for FreeNAS user’s to have bad taste for “plugins” dating back to the old warden days. With iocage, at least in the case of this plugin, things are different. For instance, this plugin always installs the current version HA Core available at the time and you can mange maintain a version or update as you see fit. Also there is no need to wait for any kind of “plugin update” in order to update HA.

I think this is very much a hybrid-plugin - meaning you still have almost full control ( currently it’s just very fragmented if you want to change some things ) Typically a plugin would manage everything for you. I’m only using the “plugin” as a way to provide an install button from the FN UI and provide easy updates for a few files, like the console menu script and the rc service scripts. There are a few considerations I really do need to document but basically you can about 98% percent treat this “plugin” like a “manual install” – This is also why, in this plugin you will sometimes see “manual intervention required” – It is not something extra because your using this “plugin” – It is a step that would still be required in a manual installation anyways.

Which brings me to the updated service script on the temp wiki page and finally bringing everything back together. My hope is that by the time TrueNAS Core is released, I’ll have mostly refactored this plugin ( in this case I mean the virtualenv services ) to be configurable using sysrc. The idea is to use the RC Service Guide ( temporary wiki page ) as the configuration guide for the plugin – Then in the RC Service Guide I’ll break down each service command into the manual steps that are being preformed.

I really like this idea. I think the new service script will really go along way to make this happen. In fact, if you installed the requirements and created the user first, I see no reason to prevent the new service script from working on a vanilla FreeBSD system, outside of iocage right now! I think ( after I get things cleaned up ) the only thing missing is creating a port.

The HomeKit /openssl saga continues in the 11.3-RELEASE…

I think I’m gonna have to revert the “out-of-the-box” update to openssl This solution ( in it’s current state ) breaks the “out-of-the-box” working Z-Wave ( 1.4 ) integration.

2020-06-21 21:06:44 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Z-Wave (import from configuration.yaml) for zwave
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 217, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/zwave/__init__.py", line 341, in async_setup_entry
    from openzwave.option import ZWaveOption
  File "/srv/homeassistant/lib/python3.7/site-packages/openzwave/option.py", line 29, in <module>
    import libopenzwave
ImportError: /srv/homeassistant/lib/python3.7/site-packages/libopenzwave.so: Undefined symbol "libiconv"

There is another workaround to get Z-Wave working again but this workaround will need to applied aafter every update to homeassistant-pyozw . So now there are 2 workarounds and the seconds needs constant attention for all Z-Wave users… I think This is steamy pile :poop:

iocage console $JAIL
# Press `0` to exit the menu

su - hass

export CFLAGS=
export LDFLAGS=
export CPATH=
export LIBRARY_PATH=

source /srv/homeassistant/bin/activate
pip install --force-reinstall --no-cache homeassistant-pyozw==0.1.10
deactivate && exit

service homeassistant restart

After consideration, I think it best that I remove the updated openssl from this plugin. The bottom line is that’s it’s unacceptable to by default, apply a workaround or update something in this plugin, that will break something else, that would otherwise work if you followed a manual installation.

I’m going to submit another pull request to have openssl removed from the plugin manifest… If you have already installed openssl, it will not be removed unless done so manually. If your HomeKit is working today it should not be affected.

One way or another, someone needs to apply a work around, the best I can do here trying to minimize the effect. Moving forward on the 11.3-RELEASE community plugin, if you need to use the HomeKit integration, you will still be able to follow the steps needed to update openssl in a manual installation.

  • If you update openssl for HomeKit and you are not using the Z-Wave integration, this will be a one time manual intervention.
  • If you update openssl for HomeKit and you are using the Z-Wave integration, you will need to manually apply both workarounds and will continue to require manual intervention every time homeassistant-pyozw is updated

The 12.x -RELEASES includes openssl 1.1.1. The HomeKit integration already works “out-of -the-box” in TrueNAS Core 12, without any additional steps or workarounds

Thanks, this is awesome. Still don’t have everything working yet, but this has gotten me much further along so far than any other post!

Hi @mikeyricci – Sorry your having troubles… I really jumped the gun pushing that update for openssl. Hopefully I have somewhat contained this for now.


Update on the issues with HomeKit/openssl and Z-Wave

I just pushed an update to remove openssl from any clean installs. So from this point, Z-Wave should working again. HomeKit users that require openssl-1.1.1 can still follow this manual guide. These are the same steps that would be required to use HomeKit if you manually installed Home Assistant Core in a standard-jail.

I’m still waiting for this pull-request to be merged, which will remove openssl from the manifest.

Any effects of all this should be limited to anyone who installed or updated the plugin between 05-26-2020 and 06-28-2020 and further limited ( I hope ) to only Z-Wave and HomeKit users – I’m really sorry for the inconvenience this is causing everyone :disappointed: I’m learning as we go… hopefully you all don’t give-up on using this plugin.

Fortunately, the jails in TrueNAS Core 12 are using the 12.1-RELEASE which ships with openssl-1.1.1 in the base. In other words, both HomeKit and Z-Wave are working on TrueNAS Core 12 without any extra steps or workarounds.


TrueNAS Core 12 Beta 1 is around the corner

The Home Assistant Core plugin will not work in the TrueNAS Core nightly until this pull-request is merged. – I’ve already pushed an updated manifest to my own plugin repo, which can be used to test this plugin in the mean time.

I suggest this for testing only
</s> <s># Install</s> <s>iocage fetch -P homeassistant -g https://github.com/tprelog/freenas-plugin-index.git --branch 12.1-RELEASE --name JAIL_NAME</s> <s># update</s> <s>iocage update -P homeassistant</s> <s>

Updates already in TrueNAS Core 12 Community Plugin

  • Custom devfs_ruleset is now included for Z-Wave and Zigbee devices !
  • Home Assistant is using Python 3.8
  • HomeKit works again ( no extra steps required )
  • Slightly improved ( auto-start ) rc service script ( more options )
  • The venv directory has been moved to /usr/local/share/homeassistant

– Lots of general clean-up still to come

Changing some defaults

At this time, the TrueNAS 12 Community plugin is still using the hass username from FreeNAS 11.3

I’ve become aware that numerous people do not care to use the hass username, as this translates to hate in German. For this reason I’m changing the default user to the typical homeassistant which will of course effect the configuration directory, now getting located at /home/homeassistant/homeassistant. ( removing the leading . that would normally make this directory hidden )

Also the venv directory. I’m thinking will be moved to /usr/local/share/homeassistant to better make standard FreeBSD convention

I am planning to update the Manual Installation Guide as well and I would like this plugin to have defaults matching those used in that guide. Obviously any defaults can still be adjusted on a per user basis to meet specific needs but I would still like to includes defaults that a majority of people are happy with.

Maybe something like /home/homeassistant/ha-config or similar. Makes it more clear what is in the directory and avoids duplicating the word homeassistant.

@jkhii Thank you again for your suggestion – Are you joined on the Home Assistant Discord channel? If you don’t mind, I would like to invite you to a ( very ) small PM group.

Upgraded to the TrueNAS 12 beta and tried a fresh install the Homeassistant plugin as a test - unfortunately having a number of package failures:

Error: Homeassistant had a failure Exception: RuntimeError Message: pkg error: - ffmpeg :,gcc :,gmake :,libxml2 :,libxslt :,pkgconf :,python38 :,py38-sqlite3 :,sudo :,wget :,zip : Refusing to fetch artifact and run post_install.sh! Partial plugin destroyed

Not sure if anyone else is having issues?

Steve

Hi @SteveR

I’m having the same problem this morning. Looks like ffmpeg is no longer available in http://pkg.FreeBSD.org/${ABI}/latest

Not sure why this would have been removed but it was there and installed correctly last week

[email protected]:~ # pkg show ffmpeg
ffmpeg-4.3,1
Name           : ffmpeg
Version        : 4.3,1
Installed on   : Tue Jun 30 10:41:57 2020 EDT
Origin         : multimedia/ffmpeg
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : net audio multimedia
Licenses       : GPLv3+, LGPL3+
Maintainer     : [email protected]
WWW            : http://ffmpeg.org/
Comment        : Realtime audio/video encoder/converter and streaming server

EDIT

I changed, in the plugin manifest "packagesite": to "http://pkg.FreeBSD.org/${ABI}/quarterly", which still contains ffmpeg and the plugin installs again.

EDIT 2 – I tested some other plugins on TrueNAS Core 12 and it seems that all the plugins using "http://pkg.FreeBSD.org/${ABI}/latest" and listing ffmpeg in the manifest are now failing to install.

I’ve submitted a pull request to have this plugin switched to "http://pkg.FreeBSD.org/${ABI}/quarterly"


In the mean time, you can edit the manifest file manually.

It is located in the iocage dataset, for example on my server /mnt/nvme/iocage.

ee /mnt/nvme/iocage/.plugins/github_com_ix-plugin-hub_iocage-plugin-index_git/homeassistant.json

On line 39 you will find

  "packagesite": "http://pkg.FreeBSD.org/${ABI}/latest",

Change line 39 to

  "packagesite": "http://pkg.FreeBSD.org/${ABI}/quarterly",

Press esc then enter twice to save and exit.

After that the plugin should install – Note this is temporary until the pull request is merged.

@troy,
I looked this morning and the ffmpeg package is back in the latest repo. It looks like it was missing for a few days due to a fetch error on the build server. The quarterly repo should be more stable.

You can look at the current status of a port/package at FreshPorts. For example the ffmpeg page:
https://www.freshports.org/multimedia/ffmpeg/

If you scroll down on that page there is a grey table that lists what packages are available.

Kelly

That’s a relief to see it’s only missing by accident :sweat_smile: – I did manage to find the fresh ports link pretty quickly, however I could not figure out how the search for the reason –

It looks like it was missing for a few days due to a fetch error on the build server."

Thanks for clearing that up!


Using HomeKit/openssl and Z-wave: Round 3 - FIGHT :fist_right: :boom: :fist_left:

There is a side-effect to the current approach for using openssl-1.1.1 in the 11.3-RELEASE when ffmpeg is also installed. – If you have the following error trying to setup the Z-Wave integration

2020-06-21 21:06:44 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Z-Wave (import from configuration.yaml) for zwave
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 217, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/zwave/__init__.py", line 341, in async_setup_entry
    from openzwave.option import ZWaveOption
  File "/srv/homeassistant/lib/python3.7/site-packages/openzwave/option.py", line 29, in <module>
    import libopenzwave
ImportError: /srv/homeassistant/lib/python3.7/site-packages/libopenzwave.so: Undefined symbol "libiconv"

For now, there is a manual fix that can be preformed.

iocage console $JAIL
# Press `0` to exit the menu

su - hass
export LDFLAGS=
source /srv/homeassistant/bin/activate
pip install --force-reinstall --no-cache homeassistant-pyozw==0.1.10
deactivate && exit

service homeassistant restart

I am currently testing an easier solution that will ( if successful ) be available in a near future update.

Hi.

Thank you making it so easy to install Home Assistant.

I have it working almost perfectly.

There’s two things I can’t get to work, and I think it may have to do with the jail configuration or maybe vnet

I have some TPlink Kasaa device and SenseMe (installed via HACS) unit, I can’t get them to find any devices.
Even playing with the command line binary (like aiosenseme --discover), no devices are found. I see errors about UDP broadcast when run

When I run the same set-up on a Linux box, it works well.

Both SenseMe and TPLink use UDP broadcast to find devices.

Is there anything special to do with the network configuration ? I used the defaults, using DHCP with ipv4, I have ipv6 on this network but it didn’t pick any config there.

Thank you.
JY

Hi!

I have installed configurator and appdeamon on TrueNAS Core 12. I have got error message, when test it on shell.
Testing virtualenv…
NO DIRECTORY: /srv/configurator
and
NO DIRECTORY: /srv/appdeamon

Can you help me, what do i wrong?

Thanks. Maxim

@jyavenard I’m sorry missed your post yesterday –

I am not aware of any special network setting, I’ve used TPLink in the past and the only requirement was to locate the device on the same network sub-net. I could not get it to work over VLAN but I’m not anything close to a network admin. I also use the default setting myself because they usually just work.

Sometime it’s just something random – for example, using emulated hue from a jail… I’ve seen people try to all sorts setting, both on HOST and in the JAIL, to get this working – At the end of the day, the easy solution ( required no system configuration ) was to just use a different port.

emulated_hue:
  listen_port: 8300
  upnp_bind_multicast: true

I’m sorry I can’t any offer any direct help, I’ve haven’t spent much time trying to configure jails with non-default settings. I’ll tell you this, don’t be scared because your using the “plugin” – If your trying to get something to work, you can do / try anything you would normally do in a manually created jail.


You are doing nothing wrong – I’ve been messing with the setting in the plugin – This is entire thing is getting completely refactored so using the TrueNAS beta plugin may be a little rough until I can this finished. – I’ve only been focused on Home Assistant Core ( appdaemon and configurator are not going away, these are not my primary concern ATM, since TN 12 is still beta )

The short story - right now the services are pulling $rcvars directly from the rc service scripts. These are the defaults I keep talking about changing – I have made some temporary changes already in TN 12 but in the process of all this I had a light bulb moment – I decided to trash this entire thing and started from scratch.

To get this fixed up, here’s what you can do right now.

# press `0` to EXIT the console menu
rm -rf /usr/local/srv/appdaemon
rm -rf /usr/local/srv/configurator

sysrc appdaemon_venv=/usr/local/srv/appdaemon
sysrc configurator_venv=/usr/local/srv/configurator

# restart the console menu
menu

Install appdaemon and configurator – Ignore message about existing configuration

1 Like

I assure you this is for the best – This plugin is really just an install script that follows the same steps you would perform during a manual installation. At the end of the day, this is always a pip install homeassistant – The plugin’s post_install.sh simply does all step required leading up to any finally installing homeassistant – In fact, the only basic difference between this plugin and Installation of Home Assistant on your FreeNAS is was my choice of username and location for the virtualenv –

The provided configuration is nothing special, truth be told, it’s only there because I wanted to have some minimum defaults to test a clean installation.

All it does

  1. Enable packages. Using a package, I can easily add the iframes ( HA side panel links to AppDaemon and File Editor ) without touching any other configuration files.

  2. Provide a way to add your access token for appdaemon, before its installed. This not actually required either – but you will be spammed with endless “login attempted fail” if appdaemon is running and this is not correctly set.

  3. The configurator ( File Editor ) technically does not need any configuration file at all! - but when it’s there, it will provide persistent settings. The access token is optional for the basic file editing, but it’s needed if you want to communicate with the HA api. I use this file to again provide some sane defaults. Most useful is setting that starts in $homeassistant_config_dir when you looking for a file to edit.


In the past, I came at this from the Home Assistant side. This approach seemed OK and was perfectly natural to me because I am a Linux user – That’s why the virtualenv was in /srv/homeassistant and I’m pretty sure I remember, waaay long ago ( I think around days of the AIO install ), hass was even the official username. ( It is still the core program name )

After much debate :roll_eyes: ( Special thanks to @atxbyea @Tinkerer @jkhii for not blocking me on Discord ) I’m finally looking at this from the FreeBSD side.

Clean installs of the plugin will now use sane defaults that a BSD user would expect. The updated service script also includes some fragmented bits that were spread around this plugin and allows more settings via $rcvars. The new service should work for anyone already using some variation of the existing service script.

I’m hoping a guide for the new service script will bridge the gap between this plugin and the manual installation… also providing manual break down of what should be happening, and by reference how preform the same steps manually


Quick Example – This is still pip venv, but using the service, we do not have to always remember about who the user is or location of the virtualenv.

service homeassistant install [CMD]

That is equal to

su - $homeassistant_user
source $homeassistant_venv/bin/activate
pip install [CMD]
deactivate

Typical use cases

  • Upgrade Home Assistant
service homeassistant install --upgrade homeassistant
2 Likes

The thing is, even using iocage console homeassistant (the name of it)

and manually running the senseme python code; it can’t detect any devices.
I then tried the same thing outside the jail ; same deal.

For whatever reason, I can’t get it to work on this freenas box.

I’ve moved the code into a docker container and ran it with a linux host: all working fine.

I then found a spare Pine A64 board ; and ran it there. works fine too.

I would have preferred to have it all running on my freenas, it’s much more convenient. Can’t figure out what’s wrong.

The homeassistant jail was created with the default; I didn’t change a thing.

1 Like