|
Post by papa on Jun 2, 2018 18:27:14 GMT
IntroductionAnother thread gives my comparison between installing on Windows & Linux & my case for configuring OpenHAB 2 (OH2) with text files instead of PaperUI. For me, Windows & Linux installs each have advantages & kinks. For me, a Windows computer is a decent platform for OH2/Mosquitto & the Arduino IDE. A Windows or Linux laptop's additional advantage is built-in battery backup. OH2 can accomplish some things without setting up additional devices. To take best advantage, one needs to buy or build devices and configure them. Other forum threads give examples. My thread, Building an RFM69 Home Automation Network (Beginners ??), leads you through building a Gateway & Node that use RFM69 radios to communicate with OpenHAB.
While one waits for devices & parts to arrive, one might install OH2/Mosquitto. This thread on a Windows install continues my attempts to help others get started with this DIY Home Automation project by lowering "speed bumps." It's based on a Windows 7 install of OH2 a few months ago & a very recent Windows 10 install of Mosquitto MQTT message service. PS I picked Windows because I'm more confident with it & maybe there are less docs for Windows installs of OH2. In the future, I plan a Linux version of this thread.
Next, Overview of OpenHAB2 / Mosquitto Install on Windows OR Linux
|
|
|
Post by papa on Jun 2, 2018 18:29:04 GMT
Overview of OpenHAB2 / Mosquitto Install on Windows OR Linux I divide the OpenHAB 2 (OH2) installation process steps into
1a) Satisfy the OpenHAB prerequisite (Java version 8)
1b) Install the Mosquitto MQTT message service on the chosen compatible computer
2) Install the OpenHAB platform on the computer
3a) Install the OpenHAB add-ons needed for our forum's Home Automation projects (actions, bindings, persistence methods, transformation, User Interfaces, Misc, Voice) These add to OpenHAB's abilities. 3b) Configure the OpenHAB items, rules, & sitemap needed for our forum's approach to Home Automation.
For after all the above & or at any point, I have a script (.bat file) to test how well your OpenHAB / Mosquitto is set up for DIY Home Automation. At any point, I believe it can show you what you might still need to accomplish. It can generate a report file that you could share on this forum to get help. This post below has that script. Note: Items 1a), 1b), & 2) could be done in any order, but if not accomplished could interfere with results from 3a) & 3b). (Later pieces often depend on actions in earlier steps. Often before a 3b configuration can happen, something else must be done in a 3a install / configuration.) Concerning the above steps, the following posts provide more help for some installation steps than others. I find this official OH2 documentation helpful for me & for this forum's DIY Home Automation project. Again, my main disagreement applies to steps 3a & 3b. I also believe official docs could provide tools to help set up & troubleshoot OH2 & I will offer some for Windows in this thread & I hope for Linux in a later thread. Next, Step 1a) Windows OH2, Satisfy the OpenHAB Prerequisite (Java version 8)
|
|
|
Post by papa on Jun 4, 2018 15:46:50 GMT
Step 1a) Windows OH2, Satisfy the OpenHAB Prerequisite (Java version 8) Updated, Jan. 20, 2019
See what version of Java (if any) you have on your Windows computer: In the search box of Windows Start Button or Cortana, enter cmd. In the resulting window, enter: java -version. On one windows computer, my current results are "openjdk version 1.8.0_163" ... Zulu" ... Ignore the "1." "8" means Java 8. 163 is the "build." For now, we need a build higher than 161. If your Java is less than Java 8, build 161 ... I recommend you replace it & any other Javas you might have: In the search box of Windows Start Button or Cortana, type programs & at the top select Programs and Features. In the resulting window, scroll to your Java install(s). Right mouse click on each & choose uninstall. After all Javas are uninstalled, reboot your computer. To prepare to install a new Java 8 ... In the search box of Windows Start Button or Cortana, type System & at the top select System Information. In the resulting window, look for x64, meaning you have 64 bit Windows or x86 meaning you have 32 bit Windows. You will choose a Java 8 install based on that. OpenHAB official docs warn NOT to use Java 9 or 10.
Next, Satisfy the Windows OpenHAB's Java Prerequisite, continued
|
|
|
Post by papa on Jun 4, 2018 15:56:32 GMT
Step 1a) Satisfy the Windows OpenHAB's Java Prerequisite, continuedAfter previously using another Java source, I agree with the official docs recommendation of installing the Zulu Java Platform. Go to this site. Scroll down until you start seeing 8 along the left margin. Look for your 64 bit or 32 bit version with the highest build number in the label 8u[build].
Update, Jan. 22, 2019: See this post below where I address another Java installation option via the official documentation. Within most Zulu 8u[build] possibilities is a .zip file for server & a .msi file for client. This site says "The client system is optimal for applications which need fast startup times or small footprints, the server system is optimal for applications where the overall performance is most important. In general the client system is better suited for interactive applications such as GUIs." I chose client .msi which I believe is fine for our DIY Home Automation purposes. Does anyone have better insight?In the search box of Windows Start Button or Cortana, type environment. Near the top choose, edit the system environment variables. At the bottom of the resulting window, choose [Environment Variables ...]. In the lower part of the resulting window, select an existing JAVA_HOME & [edit] or choose [new]. Setting the JAVA_HOME environmental variable ... Some Java chatter I saw said that maybe this is not necessary, but why take chances.
My JAVA_HOME is C:\Program Files\Zulu\zulu-8 Yours might start C:\Program Files\java\
JAVA_HOME needs to be the Java installation folder, just above the \bin folder that holds java.exe
Apparently, a computer reboot is needed for JAVA_HOME to register in the system.
Next, 1b) Install, Start, & Test Windows Mosquitto Message Service
|
|
|
Post by papa on Jun 5, 2018 19:04:28 GMT
1b) Install, Start, & Test Windows Mosquitto Message ServiceMosquitto MQTT Message Service is often needed for Home Automation projects (including our forum's). It handles messaging between devices and OpenHAB. My first install of Windows Mosquitto 3 years ago was a nightmare. Installing Mosquitto on Windows can be challenging, matching a good install .exe with the right versions of dependent .dll files where needed. I'm sharing what I tracked down to work for me and might help you succeed ... From my github repository, you can download an installation .exe & extra needed .dll files AND follow the explanation & directions in the README.md file. OR to make it easier ... InstallMosquittoB.bat (12.64 KB) << Download & run this batch file which may do everything for you: download a Mosquitto .exe & extra needed .dll files, run the installer .exe, copy the extra .dll files into the Mosquitto program folder, start the Mosquitto service, & test that Mosquitto is working & ready to be used with OpenHAB. MosquittoTest5.bat (2.38 KB) << You can also download & run this batch file to only test if your Mosquitto is working.To download & run the batches, I suggest that you create a new directory C:\~Scripts & download or move the .bat files there. Then go to that C:\~Scripts folder, select the name of the script, & tap [enter]. OR in in the search box of Windows Start Button or Cortana, enter cmd. In the resulting window, enter cd /d C:\~Scripts & then on the next line enter the name of the .bat file.
Update, Jan. 21, 2019: If the above Mosquitto install does not work, you may not have the Microsoft-Visual-C-Redistributables that you need. In my Microsoft-Visual-C-Redistributables repository, I offered 3 install files that work for me. Download & run the files starting with the 2010 file. If your Windows computer says it already has a Microsoft-Visual-C-Redistributables install, cancel the install & go on to another install file. After you install the missing Microsoft-Visual-C-Redistributables, try the above Windows Mosquitto install again.
PS As of Jan. 21, 2019, I am running Windows 10 Home, Version 10.0.17763 Build 17763.
Next, Some Comments on the Batch Files in the Last Post Then, Step 2) Install the OpenHAB platform on the computer
|
|
|
Post by papa on Jun 5, 2018 19:25:33 GMT
Some Comments on the Batch Files in the Last Post
I saw a need (making the Windows Mosquitto installation more reliable) & I believe I found ways to address it. The Windows Mosquitto installation program are provided separately from some extra .dll files that Windows Mosquitto needs. For the most part, the extra files are part of the OpenSSL project. OpenSSL is continuously updated to address security problems & older versions are no longer available. That means the .dll files needed by older versions of Windows Mosquitto are no longer available.
So in my github repository, I provide what is currently the latest Windows Mosquitto installation program AND the most recent OpenSSL .dll files that version of Windows Mosquitto needs. I provide ONLY the OpenSSL .dll files that Windows Mosquitto needs so one need not download & do two larger OpenSSL installations. The .dll files are place directly in the Mosquitto program folder so I don't believe they will interfere with other versions that might get placed in the Windows system folders.
By working out the above for the latest versions of Windows Mosquitto & OpenSSL & providing the files on my github, I hope this solution will last a while. I also did the scripts to take care of putting those now current files in place & making sure Windows Mosquitto works.
The script files (.bat) in the last post are among my very first. I'm sure the scripts could have been done differently, even better. Their user interface is primitive, but I've tried to be careful how I present instructions & provide for how users proceed through the process. I also tried to comment what I was doing throughout the .bat. I believe these batch files will work on a variety of Windows computers. Why did I use .bat batch files? Because they are more like previous programming I've done. Why did I include some Powershell programming? Because (with my son's help) that allowed me to accomplish some things (like downloading & copying files into a C:\Programs (x86)\ folder) that .bat files cannot natively do & yet not require the install of other tools. Maybe down the road, I'll move toward more Powershell programming.
I'll be interested to hear if these scripts are helpful.
Next, Step 2) Install the OpenHAB platform on a Windows Computer
|
|
|
Post by papa on Jun 6, 2018 18:44:29 GMT
Step 2) Install the OpenHAB platform on a Windows ComputerAgain, items 1a), 1b), & 2) in the OpenHAB 2 (OH2) installation process steps could be done in any order, but if not accomplished, could interfere with results from steps 3a) & 3b).
Update, Jan. 22, 2019: See this post below where I address another OpenHAB2 installation option in the official documentation. As the official documentation suggests, I recommend you install OpenHAB2 in the folder C:\openHAB2\ which you will create unless you installed it before. Using that folder will make it easier to follow the official docs & to use some things that I offer.
Update, Jan. 22, 2019: I encourage you to make copies of the so far two original, unedited files in the C:\OpenHAB2\conf\services folder. Then you will have the original settings to compare to any changes & perhaps revert to. As you progress in configuring OpenHAB2, other files will add in the C:\OpenHAB2\conf\ folders. I encourage you to make copies of them before I have you copy in edited versions.
As the official docs instruct, run the script C:\openHAB2\start.bat & launch OpenHAB2. You should see the Karaf console. At its top, you may see some error messages, but I don't believe that's a concern if Karaf starts after the error messages. Congrats, OpenHAB 2 is running, but unless you set up OpenHAB to run as a service, when the computer reboots, start.bat must be run again.
Next, Step 3) Install the OpenHAB add-ons
AND Configure the OpenHAB items, rules, & sitemap needed for our forum's Home Automation project
|
|
|
Post by papa on Jun 6, 2018 19:28:38 GMT
Step 3) Install the OpenHAB add-ons AND Configure the OpenHAB items, rules, & sitemap needed for our forum's Home Automation project This step to configure OpenHAB2 is where I disagree with what the official docs seem to prefer, namely starting configuration via graphic dashboards. I appreciate developers' trying to make it easier, but I'm convinced for now that configuration text files work better. In another thread, at this post, I made my case for this. For one thing, in this comparison chart of what each configuration method can do, text files accomplish the most. Configuring items is on the PaperUI list, but as far as I see, some parts of our forum's item configurations get ignored in Paper UI.
If you know what you are doing, you could download & install these files on your own. If you view or edit them, I recommend you avoid using a typical Windows text editor. Instead use Notepad++ a text editor friendly to all computer platforms. See more at this post.
To make things even easier, I also created a Windows script file, Get_OH_starter_Filesxx.bat, to install the above configuration files where OpenHAB 2 needs them. This will be offered in the next post.
Next, A Script for Step 3)
Install the OpenHAB add-ons AND Configure the OpenHAB items, rules, & sitemap needed for our forum's Home Automation project
|
|
|
Post by papa on Jun 6, 2018 20:07:25 GMT
A Script for Step 3) Install the OpenHAB add-ons AND Configure the OpenHAB items, rules, & sitemap needed for our forum's Home Automation projectAs said in the last post, I also created a Windows script file, Get_OH_starter_Filesxx.bat, to install the above configuration files where OpenHAB 2 needs them. As the script's opening screen warns ...Caution: For good or ill this script overwrites certain existing configuration files (My.items, My.rules, My.sitemap, addons.cfg, mqtt.cfg), but in each case, will get your permission first.So ... the best time to use this script is just after you have first installed OpenHAB (as shown in steps above) OR you want to make a fresh start on your configuring OpenHAB.
To download & run the .bat script file, I suggest that you use or create the directory C:\~Scripts & download or move the .bat files there. Then go to that C:\~Scripts folder, select the name of the script, & tap [enter]. OR in in the search box of Windows Start Button or Cortana, enter cmd. In the resulting window, enter cd /d C:\~Scripts then & on the next line enter the name of the .bat file.
Next A Script to Test How Well Your Windows OpenHAB / Mosquitto Is Set up for DIY Home Automation
|
|
|
Post by papa on Jun 6, 2018 20:46:13 GMT
A Script to Test How Well Your Windows OpenHAB / Mosquitto Is Set up for DIY Home Automation
For any point in the OpenHAB installation & configuration steps, I created a script (.bat file) to test how well your OpenHAB / Mosquitto is set up for DIY Home Automation. At any point, I believe it can show you what you might still need to accomplish. If you choose, the script can generate a report file that you could share on this forum to get help. The report file's name is OHreadiness.txt
This script should pose no risks. It makes no changes to your Windows computer, except if OpenHAB service or Mosquitto service are installed, but not running, the script will start them.
CheckOH26.bat (15.31 KB) << Here is the script to test OpenHAB / Mosquitto.
To download & run the .bat script file, I suggest that you use or create the directory C:\~Scripts & download or move the .bat files there. Then go to that C:\~Scripts folder, select the name of the script, & tap [enter]. OR in in the search box of Windows Start Button or Cortana, enter cmd. In the resulting window, enter cd /d C:\~Scripts then & on the next line enter the name of the .bat file.
Update Jan. 22, 2019: This script assumes that in mqtt.cfg, one should use the setting "mosquitto.retain=true" < Disregard that. Either do NOT change that setting or use "mosquitto.retain=false" The true setting seems to create some problems. I'll update the script when I get a chance.
I hope these posts & tools on installing & configuring Windows OpenHAB 2 & Mosquitto message service are helpful. I'd like to hear how they've been used.
|
|
|
Post by papa on Jun 6, 2018 22:00:55 GMT
What's Next ... now that you should have OpenHAB 2 & Mosquitto installed & running?
You might now use the OpenHAB dashboards to view your OpenHAB configuration. http://localhost:8080/start/index will show you a list of interfaces that was chosen by the addons.cfg file you downloaded from my github repository. In PaperUI, you can see bindings, etc that other downloaded config files selected for you. To change them, you must edit the addons.cfg file. BasicUI & ClassicUI gives you the interface set up by the downloaded My.sitemap, as it is informed by My.items & My.rules.
As I said in the first post above, OH2 can accomplish some things without setting up additional devices. This post tells how to display Date & Time on your OpenHAB User Interface.
|
|
|
Post by papa on Jan 21, 2019 19:33:30 GMT
Updates of This Thread Are in Process As of Jan. 21, 2019 ...
This post on the Java prerequisite was updated. This post on installing the Mosquitto MQTT message broker was updated.
From this thread's first post through the posts on installing Mosquitto, I have confirmed the instructions work.
Update, Feb. 3, 2019: This thread documents setting up a new Embedded MQTT broker. In that case, we no longer need Mosquitto.
|
|
|
Post by papa on Jan 22, 2019 16:00:55 GMT
A Community-Provided Unofficial Installation of Windows OpenHAB2 In this post above, I was following the method of downloading the latest stable .zip file ( from here) to install Windows OpenHAB2 & unzipping the contents to C:\openHAB2 The official download site offers an intriguing UNofficial option: Install with Chocolatey. The positives so far: Chocolatey downloads & installs OpenHAB2 (including shortcuts on the start menu & the desktop) AND an Oracle Java. Somewhat negative: The OpenHAB2 install is somewhat buried at C:\ProgramData\chocolatey\lib\openhab\tools, but one can copy or move all from the ...\tools folder to C:\openHAB2.
Actually, the above are shortcuts to a folder of various OpenHAB2 folders, etc. The last shortcut in this folder (openHAB) is the one to run openHAB2. If we move the install from C:\ProgramData\chocolatey\lib\openhab\tools to to C:\openHAB2, we also need to change the targets of the shortcuts.
Also somewhat negative: Chocolatey failed to download the 64 bit version of the Oracle Java. However, I believe the successful 32 bit version may be sufficient. Update, Jan. 27, 2019: On my Windows 10-64 bit machine, this did not seem to provide the Java I needed. I reverted to the Zulu Java I installed before Chocolatey.
Update, Jan. 28, 2019: The Chocolatey OpenHAB2 install is a nice idea, but I'm not fond of the execution.
I've been thinking that a .bat or .bash file could download the latest stable version of OpenHAB2 & install it at C:\openHAB2. I may work on that sometime.
|
|