Zigbee and zwave manual install script

A number of people have run into trouble performing manual installs of the Zigbee and Z-Wave bindings. A manual install (dropping the jar into addons) is rarely needed, but some people prefer a manual install over apt-get, or want to use a stable OH release with a recent Zigbee or Z-Wave binding. Here is a script that will hopefully make it easier to install, upgrade, and uninstall these bindings, and prevent some of the common issues.

Who would benefit from this script:

  • Anyone wanting to test development versions of the Zigbee or Z-Wave bindings before they are available in a snapshot or milestone build. If this is the case, then you are likely working closely with Chris to resolve and issue or implement a feature.
  • Anyone wanting to remove a manually installed Zigbee or Z-Wave binding. Itā€™s easy to delete the jar, but OH may have cached the bundle, which then needs to be uninstalled through the Karaf console.
  • Anyone wanting to install the openhab-transport-serial feature. This needs to be reinstalled after an OH update or after clearing the OH cache, if youā€™ve manually installed one of these bindings. Iā€™ll typically just run this script to update the bindings after updating OH, which will also installs this feature.
  • Anyone who wants to use a manual install of one of these bindings, but doesnā€™t know where to download them.
  • Anyone wanting to automate the upgrade of a manually installed version of these bindings.

More details in the readme.md, including the steps to manually install the Zigbee and Z-Wave bindings. I have tested the script quite a bit, but feedback from others would be much appreciated! Reminderā€¦ if you install/upgrade/uninstall the refactored Z-Wave binding, donā€™t forget to delete and rediscover your Things to pick up any updated Thing definitions!

Note: the development Z-Wave binding has been merged into the master branch, so if using this script, only choose the development version for Z-Wave if Chris instructs you to do so (he may throw a test jar out there).

Donations are very much appreciated! :beers:

16 Likes

A small suggestion.
Explain in details what this script does (or suppose to do). Help people, thats always nice. But what if something goes wrongā€¦ Then itĀ“s nice to know, what was suppose to happen.

Iā€™m guessing you havenā€™t looked through the readme or script, because there is a lot more information in both. I didnā€™t think it was necessary to duplicate that information in this post. I plan to include steps to perform the manual installs in the first post, but Iā€™ve been sitting on this script a while and wanted to get it out for people to be able to use. And hopefully save @chris some headaches! As I noted in the readme, there is currently very little error checking. If people are using the script and running into errors, Iā€™ll likely add some. If the script fails, the worst thing that will happen is that youā€™ll need to log into Karaf to uninstall any old binding(s) and install the serial transport, remove any old jars, download the new jars, and copy them into addons. Exactly as you would need to do if installing them manually. This is still a WIP!

1 Like

YouĀ“re right, I didnt look through the readme or the script, sorry!.
I just thought a small note regarding what it actually does would come in handā€¦ But I see now all info is in the readme.

@chris, what would you like done with the development branch options? The zwave one is dead, at least for now, and the bintray never seems to have anything newer than Cloudbees for zigbee. I could make a note to note use them, pull them out completely, or make them into a custom option that points to your server so you can get some test bindings pushed out.

Removing the option is easyā€¦ :wink:

For ZWave, it can be removed. For ZigBee, it would be normal to have newer libraries in bintray than in the TP. The libraries are updated every couple of weeks, but Kai doesnā€™t want the TP updated too often, so this is likely to be every 2 to 3 months. I would therefore expect that this would still be useful where we flow some change into the core libraries, but the TP isnā€™t updated yet.

Having test bindings on my server is something I might do occasionally in special circumstances (eg maybe I want to temporarily add some heavy debugging, but donā€™t want to actually put this into github), but I prefer to avoid it if possible. Having an option for this though might be useful as I know it can confuse people.

Thanks for providing this.

Hi @5iver,

I noticed this on GitHub

This script is interactive and will prompt for input. It requires to be executed from the addons directory on the openHAB server, using the same account that runs openHAB . A

Is this account typically openhab?

Regards,
Burzin

Yes. The script will let you know if you are using a different account to make sure you know what you are doing.

I seem to be doing something wrong.

Iā€™m trying to run:

sudo -u openhab bash /usr/share/openhab2/zzManualInstall.sh --ACTION zwave --ZWAVE_BRANCH development
Querying configuration parameters...
mkdir: cannot create directory ā€˜/home/archiveā€™: Permission denied
mkdir: cannot create directory ā€˜/opt/openhab2-backupā€™: Permission denied
mkdir: cannot create directory ā€˜/home/archiveā€™: Permission denied

Downloading latest jar...
mv: cannot stat '/opt/openhab2/userdata/logs/zwave/zwave.log': No such file or directory
cp: cannot stat '/opt/openhab2': No such file or directory
diff: /opt/openhab2: No such file or directory
diff: /home/archive/20181008_230008_openhab2_full/openhab2: No such file or directory

Full backup successful...

Next step is to remove unneeded files. Do you wish to continue?
1) Yes
2) No
#?

What am I doing wrong?

Is this the path where you have your addons ??
I believe the script should be place in the same folder where your addons are located.

1 Like
  1. You are running the backup_and_update.sh script.

  2. You should not select the Development Z-Wave branch, since it has been merged into Master. The discussion above with Chris was in regards to removing the option from the script.

  3. You are not following the instructions in the README.

It requires to be executed from the addons directory on the openHAB server, using the same account that runs openHAB.

@stephanSH, Iā€™m replying here, to keep the Zigbee thread cleaner. Iā€™ve gotten very little feedback on the script, so this is helpful. Iā€™ve been using it successfully for a while, but recently Iā€™ve noticed a couple of issues, likely from OH changes, and plan to clean them up. To address your concernsā€¦

Iā€™ll mention the requirement of curl in the readme, and maybe add a check in the script and message that curl is not installed. Although, I could also use wget. Is that installed by default?

Iā€™m not sure what you meant by this, but assume the context was in the other thread. Are you using the script with arguments? Iā€™ve only been using the menus.

This should not have happened, and does not occur for me. Iā€™m specifically removing any old versions, as having more than one installed will cause a lot of issues. Were there any errors when the script ran?

This definitely should not have happened. Iā€™m thinking the script may have had an error and did not complete. Did you get a message saying it completed successfully?

How are you adding it to the addons.cfg? TMK, this is not possible, but you could be adding the serial binding, which will also install the serial transport. This is what Iā€™ve done, since I was tired of installing it after every OH upgrade (I use snapshots).

Hi scott, thanks for your detailed replies.
I am relatively new to OH so the script was a great help for me and I only wanted to help others with my notes:

  • curl is fine - great idea to add it to the readme. wget is installed by default in ubuntu server 18.04.1
  • following the readme section I thougt I had to insert this value (1.1.7) in the script so chris helped me with the actual version and I thought others might be interested. I used the script with menus but changed that value before
  • the necessity for removal might be explained by the installation of the zigbee binding through PaperUI. I had one error (unfortunately I donā€™t remember exactly) but the script continued and afterwards it gave me a ā€œcompletely successfulā€ so I was just happy:-)
  • I added binding = serial1 in the addons.cfg - so after your explanation this is probably the binding. For me it had the same effect as the karaf command

I also use snapshots - but my actual problem is that the mqtt binding is updated which means a lot of work to change many item, but that is another topicā€¦

Glad it helped! And thank you for the feedback. I havenā€™t heard much, so assumed nobody was using it, or it was working well. Itā€™s worked fine for me until recently (the zwave binding gets upgraded but jasnā€™t been starting).

The current version should be read in from the repos. If you choose Development, this is displayed as the default, but can be changedā€¦

Occasionally, the build servers are not accessible, or you could have an Internet issue. But I think when this happens, the script will error. The script wold benefit from more error checking, to at least message the user when there is a problem like this.

The script will remove manually installed jars, and bindings installed through Paper UI or Karaf. It sounds to me like the script was not able to get into Karaf when you ran it. This would have prevented the uninstall and installation of the serial transport. Is there anything peculiar to your setup? Are you sure you ran it with the account that runs OH, and entered the correct password?

The older mqtt binding is still available. If you have modified the binding line in addons.cfg, youā€™ll need to change it to mqtt1.

I believe many had used the scripts as chris had recommended them several times to solve problems. I donā€™t use zwave - so I had no problems.

great hint for future uses

That might have been the problemā€¦ I used it with sudo bash -u openhab ā€¦

Yes, I found it, but I donā€™t believe there is further development in the future so I will have to change it in the futureā€¦

Hi @5iver
IĀ“m trying to run your script on a new setup (new Rpi with only one binding running). I discovered I could use it to install the transport-serial-feature.
But I get this error (Karaf). And i can not see if the transport-serial feature got installed.

This script is capable of downloading and manually installing the latest developme                                                     nt or master branch builds of the Z-Wave and Zigbee bindings, and/or the openhab-t                                                     ransport-serial
feature. The script must reside inside the addons folder and be executed on the ma                                                     chine running OH. Before a binding is installed, any previous versions will be
uninstalled. Any manually installed versions will also be backed up by moving them                                                      to addons/archive. The installation of any binding will also include the installa                                                     tion
of the opemnhab-transport-serial feature. After using this script, you can uninsta                                                     ll the bindings by deleting their jars from addons or you can use this script.\033                                                     [0m

!!!!! If you have manually added the Zigbee or Z-Wave binding to your addons.cfg f                                                     ile, they must be removed from the file or the old version will reinstall !!!!!

What would you like to do?
1) Install or upgrade Zigbee binding
2) Install or upgrade Z-Wave binding
3) Install or upgrade both bindings
4) Install the openhab-transport-serial feature
5) Uninstall Zigbee binding
6) Uninstall Z-Wave binding
7) Uninstall both bindings
8) Exit
#? 4

     *****     SUMMARY     *****

Addons path: /usr/share/openhab2/addons
OH account: openhab
Requested action: Install the openhab-transport-serial feature

Is this correct?
1) Yes, start now                      3) Exit
2) No, take me back to the first menu
#? 1

Installing openhab-serial-transport...
mkdir: cannot create directory ā€˜/usr/share/openhab2/userdata/tmpā€™: No such file or                                                      directory
KARAF_BASE is not valid: /usr/share/openhab2/userdata

Complete!

[12:11:25] openhabian@openHABianPi:/usr/share/openhab2/addons$

Sounds like your permissions may be an issue. How are you launching the script? Can you please try getting into Karaf using /usr/share/openhab2/runtime/bin/client?

1 Like

I really hate these permission issues in Linux :face_with_symbols_over_mouth:

IĀ“m not sure how to do that or what you mean :frowning:
I normally enter Karaf by first entering a terminal using openhabian client. And the from the terminal using ssh -p 8101 openhab@localhost. From there IĀ“m promted to write the pw for openhab, which works fine. And then IĀ“m in Karaf.

Just enter the command from an openhabian terminal, instead of using ssh.

Ahhā€¦ I thought it was a pathā€¦ Anywayā€¦ ItĀ“s working just fine:

[13:26:34] openhabian@openHABianPi:~$ /usr/share/openhab2/runtime/bin/client
Logging in as openhab

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.4.0
                               Release Build

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab>