Tutorial: How to use the hub with openHAB 2.4


#1

Dear Developers,

(If you’ve done the other tutorial with openHAB 2.3, then you should have no problem with this one. This tutorial is almost exactly the same.)

(Updated August 13, 2019)

Bindings that have tested working by our users: Mixtile, Nest, Yeelight, Amazon Echo, Xiaomi, Sonos

Mixtile team uses Eclipse SmartHome (ESH) for the hub. If you absolutely must use openHAB on your hub, you can follow this tutorial to install it on your hub. Keep in mind that we don’t have the resources to help you if you encountered any problems with openHAB. This tutorial is written assuming you have experience using the terminal in Linux or Mac systems. Any mistakes you make during the process of this tutorial may render your hub nonfunctional. We recommend you resetting the hub if it is nonfunctional. If you wish to continue with this tutorial, please note that Mixtile is not liable for the damages you caused to the hub.

Method 1: Using a script (# steps: 11)

  1. Make sure your hub is rooted (instruction here)
  2. Download openHAB, openHAB Add-ons, and script to your computer
    a. openHAB 2.4.0 Stable Runtime (download here)
    b. openHAB 2.4.0 Stable Add-ons (download here)
    c. ESHtoOH script (download here)
  3. Create a folder “openhab” on your computer
  4. Put the openHAB file (‘2a’) into the “openhab” folder then unzip it
  5. Put the Add-ons file (‘2b’) into the "openhab/addons’ folder
  6. Open the terminal
  7. Copy the openhab folder and ESHtoOH script to your hub’s home/user/ directory
    a. scp -r openhab user@*yourhubipaddress*:/home/user
    b. scp ESHtoOH.sh user@*yourhubipaddress*:/home/user
  8. SSH into the hub and get root access
    a. ssh user@yourhubipaddress (password is the SN code in the back of your hub)
    b. sudo -i (password is the SN code in the back of your hub)
  9. Go to the /home/user/ directory. (You should see the openhab folder and the ESHtoOH.sh script)
    a. cd /home/user/
  10. Change the mode of the script and run it
    a. chmod 775 ESHtoOH.sh
    b. ./ESHtoOH.sh
  11. Wait about 10 minutes. Open your browser to access openHAB and select the SIMPLE package
    a. yourhubipaddress:8080
    b. Select the SIMPLE package on your first time. You can always change it afterwards.

*To view if openHAB has started: journalctl -u mhub -f

Method 2: Manual step-by-step(# steps: 19)

  1. Make sure your hub is rooted (instruction here)
  2. Download openHAB and openHAB Add-ons to your computer
    a. openHAB 2.4.0 Stable Runtime (download here)
    b. openHAB 2.4.0 Stable Add-ons (download here)
  3. Create a folder “openhab” on your computer
  4. Put the openHAB file (‘2a’) into the “openhab” folder then unzip it
  5. Put the Add-ons file (‘2b’) into the "openhab/addons’ folder
  6. Open the terminal
  7. Go to your openhab folder than copy your openhab folder into the hub
    a. scp -r openhab user@*yourhubipaddress*:/home/user
  8. ssh into your hub then get root access
    a. ssh user@yourhubipaddress (password is the SN code in the back of your hub)
    b. sudo -i (password is the SN code in the back of your hub)
  9. Stop the mhub
    a. systemctl stop mhub
  10. Go to the the userdata folder in openhab then copy 3 files from your current mhub folder
    a. cd /home/user/openhab/userdata
    b. cp -rf /opt/mhub/userdata/openhabcloud .
    c. cp -rf /opt/mhub/userdata/refreshThing.json .
    d. cp -rf /opt/mhub/userdata/uuid .
  11. Create 2 secure links to locations and jsondb
    a. ln -s /config/mhub/userdata/locations/ locations
    b. ln -s /config/mhub/userdata/jsondb/ jsondb
  12. Go to the addons folder and copy mixtiles addons to the addons folder
    a. cd ../addons
    b. cp -rf /opt/mhub/runtime/concierge/system/org.eclipse.smarthome/com.mixtile.hub.* .
  13. Go back to the folder with openhab and give access to mhub.
    a. cd /home/user
    b. chown -R mhub. openhab
  14. Go to the opt folder then rename your old mhub folder to mhub-back (This way you can always switch back)
    a. cd /opt/
    b. mv mhub/ mhub-back
  15. Then copy the openhab folder this folder with mhub name
    a. cp -rf /home/user/openhab/ mhub
  16. Give ownernship access to mhub
    a. chown -R mhub. mhub
    b. chown -R root. mhub/userdata/openhabcloud
    c. chown root. mhub/userdata/uuid
    d. (To see the ownernship of a file) ls -l
  17. Go to the system folder and edit the ‘mhub.service’ file with vi
    a. cd /lib/systemd/system/
    b. cp mhub.service mhub_back.service (make a backup so you can always return to it)
    c. vi mhub.service
    d. (how it should look like after you edit it)

  1. If you followed all the steps above correctly, you should be able to start the service. To start the mhub.service, write the following commands
    a. systemctl daemon-reload
    b. systemctl enable mhub.service
    c. systemctl start mhub.service
  2. Wait about 10 minutes. Open your browser to access openHAB and select the SIMPLE package
    a. yourhubipaddress:8080
    b. Select the SIMPLE package on your first time. You can always change it afterwards.

*To view if openHAB has started: journalctl -u mhub -f

Method 3: Follow a video(# steps: 19)

1. Video Edition Starting from step 7(Unedited): [Link here](https://www.youtube.com/watch?v=JnOYtWGkI6c)

Issues

  • If you followed all the steps and it didn’t work, you can try (thanks @2Fast2BCn)
    chown mhub.mhub -R /opt/mhub
    chmod 775 -R /opt/mhub/*
    systemctl stop mhub
    systemctl start mhub

  • When you’re first starting openHAB, make sure to select the SIMPLE package. I ran into an issue where none of my things become initialize if I pick other packages. To change to another package, edit the addons.cfg file in
    /opt/mhub/conf/services# vi addons.cfg

What it should look like

image

If at any point you want to go back to Eclipse Smarthome (ESH), you can either factory reset your hub OR do the following steps

Or manually

  • Stop the mhub.service
  • Rename the current mhub folder to mhub-OH and rename the mhub-back folder back to mhub. (see step 14)
  • Rename the mhub.service to mhub_OH.service and change mhub_back.service to mhub.service
  • Start the mhub.service (see step 18)

#2

@saugstauber @TiNePaS @Gabriele_Castiglioni @donut


#3

Many thanks for your effort, really.
But I call myself out of this.
I had trashed the hub weeks ago.


#4

Sounds promisingm thank you for your work. Once switched to openhab, do the mixtile bindings (e.g. Aquara) still work?


#5

Hi GeKo,

The Mixtile binding does work. Other bindings that have been tested working: Nest, Amazon Echo, Yeelight, Xiaomi mi home.

Bac

Mixtile Team


#6

Hi @Bac ,

thank you for the tutorial!
I tried to follow all the steps in exactly the same way as your described it. Unfortunately, I can’t start the mhub.service at the end:

Any idea?
I did already check all the permissions and the mhub.service file twice…


#7

Hi,

Did you edit the mhub.service file correctly? I haven’t encountered the issue you have before, but I found a openHAB user having a similar issue

every time you edit the service file, you have to do systemctl daemon-reload

Bac


#8

Hi Bac,

this is how my mhub.service looks like:
Unbenannt

I did always perform the commands in the given order: daemon-reload -> enable mhub.service -> start mhub.service

Permissions should be fine as well:
Unbenannt


#9

The mhub.service file is correct! I’m not sure what the issue is. Have you tried following my video tutorial?

Unrelated to the issue, why is your openhab-addons-2.4.0.kar file inside the mhub directory. It should be inside mhub/addons


#10

Thanks for your help, I did now watch your video and tried to redo all the steps. Looks like I did everything accordingly, except copying the openhab-addons-2.4.0-kar in the addons subfolder - which I did now :wink:

Furthermore, I noticed the ownership of openhabcloud and uuid beeing to mhub instead of root:


Fixed now, too:

Nevertheless, I still can’t get openhab running - same error:

What I noticed in your video, after you enabled mhub.service, there was a message about created symlink, which I did not get (video min. 9:30). Can this be a hint? Or are symlinks only set at the first time I enable mhub.service, so it might have gotten created in my first try some days ago?


#11

The symbolic links are created the first time you enable the mhub.service. I’ve looked around on the openhab forums, it looks like that the problem seems to be with service file. Yours look exactly like mine. Maybe the openhab folder wasn’t completely moved to /opt/ directory?

If it’s not too much trouble, could you try factory resetting the hub then start over with this tutorial. If you could record the process as well, it will be great.

Bac

Mixtile Team


#12

Hi Bac,

I did the reset, downloaded the files again and did all the steps. Please find the video (two because of screen recorder limitation) here:


Unfortunately, it was exactly the same result as previously…


#13

In the first video, there seems to be an issue with copying the openhab folder to /opt/ directory.

In the second video, you seemed to have copied it over successfully, but you forgot step 16A. All the files in mhub are still ‘root’. Try to re-do step 16

a. chown -R mhub. mhub
b. chown -R root. mhub/userdata/openhabcloud
c. chown root. mhub/userdata/uuid

Then start mhub. Let me know if it fixes the issue.


#14

Hi Bac,
thanks for still standing by me!
I did all steps from 16 again, indeed the permissions of mhub folder were not set properly. Now they are, but same result:

Is there anything I can still try to do?


#15

Hi,

I really want you to get it to work, but I’m not sure where the issue is. I searched through the openHAB forum, but couldn’t find any answer except that the service file is pointing to the wrong directory. But yours look correct!

I’m sorry I couldn’t help :frowning: Maybe you can try to search in the openHAB forum.

Bac


#16

I did try it again today - download everything again, reset the hub, follow every step to the end. Nevertheless, exactly the same result…

Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Main process exited, code=exited, status=203/EXEC
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Control process exited, code=exited status=1
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Unit entered failed state.
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Failed with result 'exit-code'.
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Service hold-off time over, scheduling restart.
Jul 16 16:13:16 MixtileHub systemd[1]: Stopped The openHAB 2 Home Automation Bus Solution.
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Start request repeated too quickly.
Jul 16 16:13:16 MixtileHub systemd[1]: Failed to start The openHAB 2 Home Automation Bus Solution.
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Unit entered failed state.
Jul 16 16:13:16 MixtileHub systemd[1]: mhub.service: Failed with result 'start-limit-hit'.

OpenHAB forums indicate at most time a wrong service file, which is correct in my setup…

I will let it be for the moment. Maybe after a new openHAB or Mixtile Firmware release I will give it the next try.
Thus, I really appreciate your help, Bac!


Use as a Z-Wave secondary controller + HomeKit Gateway
#17

I have updated the tutorial with a couple script to automate the process. I was able reproduce your issues on 3 hubs yesterday. Our Wi-Fi network was really slow yesterday. Copying openHAB to the hub took a long time. After running the script, it would produce the 203 issue.

Today, our WI-Fi network works fine. After resetting the hub and re-running the script, openHAB was able to run fine.

Bac

Mixtile Team


#18

Is it working for you in the meantime? I tried to install OH 2.4 as well, using the first method with the script. And I have the exact same error. And no… it is not related to the WLAN Speed at all.


#19

Unfortunately not yet, but I have to say that I did not retry it in the last weeks.
All the times I tried it via LAN connection, so WLAN can’t be a problem for sure.


#20

@GeKo @saugstauber

Sorry guys. I’m not sure where the problem is. I assumed it was the WLAN issue since I had this problem when the WLAN was not good.

Bac

Mixtile Team