OpenHab2 on Raspberry Pi Zero W

I'm a beginner when it comes to electronics, coding and internet of things. What I do appreciate though is getting help from the web. After first trying, and failing, with HomeAssistant, I gave OpenHab a go, and it really did just work. OpenHab is an open source platform for controlling devices, and has support for many popular services. This guide is what I used to get myself up and running. I've used it more than once, and it works well.

What we're going to do

  • Start at the very beginning, and setup and install of the OpenHab on the Raspberry Pi from scratch.
  • By the end, you'll have openHabian running and accessible on a browser.
  • We're also going to create a backup, so that we can go ahead and try things knowing we have a place to go back to that isn't from scratch.

What you'll need

  • Raspberry Pi Zero W or similar.
  • Etcher or similar SD card burning program. Download here https://etcher.io/
  • Basic experience using the Terminal command line interface. (or just copy and paste exactly from this guide).
  • Patience.
  • Username and password of the wifi network you'll connect to
  • Display, keyboard and mouse

Start here

1. Load openHABian to your SD card

  • [Source]
  • Insert your SD card into your computer.
  • Download the latest disk image. As of Feb 2018, OpenHabian version 1.4 was the current release.
  • Open Etcher, select: openhabianpi-raspbian-201712171718-git30faec3-crccc053823.img.xz
  • Click Flash. It takes around 5 mins.
  • If unsuccessful, just try again. It usually works the second time.

2. Configure WiFi

  • [Source]
  • Installing openHABian requires internet connection.
  • After Etcher is finished, remove the SD card from your computer, and then put it back in again.
  • A disk image called "boot" should load up. Navigate to root folder.
  • Open the file 'openhabian.conf' in a text editor
  • Uncomment and fill in your network details: wifi_ssid="My Wi-Fi SSID" and wifi_psk="password123".

3. Put the SD in Raspberry Pi

  • Insert the SD card into the Raspberry Pi, connect power.
  • Optionally connect monitor, keyboard and mouse.
  • When you connect power, the installer will run automatically.   

4. Wait approximately 15-45 minutes

  • for openHABian to do its magic (OR 1 hour and 38 mins in my case. Raspberry Pi Zero's are pretty underpowered, so it might not take as long with a more powerful Raspi)  

5. Success!

  • Now just login to up. Login?

6. Update the OpenHabian install

  • $ sudo openhabian-config
  • Select Update
  • Select Upgrade
  • Select 20 Optional components
    • 23 Mosquitto

7. Find the IP address on Raspberry Pi

  • $ hostname -I

8. On your Mac, connect via SSH using Terminal

  • $ ssh openhabian@YOUR.IP.ADD.RESS e.g.openhabian@10.0.0.27
  • The default password is: openhabian

9. Change linux password

  • $ passwd
  • Enter your new password.
  • New credentials are openhabian:newpasword
  • It's important to save these credentials somewhere easy to find.

10. Load openhab in a browser

  • YOUR.IP.ADD.RESS:8080 e.g http://10.0.0.4:8080
  • Select Standard install

11. Configure OpenHab administration system

  • Select Paper UI
  • Admin system URL is therefore: http://10.0.0.4:8080/paperui/

12. Connect 'Things' to OpenHab

  • Set up some basic things to test the connection
  • Add-ons
    • Binding
      • Network
      • Weather
  • Misc
    • Rules
    • OpenHab Cloud

13. Remotely access the file system, connect via Samba

  • Connecting Samba allows us to navigate through the folders or directory structure of the OpenHabian installed on the SD card.
  • In Finder, type CMD+K
  • Enter smb://10.0.0.4:8080, and choose openhabian_conf.

14. Update the OpenHab configuration

  • If you have previously created other items, sitemaps and rules, you can now paste them it, or create your own.
  • Create Things (network etc)
  • Update items ID's in 'default.items'

15. Config openhab cloud

  • $ sudo nano /var/lib/openhab2/uuid
  • $ sudo nano /var/lib/openhab2/openhabcloud/secret

16. Make an SD backup (1 hour)

  • $ diskutil list
  • $ sudo dd if=/dev/disk2 of=~/Backups/OpenHab/openhabian_installed_2017-12-19.dmg