Manual installation – Jessie

Here be dragons!

We cannot stress enough that following the below steps is a long and delicate process. These are our notes during the last year and a half of heavy development so don’t simply copy-paste them in your terminal without paying attention. It may be outdated, missing or overlapping information. So only advanced users should try it. OK?

Good. Once this is clear lets dig into it right away:

 

Install latest Raspbian Jessie (not Lite), update & upgrade. Some people have used Stretch but we haven’t so nothing is certain.


Install LCD driver:
wget http://www.hestiapi.com/LCD-show.tar.gz
tar xvf LCD-show.tar.gz
cd LCD-show/
sudo ./LCD35-show

The last line
dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1
from
/boot/config.txt
needs to be COMMENTED OUT!


To rotate the touch points
sudo nano ~/scripts/openhabloader.sh
add this at the end
xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
SEE LCD TOUCH FIX SECTION BELOW


sudo apt-get install -y xinput-calibrator
From GUI select Menu -> Preferences -> Calibrate Touchscreen
Copy the results in
sudo nano /etc/X11/xorg.conf.d/99-calibration.conf
like:

Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "3919 208 236 3913"
Option "SwapAxes" "1"
EndSection

To rotate the touch points follow section “Touch screen calibration”:
http://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A)
sudo DISPLAY=:0.0 xinput_calibrator


Install OpenHAB 2 WITH THE OFFICIAL METHOD and make sure it starts at boot OK.
http://docs.openhab.org/installation/linux.html:


Install DHT or BME sensor libraries depending on which hardware you have used

sudo apt-get install build-essential python-dev
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo apt-get install build-essential python-pip python-dev python-smbus git
sudo python setup.py install
wget https://bitbucket.org/MattHawkinsUK/rpispy-misc/raw/master/python/bme280.py
python bme280.py
mkdir /home/pi/scripts
cd /home/pi/scripts

Download from
https://github.com/HestiaPi/hestia-touch-openhab/tree/master/home/pi/scripts
AdafruitDHTTemp.py and AdafruitDHTHum.py
and make them executable
chmod 755 *.py

workaround for OH2 and GPIO issue (see: https://github.com/openhab/openhabian/issues/39):
sudo nano /etc/default/openhab2
add
USER_AND_GROUP=root:root
at the end
sudo nano /usr/lib/systemd/system/openhab2.service
change the 2 lines to these:
User=root
Group=root

sudo nano /etc/lightdm/lightdm.conf
find, uncomment/modify the xserver-command line under [SeatDefaults] to this:
xserver-command=X -nocursor


Make WiFi reconnect automatically
cd /etc/ifplugd/action.d/
sudo mv ifupdown ifupdown.0
sudo cp /etc/wpa_supplicant/ifupdown.sh ./ifupdown

Install loader script and UI
cd ~/scripts
sudo apt-get install bc

Download all scripts from here
https://github.com/HestiaPi/hestia-touch-openhab/tree/master/home/pi/scripts

mv openhabloader openhabloader.sh
sudo chmod +x openhabloader.sh
touch /home/pi/.config/autostart/openhaloader.desktop
sudo nano /home/pi/.config/autostart/openhaloader.desktop

Add the following contents

[Desktop Entry] Comment=Start Chromium in Kiosk mode with HAB Panel UI
Exec=/home/pi/scripts/openhabloader.sh
Icon=
Name=openhabloader.sh
Path=/home/pi/scripts/
Type=Application

Reboot
sudo reboot


Open in a browser
http://[HESTIA_IP]:8080
choose standard and wait. Then wait some more…
Choose PaperUI > Addons

Actions Install:

Bindings Install:
Exec
GPIO
HTTP
MQTT

Misc:

Persistence Install:

Transformations Install:
Regex
User Interfaces:
Basic UI
HABmin
HABPanel
Paper UI


Install files for sitemap, items, etc from
https://github.com/HestiaPi/hestia-touch-openhab/tree/master/etc/openhab2


To have HestiaPi check periodically your public IP and push it to DtDNS (in case your router does not support it or simply does not work)

sudo touch /home/pi/scripts/publicip.sh
sudo nano /home/pi/scripts/publicip.sh

Enter these contents:

#!/bin/bash
publicip=$(wget --timeout=10 http://ipinfo.io/ip -qO -)
touch /tmp/publicip
if [ "$publicip" != "$(cat /tmp/publicip)" ] then
echo $publicip > /tmp/publicip # overwrite for next run
# Run dyndns updater
/usr/bin/wget -O - -q -t 1 "http://www.dtdns.com/api/autodns.cfm?id=[YOUR-DTDNS-DOMAIN]&pw=[YOUR-DTDNS-PASS]&client=HestiaPiDDNSUpdater"
fi

sudo crontab -e
Add this at the end – to check every hour
0 * * * * /home/pi/scripts/publicip.sh

If you instead simply want to push periodically your public IP to DtDNS to that:

sudo crontab -e
Add this at the end – to run at 5 AM
0 5 * * * /usr/bin/wget -O - -q -t 1 "http://www.dtdns.com/api/autodns.cfm?id=[YOUR-DTDNS-DOMAIN]&pw=[YOUR-DTDNS-PASS]&client=HestiaPiDDNSUpdater"

ENABLE TOUCHSCREEN AND ENABLE DRIVERS
wget http://www.hestiapi.com/LCD-show.tar.gz
tar xvf LCD-show.tar.gz
cd LCD-show/
sudo ./LCD35-show

Reboots at the end.
From: https://www.raspberrypi.org/forums/viewtopic.php?f=45&t=115614


SETUP FILESYSTEM AND TZ
Set timezone and expand filesystem to use whole SD if this is not already done automatically.
sudo raspi-config (follow on-screen info for timezone first then to expand filesystem)
sudo reboot


LCD TOUCH FIX SECTION BELOW
LCD was not clickable all the way to the edges. Below steps were followed
sudo nano ~/scripts/openhabloader.sh
REMOVE with a # this at the end
xinput --set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1

git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./LCD35-show
sudo apt-get install xserver-xorg-input-evdev
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
sudo reboot


Update LCD Touch UI elements and features

pgrep chromium | xargs kill -9;
sudo service openhab2 stop;
sudo chmod 777 /etc/openhab2/rules /etc/openhab2/sitemaps /etc/openhab2/items /etc/openhab2/things;
sudo chmod 777 /etc/openhab2/rules/default.rules /etc/openhab2/sitemaps/default.sitemap /etc/openhab2/items/default.items /etc/openhab2/things/default.things;
sudo wget https://github.com/HestiaPi/hestia-touch-openhab/raw/master/home/pi/scripts/openhabloader.sh -O /home/pi/scripts/openhabloader.sh;
sudo wget https://github.com/HestiaPi/hestia-touch-openhab/raw/master/etc/openhab2/items/default.items -O /etc/openhab2/items/default.items;
sudo wget https://github.com/HestiaPi/hestia-touch-openhab/raw/master/etc/openhab2/rules/default.rules -O /etc/openhab2/rules/default.rules;
sudo wget https://github.com/HestiaPi/hestia-touch-openhab/raw/master/etc/openhab2/sitemaps/default.sitemap -O /etc/openhab2/sitemaps/default.sitemap;
sudo wget https://github.com/HestiaPi/hestia-touch-openhab/raw/master/home/pi/scripts/habpanel.config -O /var/lib/openhab2/config/org/openhab/habpanel.config;
sudo chmod 644 /var/lib/openhab2/config/org/openhab/habpanel.config;
sudo reboot;


Install Graphs functionality

1. Visit from a browser

http://[YOUR_HESTIAPI_IP]:8080

And choose

PaperUI > Add-ons > Persistence

Install RRD4J Addon (it may take some time on RasPi Zero)

2. Log on via SSH to your HestiaPi
sudo nano /etc/openhab2/persistence/rrd4j.persist
and enter this:
Strategies {
// for rrd charts, we need a cron strategy
everyMinute : "0 * * * * ?"
default = everyMinute
}
Items {
TempSetpointChart,PreviousTempReading,HumiSetpointChart,PreviousHumiReading : strategy = everyMinute
}

Ctrl+O to save and Ctrl+X to close

3. Now you will see that RRD databases are populated

ls /var/lib/openhab2/persistence/rrd4j

4. Get the latest sitemap, items and rules files. There is a script now! For the very first time you need all that:
mkdir /home/pi/scripts/update;
cd /home/pi/scripts/update;
wget https://github.com/HestiaPi/hestia-touch-openhab/raw/master/home/pi/scripts/update.sh;
sudo mv /home/pi/scripts/update/* /home/pi/scripts/;
cd /home/pi/scripts/;
sudo chmod 755 update.sh;
rmdir /home/pi/scripts/update;
sudo ./update.sh

For any future update simply run:
sudo ./update.sh

The updates are not enforced on the UI yet. To load the EU mode:
./F2C.sh
and wait for everything to load.

To load the US mode:
./C2F.sh

5. Visit the Paper UI

http://[YOUR_HESTIAPI_IP]:8080


See https://community.openhab.org/t/configuration-location/14087/15 for more info about the HABPanel configuration.
You now get “Boost” functionality for Heating and Hot Water.
Their duration is changed and monitored live as the time goes by from the settings page on the LCD. Same functionality is replicated from all other UIs (web, smartphone app).