Manual Installation Stretch - HestiaPi/hestia-touch-openhab GitHub Wiki

Here be dragons!

We cannot stress enough that following the below steps is a long and delicate process. We try our best to not have to run any other command but please 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:

If you are looking for the old installation steps for Raspbian Jessie click here.


SYSTEM

Flash Raspbian Stretch (not Lite) image (2018-06-27-raspbian-stretch.img) and mount boot partition

sudo touch ssh

Insert SD in RaspberryPi, plug LCD on and boot.

sudo visudo
pi ALL=(ALL) NOPASSWD: ALL

Change to your local timezone.

sudo raspi-config

Localisation Options>Change timezone Change pi's password to hestia

sudo apt-get remove --purge -y wolfram-engine wolframscript libreoffice* scratch* minecraft-pi sonic-pi dillo gpicview realvnc-vnc-server 
sudo apt-get autoremove -y 
sudo apt-get autoclean -y 
sudo apt-get update && sudo apt-get -y upgrade 
sudo apt-get install -y apt-transport-https mosquitto bc dnsmasq hostapd vim python3-flask python3-requests git dirmngr;

Make WiFi reconnect on drop

sudo cp /etc/wpa_supplicant/ifupdown.sh /etc/ifplugd/action.d/ifupdown
SYSTEM

LCD
wget http://www.hestiapi.com/download/LCD-show-170703.tar.gz 
tar xvf LCD-show-170703.tar.gz 
cd LCD-show/ 
sudo ./LCD35-show;


sudo rm -rf LCD-show*;
sudo mkdir /etc/X11/xorg.conf.d 
sudo touch /etc/X11/xorg.conf.d/99-calibration.conf 
sudo nano /etc/X11/xorg.conf.d/99-calibration.conf;


Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "3900 218 246 3832"
EndSection

To get more precise touch, adjust the 4 numbers according to YOUR calibration output from the below steps

sudo dpkg -i ./LCD-show/xinput-calibrator_0.7.5-1_armhf.deb

and select on the LCD [Start Menu] > Preferences > Calibrate Touchscreen

sudo nano /etc/lightdm/lightdm.conf

find, uncomment/modify the xserver-command line under [Seat:*] to this:

xserver-command=X -nocursor
LCD

JAVA
sudo su;
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x219BD9C9 
echo 'deb http://repos.azulsystems.com/debian stable main' > /etc/apt/sources.list.d/zulu.list 
apt-get update -qq 
apt purge -y *java* 
apt-get install -y zulu-embedded-8 
java -version;

Use the following command to make sure that the new Zulu JDK is being used as default and is the only alternative:

update-alternatives --config java
JAVA

OH
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add - 
echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list 
sudo apt-get update 
sudo apt-get install openhab2 
sudo apt-get autoremove -y 
sudo /bin/systemctl daemon-reload 
sudo /bin/systemctl enable openhab2.service 
sudo adduser openhab i2c 
sudo adduser openhab gpio 
sudo reboot;

Visit http://[RASPI_IP]:8080 Select Standard (and wait...) Go to PaperUI > Addons

Bindings Install: Exec, GPIO, HTTP, MQTT

Persistence Install: RRD4J

Transformations Install: Map, Regex

User Interfaces: Basic UI, HABmin, HABPanel, Paper UI

OH

INSTALL HESTIA
mkdir /home/pi/git 
cd /home/pi/git/ 
git clone https://github.com/HestiaPi/hestia-touch-openhab.git 
cd /home/pi/git/hestia-touch-openhab/home/pi/ 
cp -R scripts /home/pi/ 
cd /home/pi/scripts/ 
sudo chmod +x update.sh 
touch /tmp/publicip 
sudo chmod 777 /tmp/publicip 
sudo ./update.sh;

Clear the messages on the LCD Make /home/pi/scripts/logo.png the wallpaper "Center unscaled image on the monitor" Remove all Desktop icons and panel items and empty spacer from panel Delete folders

sudo rm -rf Documents Downloads MagPi Music oldconffiles Pictures Public Videos;
INSTALL HESTIA

AUTOSTART
touch /home/pi/.config/autostart/openhaloader.desktop 
nano /home/pi/.config/autostart/openhaloader.desktop;

Add these:

[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

sudo /home/pi/scripts/HVACEnable.sh

(reboots automatically)

After reboot

  1. Let LCD finish loading
  2. Once the screen is blank, slide to the right
  3. Tap on the gear icon bottom left next to the clock
  4. Select “Panel configuration: Server Storage”
  5. Press OK on the popup
  6. Click on the burger menu again on the top left corner
  7. Choose "HestiaPi - Heating"
AUTOSTART

MQTT
sudo nano /etc/openhab2/services/mqtt.cfg

add at the end

mosquitto.url=tcp://localhost:1883
mosquitto.clientId=hestiapi

For testing use a laptop and type:

mosquitto_sub -h [HESTIA_PI_IP] -d -t hestia/#
MQTT

TURNKEY
wget https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-armv6l.tar.xz 
sudo mkdir /usr/lib/nodejs 
sudo tar -xJvf node-v8.9.4-linux-armv6l.tar.xz -C /usr/lib/nodejs 
rm -rf node-v8.9.4-linux-armv6l.tar.xz 
sudo mv /usr/lib/nodejs/node-v8.9.4-linux-armv6l /usr/lib/nodejs/node-v8.9.4 
echo 'export NODEJS_HOME=/usr/lib/nodejs/node-v8.9.4' >> ~/.profile 
echo 'export PATH=$NODEJS_HOME/bin:$PATH' >> ~/.profile 
source ~/.profile 
wget https://dl.google.com/go/go1.10.linux-armv6l.tar.gz 
sudo tar -C /usr/local -xzf go*gz 
rm go*gz 
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.profile 
echo 'export GOPATH=$HOME/go' >> ~/.profile 
source ~/.profile;


cd /home/pi/scripts 
git clone https://github.com/schollz/raspberry-pi-turnkey.git 
sudo systemctl stop dnsmasq && sudo systemctl stop hostapd 
echo 'interface wlan0
static ip_address=192.168.4.1/24' | sudo tee --append /etc/dhcpcd.conf;
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig;
sudo systemctl daemon-reload;
sudo systemctl restart dhcpcd;
echo 'interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h' | sudo tee --append /etc/dnsmasq.conf;
echo 'interface=wlan0
driver=nl80211
ssid=HESTIAPI
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=HESTIAPI
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP' | sudo tee --append /etc/hostapd/hostapd.conf 
echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' | sudo tee --append /etc/default/hostapd 
sudo systemctl start hostapd && sudo systemctl start dnsmasq;


nano /home/pi/scripts/raspberry-pi-turnkey/templates/index.html

Hide email field from page by changing it to this

<div class="form-label-group">;
<input type="hidden" name="email" id="inputEmail" class="form-control" placeholder="Email address">;
<!-- <label for="inputEmail">Email address</label>;
-->
</div>


sudo nano /etc/rc.local;

Add this at the end before exit 0

su pi -c '/usr/bin/sudo /usr/bin/python3 /home/pi/scripts/raspberry-pi-turnkey/startup.py &'
TURNKEY

CHROMIUM

Fix default Chromium font Kill all Chromium instances

pgrep chromium | xargs kill -9

Start it from the LCD Menu > Internet > Chromium Web Browser Go to Chromium > Settings > Scroll under Appearance > Customise fonts Set DejaVu Sans for Standard

CHROMIUM

SD OPTIMISATION
sudo dphys-swapfile swapoff
sudo nano /etc/fstab

add at the end:

tmpfs /var/tmp tmpfs nodev,nosuid,size=50M 0 0
tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
#tmpfs /var/log tmpfs nodev,nosuid,size=50M 0 0

For maximum optimisation you can disable logging by uncommenting the last line

SD OPTIMISATION
⚠️ **GitHub.com Fallback** ⚠️