Inspiration for OpenHAB 4 Auto Installer

  • Platform information:
    • Hardware: Any
    • OS: Debian / Ubuntu - any APT based
    • Java Runtime Environment: 17
    • openHAB version: 4.x
    • The topic: Prototype of automated installer on basic Linux, without constraints of OpenHABian

I am so glad to announce my new automated OpenHAB 4 installer on GitHub

It is symply comands that i usually ran manually packed together with some isstructions.

I have bashed :grin: together a Simple APT based bash script written from OpenHAB docs

It installs Java 17 and OpenHAB 4

I have seen all the talks on OpenHABian being hard to install, than use a basic linux instead, and install openhab there.

I also found openhabian more intimedating to set up as i donā€™t know it well, but i donā€™t even complain about it.

I prefer this manual install form begening, i exactly know what is going on and in no time openhab is running on localhost:8080, no trouble with redirects and certs and any nonsense.

I agree that copying all the commands from docs, gets old fast.

So read through my script to make sure it runs safe commands as on openhab docs.

Now you should first try it out on testing systems only, and be cautious, to not mess up any working systems. Should be safe to use for new installations.
I do not take responsibility.

Now here is my link to GitHub:

Have Fun
Matej

2 Likes

What do you mean by ā€œall the talksā€? Lots of people install openHABian without too much issue. Thereā€™s definitely room for significant improvement in the docs, and weā€™re actually working on that right now. Why now? Because someone raised the issue in a constructive way and inspired positive change.

I donā€™t mean that as a criticism of you for not saying anythingā€“there are lots of times when Iā€™ve done the exact same thing. However, Iā€™m reading a lot of negativity toward openHABian in your post, and it feels like itā€™s because you never managed to get it running in the first place and perhaps didnā€™t ask for help.

Since Iā€™ve volunteered to rewrite the openHAB documentation, Iā€™d particularly like to know what you mean by this:

Can you be more specific about the constraints? That would help me to see your point of view when Iā€™m trying to frame information for new users. Sometimes, one personā€™s benefits are another personā€™s constraints, and itā€™s hard to see from the other side.

None of this is meant to shoot down your installation script. If it works for you and someone else, great. But if youā€™re going to tell people that itā€™s better than openHABian, then I think you need to make reasonable comparisons instead of just dismissing openHABian as ā€œnonsenseā€. Especially if youā€™re going to end with:

It kind of reads like:

  1. Hereā€™s my solution thatā€™s MUCH BETTER than openHABian forā€¦reasons.
  2. But whatever you do, donā€™t use it for a production system.
  3. And donā€™t blame me if it doesnā€™t work, even though I made it, shared it, and encouraged you to use it.

I donā€™t want to turn this into an argument. Iā€™m more interested in having a conversation about your frustrations and using that information to improve the openHABian documentation.

4 Likes

I like your attitude, thanks for pointing out politeness, it brought me a smile while reading. I see that my wording needs improvement.

I want to say Openhabian can be improved, here is the inspiration for how i do it manually, not to compete or shine a black light on it.

My script is new, so i encourage caution to first test script on spare system, before using it on production systems. How can i guarantee that it runs perfectly for everyone if only i tested it.

Openhabian is the only GUI targeted install solution so it isnā€™t nonsense, but the users get intimidated as they still require to use comands.
The isues that i faced failing to install openhabian can be mitegated by installer falling back to previous stable vsersion as user has no idea what version to choose instead.

The constrains, for raspberry the option to choose desktop w.o. manual installation, for remote management of the system, HA has indeed almost all in web UI so there is no need for desktop, like system management and config writing.

On linux PC many new users like to install by clicking on a program, so the openhabian may benefit from packing the commands in a script to make a wizard like i did and be less intimidating to start.

The main thing in linux, that helps new users is a set of icons(scripts) to press in a folder to spin up required tools that explain what they do to teach as they go and run commands like install, service restart, backup and openhab config tool.

A short cheat sheet on what tasks to do to get started and how to fix/ install diferent stable version is usefull in a short txt file.

The openhab docs are really long, detail is good for understanding, but i guess subsections named by topic that open up with + would clean up the docs to have less scrolling, the menu at top of article may require pointing out mandatory topics to get started with underlining.

I hope i hepled a bit :smiley:

2 Likes

Great thanks for sharing, always good to have people giving back and sharing.
I have done the same and test it only under Armbian with an Odroid N2+ which is also called Home Assistant Blue by some people.

You can find it linked below and feel free to help each other out by checking if stuff is broken due to an external program changing a config syntax like frontail or any of the other extra stuff to setup after openhab is running.

ARMBIAN is Debian based like Ubuntu so I would expect most of it to work for you. The Java will not as itā€™s for ARM64. There are differences in how an operating system may setup default ZRAM settings, and the testing and finding issues that stem from assumptions made is a huge task to apply a script to PI, odroid arms, and also x86 under Ubuntu.

That probably is because openhabian is only tested with Raspberry Pi products under one OS and the author is using x86(?). The docs state you can use it on untested hardware and also outlines hardware fake modes, then goes on to say no support. I can recommend openhabian highly for those using a PI, but I can not recommend it based on past experience trying to use it on Ubuntu and x86. It has improved a lot and there are multiple people working on it now so my thoughts are probably wrong and outdated, I suspect not, if someone has created another script.

Openhabian also states you can do X, but donā€™t do it and we donā€™t support it. Paraphrased it, but I am sure you get my point.

It is a huge task to keep a script running 100% when it does as much as openhabian does on a single set of hardware, it would be a full time job to keep it running and tested under multiple hardware and opperating systems.

So why create a script? THE answer to this is In six minutes I can fully rebuild my openhab setup with an automatic script and know it is exactly as I want it to be. Each time I have to adjust my system the script gets updated.

2 Likes

Iā€™m glad. Debate is great, arguing is not. I admittedly came back after posting to edit where I thought I was too negative.

My take is that youā€™re not the intended audience for openHABian, and thatā€™s an issue with the docs that Iā€™m hoping to rectify. I donā€™t want to get too far ahead, because Iā€™m still researching and making notes, but weā€™re really aiming to help the new user who just wants to put openHAB on a Raspberry Pi with a minimum of fuss.

Thatā€™s clearly not you, in which case youā€™re not going to like the ā€œopenHABian on other platformsā€ experience. As @matt1 says:

Weā€™ll still have instructions for installing openHABian on other Linux platforms, but it will be more of an afterthought and come with less of:

Weā€™re also going to try and separate out some of the things that true beginners donā€™t need to worry about when theyā€™re installing. Choosing between Stable/Milestone/Release Candidate is a good example, because very few new users need to mess with that.

Note that Iā€™m only working on the documentation on the website. Maybe itā€™ll result in some improvements to the installer, but thatā€™s not my specific goal.

Absolutely. Does what Iā€™ve written (with @matt1ā€™s help) make sense to you?

Iā€™m not getting that. Please tell us what Linux system exactly you use, give the exact URL pointer to the install instructions you refer to and explain why you think these are intimidating.
Because you need to enter them rather than just click some icon?
Sure you could put them in a script. But frankly itā€™s just a handful oā€™ commands to copy n paste to get the installation going on x86 Debian systems thatā€™s the most simple part, all the real work is done in the openhabian-config script. That is not only the config tool to use interactively but also the installer script itself which will then do all the apt install and config modifications.
Thatā€™s where all the work is done. That is the wizard you are talking about.
You donā€™t have to replicate that in another script of yours you can simply use it.

That Iā€™m not getting either. There is no such constraint!? you can manually install whatever you want on top of openHABian.
Or keep using what you had installed yourself before you add openHABian.
You just donā€™t need stuff like an X server to operate openHAB but of course you can keep using your X desktop on the same machine.
Please explain where you believe there is a constraint and how you think this is limiting you. Iā€™m sure thatā€™s just a misunderstanding Letā€™s identify the precise bit of information within ā€œall the talk on openHABianā€ that lead you to wrongly believe there is a constraint so we can clarify that in the docs

Home Assistant does not do any OS and system management at all nor does it provide any 3rd party tools. HA equals openHAB not openHABian. Compare apples to apples please.

Now let me clarify, I am using Opehab on an Intel mini PC, running Peppermint 12, it is based on Debian 12.
I installed first OH, 4 years ago, back then I first chose Linux over Windows cause of its stability when running.
I installed it manually and it seemed reasonably simple, no errors, even tho i expected to be available on Debian repo, so i could just call ā€œapt install openhabā€.

Here docs lack how can i configure to disable pre-downloading all addons, i need 5 addons not 200+

Today I intentionally spun up a new Debian VM and tried installing OpenHABian, i got it working but with errors, it gave me 2 messages that didnā€™t sound reassuring, it never said success installed go on web portal now, like it does on manual install.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤ Frontail not installed ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
   ā”‚                                                                              ā”‚ 
   ā”‚ Frontail is not installed!                                                   ā”‚ 
   ā”‚                                                                              ā”‚ 
   ā”‚ Canceling operation!  

The installation took like 40 minutes cause I didnā€™t get asked if I wanted all the addons and it installed 400MB of stuff i mainly donā€™t need.

The only good inspiration is this zram for logs if i recall right, so the disk isnā€™t getting hit so hard, I like that.

The errors regarding dependencies in Linux are intimidating for new users, if dependencies missing itā€™s hard to fix or it ant running properly.

I am a beginner on the OpenHABian side of the installation and the config file i see is intemedating for new users, if needed to config anything besides setting names and wifi, like disable preloading add-ons .

Regarding desktop i am sure new users dont know how to install desktops on bare linux first day, it aint hard i did it few times, but a config option to choose a desktop is friendly for new users, i never like to run linux without desktop, when i have a desktop i tend to get work done faster with less command line shuffling, using multi-windows, VS code onboard and Remote Desktop to manage OH in remote country and such.

Here i mean the user experience of HA install, you throw on a VM or Raspberry imahe
it loads and starts using Web UI no install needed, all config on WEB no Linux fuss.
Now i prefer OH for managing devices as i have full control over sth like MQTT devices from connection onvards i understand it, whereas HA it just works or it doesnā€™t.

HA has all the apps on there for backup and VPN, and stuff that runs on HASS OS I meant. It supports snapshots, restarting services, restarting machine and such, the only parallel that supports some of it is the Openhabian console, and some is supported by karraf console on basic OH.

I may not be experienced enough regarding OpenHABian to give any more details. So i just explained my todays experience and I prefer to finish the discussion around OpenHABian.

Thanks Matt, to emphasize with me, i meant to help and give options, :smiley: and all the questions i got i didnā€™t expect, i mentioned OpenHABian just as it does similar things, as mine is less complex to run on x86 systems.

OUT OF TOPIC ā€“ Planning new topic
I am planning new discussion on different topic that is deciding if i keep working on OH for scaling OH to business levels:
I make devices with ESP32 MCUs like greenhouse controllers and measurement equipment with 50+ data points.

Developing Arduino MQTT Librrary for autodiscovery integration probably on HA autodiscovery protocol, as manual config is becoming time-consuming. I found no good docs on how to program that protocol on Arduino, theres no universal HA library?

And InfluxDB database data handling issues, how do i eliminate heavy loads on CPU (lower data count to process) while calculating the average or sum of value per week, month, or year?

When topics will be published welcome to chime in.

Timeā€™s up, cheers

Matej

Hi Matej,
I understand your approach very well as I have done this decision about 4 months ago, too.
I was about to write a script which applied changes to my need on top of a freshly installed openhabian image, like

  • reinstall raspi-config which is uninstalled during openhabian setup
  • change rc file which prevents starting raspi-config
  • deinstalling zram
  • add packages automatically which I would have to install manually with openhabian-config
  • set further options
  • set IP address
  • etc,ā€¦

until I realized after I had a closer look that the effort of writing an installation script like yours on top of a native rpi image will be almost the same.
The only true advantage for me was that openhabian installs frontail which was a little bit tricky to install manually/by script.
Furthermore I noticed that an rpi-image was faster than openhabian image in terms of the first run rule delay problem.

Letā€˜s see what the feedback of your approach is, maybe there are some more who want to make use of this approach or some more who think the same way and then we could start join our forces to work on a more comprehensive script.

Hey Oliver

Thank You for your nice feedback, i appriciate that you see the value of my approach. :smiley:

I agree there are options for adding further config that users can choose to enable, like SMB sharing and more, for now i started on simplicity and essentials.

Best,

Matej

V pet., 8. mar. 2024, 19:41 je oseba Oliver via openHAB Community <bot@community.openhab.org> napisala:

openHABian is documented to not work under Ubuntu. They do something different from Raspberry Pi OS which breaks the scripts.

@rpwong is working on an overhaul of the docs to address these types of concerns.

Over the years there has been a continuous barrage of people pounding on openHABian trying to do X or Y with it, ultimately stretching it beyond what it can do. As a result the docs have become extensive and the configuration which receives active support has narrowed.

Thatā€™s why I use Ansible. Only this applies to all of my machines, not just openHAB. And pushing out common changes to all the relevant machines or updating/upgrading all my machines is a single run of a playbook. I configure nothing by hand any more.

Thatā€™s a 32-bit/64-bit issue most likely. You downloaded the 32-bit openHABian image but installed the 64-bit rpi-image so it wasnā€™t an apples to apples comparison.

No, it wasnā€™t. I was testing with openhabian v1.9beta

which comes in both a 32-bit and 64-bit versions with the 32-bit being the default version.

Not sure what you mean by default version. Each version has its own seperate image file (like openhabian-64-latest-202311211558.img.xz)

I just tried using openhabian to install frontail and it failed for me. I have a script I have used for a while here and to use it you do thisā€¦

wget www.pcmus.com/openhab/scripts/install-frontail.sh
sudo bash ./install-frontail.sh

I have tested this under openhabian image and also armbian. You can open the xxxx.sh file and read it in any text editor.

If it works, you will have it added to ā€œThe Other Appsā€ sidebar dashboard launcher, like this picture showsā€¦

Hi Matt,
thanks for helping.
I wasnā€˜t clear in my post. I have already written a comprehensive script for my installation (and it also covers frontail).
See here for my function to install frontail:
https://community.openhab.org/t/unable-to-install-frontail-on-fresh-install-oh-4/153751/11?u=oliver2

Itā€™s the first link in the list to download. Furthermore the docs until very recently stated:

RPi 3 and 4 have a 64 bit processor and you may want to run openHAB in 64 bit. Be aware that running in 64 bit has no relevant advantages but a major drawback: increased memory usage. That is not a good idea on a heavily memory constrained platform like a RPi.

Because of the first run issue with JS Scripting rules, the language has been softened a bit to:

Use the 64 bit image versions but please be aware that 64 bit always has one major drawback: increased memory usage. That is not a good idea on heavily memory constrained platforms like Raspberries. If you want to go with 64 bit, ensure your RPi has a mimimum of 2 GB, 4 will put you on the safe side. You can use the 32 bit version for older or non official addons that will not work on 64 bit yet. Note thereā€™s a known issue on 32 bit, JS rules are reported to be annoyingly slow on first startup and in some Blockly use cases.

Note that after several months of effort and many contributors, the only cause for a slow run of JS Rules on the first run is the use of 32-bit Java. Therefore itā€™s reasonable to assume that if you had a slow first run on rules in openHABian but not when you installed it yourself, either you installed 32-bit openHABian or a 32-bit Java.

I understand that you come to this conclusion.
However, I installed 64bit bookworm and 64bit JRE in both scenarios.
The difference wasnā€˜t huge. Non-openhabian has a delay of less than a second and openhabian had 2-3 seconds. I have mentioned this in a post but canā€˜t remember when/where.

When you install openHAB through openHABian or through apt or yum you end up with the exact same openHAB installation. All openHABian does is call apt to install openHAB.

So assuming you saw a performance difference and you are certain it was 64-bit, the only other variables that could make this type of difference are:

  • you installed a different Java than openHABian does and the one you chose has better performance on your specific machine
  • you had RAM issues with openHABian because of the other services openHABian installs and the RAM openHABian takes for zram (i.e, you were using swap on the openHABian install)

All that openHABian is are a series of bash scripts that install and configure things. Nothing more.