Manual Installation ONE - HestiaPi/hestia-touch-openhab GitHub Wiki
For people who want to install everything step-by-step from their terminal we include all commands here.
This is a very rough guide from our installation notes. Please read carefully as there may be some mistakes.
DO NOT SIMPLY COPY PASTE CODE without reading it first and making sure you understand what you are doing!
Each installation section is marked with [SECTION_NAME] START and [SECTION_NAME] END to help you understand easier.
For Jessie Lite (2017-07-05-raspbian-jessie-lite.zip - http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-07-05/): Mount boot partition on another computer and type
sudo touch ssh
If you use a Pi Zero W: Insert SD, USB keyboard+mouse combo, HDMI screen, plug LCD on RaspberryPi and boot. Use GUI to connect to WiFi and find your IP with the command ifconfig.
If you temporarily use a Pi 3 with Ethernet port: Insert SD in RaspberryPi, plug LCD on and connect Ethernet cable and power to boot. Find the ethernet IP it was given from your router.
ssh to the Pi's IP.
Credentials: pi/raspberry
change pi password to hestia
sudo raspi-config
> Change User Password
sudo raspi-config
> Boot Options > Desktop / CLI > Console Autologin
sudo raspi-config
> Interfacing Options > I2C > Yes
sudo raspi-config
> Advanced Options > Expand Filesystem
sudo raspi-config
> Advanced Options > Memory Split > 16
Reboot when prompted
sudo visudo
add at the end:
pi ALL=(ALL) NOPASSWD: ALL
openhab ALL=(ALL) NOPASSWD: ALL
sudo nano ~/.bashrc
change to
HISTCONTROL=ignoredups
sudo apt-get update && sudo apt-get -y upgrade \
&& sudo apt-get install -y apt-transport-https bc dnsmasq hostapd vim python3-flask python3-requests git dirmngr accountsservice build-essential python quilt devscripts python-setuptools python3 libssl-dev cmake libc-ares-dev uuid-dev daemon zip zlibc zlib1g zlib1g-dev python-smbus unclutter matchbox-window-manager xwit xinit openbox lxterminal geoclue-2.0 libjavascriptcoregtk-3.0-0=2.4.9-1~deb8u1+rpi1 libwebkitgtk-3.0-0=2.4.9-1~deb8u1+rpi1 \
&& sudo apt-get install -y --no-install-recommends xserver-xorg;
Press q when prompted to continue
touch /home/pi/.xinitrc \
&& chmod 755 /home/pi/.xinitrc \
&& echo '#!/bin/sh
exec openbox-session' | tee --append /home/pi/.xinitrc;
sudo update-alternatives --config x-window-manager
Confirm this is selected:
* 0 /usr/bin/openbox 90 auto mode
sudo update-alternatives --config x-session-manager
Confirm there is only one alternative.
Make WiFi reconnect on drop
sudo cp /etc/wpa_supplicant/ifupdown.sh /etc/ifplugd/action.d/ifupdown
Prerequisites:
- libwesockets <= 2.4.1
- mosquitto < 1.5
sudo apt-get remove mosquitto -y \
&& cd \
&& wget https://github.com/warmcat/libwebsockets/archive/v2.4.1.zip \
&& unzip v2.4.1.zip \
&& cd libwebsockets-2.4.1/ \
&& mkdir build \
&& cd build \
&& cmake .. \
&& sudo make install \
&& sudo ldconfig \
&& cd \
&& wget http://mosquitto.org/files/source/mosquitto-1.4.9.tar.gz \
&& tar zxvf mosquitto-1.4.9.tar.gz \
&& cd mosquitto-1.4.9 \
&& sed -i -e "s/WITH_WEBSOCKETS:=no/WITH_WEBSOCKETS:=yes/g" config.mk \
&& make \
&& sudo make install \
&& sudo cp mosquitto.conf /etc/mosquitto \
&& echo 'user pi
port 1883
listener 9001
protocol websockets
pid_file /var/run/mosquitto.pid' | sudo tee --append /etc/mosquitto/mosquitto.conf;
Enter any password for user mosquitto and ENTER for the rest. User mosquitto will be removed anyway in the next steps.
sudo systemctl stop mosquitto \
&& sudo update-rc.d mosquitto remove \
&& sudo rm /etc/init.d/mosquitto \
&& echo '[Unit]
Description=MQTT v3.1 message broker
After=network.target
Requires=network.target
[Service]
Type=simple
ExecStart=/usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Restart=always
[Install]
WantedBy=multi-user.target' | sudo tee /etc/systemd/system/mosquitto.service;
sudo systemctl daemon-reload \
&& sudo systemctl enable mosquitto \
&& sudo systemctl start mosquitto.service \
&& sudo userdel mosquitto \
&& sudo rm -rf /home/mosquitto /home/pi/.cmake /home/pi/libwebsockets-2.4.1 /home/pi/mosquitto-1.4.9 /home/pi/mosquitto-1.4.9.tar.gz /home/pi/v2.4.1.zip;
To confirm use a laptop and type:
mosquitto_sub -h [HESTIA_PI_IP] -d -t hestia/#
wget http://www.hestiapi.com/download/LCD-show-170703.tar.gz \
&& tar xvf LCD-show-170703.tar.gz \
&& cd LCD-show/ \
&& sudo ./LCD35-show;
Pi reboots with LCD working and stops at console prompt.
sudo rm -rf /home/pi/LCD-show LCD-show-170703.tar.gz;
sudo dpkg -i ./LCD-show/xinput-calibrator_0.7.5-1_armhf.deb \
&& sudo rm -rf LCD-show* \
&& sudo mkdir /etc/X11/xorg.conf.d \
&& sudo touch /etc/X11/xorg.conf.d/99-calibration.conf \
&& echo 'Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "3900 218 246 3832"
EndSection' | sudo tee /etc/X11/xorg.conf.d/99-calibration.conf;
To get more precise touch, adjust the 4 numbers according to YOUR calibration output by running the calibration utility from the LCD's GUI menu or over pushed from the SSH to your LCD with this command:
sudo DISPLAY=:0.0 xinput_calibrator
We moved to the latest Zulu (not the repo one as it is old):
https://community.openhab.org/t/howto-install-zulu-embedded-java-on-raspberry-pi-3/22589/37
sudo apt purge -y zulu-embedded-8;
sudo mkdir /opt/jdk/ \
&& cd /opt/jdk \
&& sudo wget https://cdn.azul.com/zulu-embedded/bin/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz \
&& sudo tar -xzvf zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz \
&& sudo update-alternatives --install /usr/bin/java java /opt/jdk/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf/bin/java 8 \
&& sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf/bin/javac 8 \
&& sudo rm zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf.tar.gz;
sudo update-alternatives --config java
Confirm there is only one alternative
sudo update-alternatives --config javac
Confirm there is only one alternative
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;
After reboot, wait for OpenHAB to load and visit http://[RASPI_IP]:8080
Select Standard (and wait...)
Go to PaperUI > Addons
Bindings Install: Exec, GPIO, HTTP, MQTT
Misc Optional: openHAB Cloud Connector
Transformations Install: Map, Regex
User Interfaces: Basic UI, Paper UI (remove the rest)
sudo rm -rf /home/pi/git \
&& mkdir /home/pi/git \
&& cd /home/pi/git/ \
&& git clone --single-branch --branch ONE 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 updateone.sh \
&& touch /tmp/publicip \
&& sudo chmod 777 /tmp/publicip \
&& sudo ./updateone.sh;
HestiaPi reboots...
sudo rm -rf /home/pi/git
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 unmask hostapd \
&& sudo systemctl enable hostapd \
&& sudo systemctl start hostapd && sudo systemctl start dnsmasq;
nano 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>
Hide a Jessie bug of turnkey
sudo nano raspberry-pi-turnkey/startup.py
checkwpa = True
valid_psk = True
checkwpa = False
# while checkwpa:
# with open(wpalog, 'r') as f:
# content = f.read()
# if success in content:
# valid_psk = True
# checkwpa = False
# elif fail in content:
# valid_psk = False
# checkwpa = False
# else:
# continue
sudo nano /etc/rc.local
Add this above exit 0:
su pi -c '/usr/bin/sudo /usr/bin/python3 /home/pi/scripts/raspberry-pi-turnkey/startup.py &'
su -l pi -c 'sudo xinit /home/pi/scripts/kiosk-xinit.sh'
cd ~ \
&& wget http://steinerdatenbank.de/software/kweb-1.7.9.8.tar.gz \
&& tar -xzf kweb-1.7.9.8.tar.gz \
&& cd kweb-1.7.9.8 \
&& ./debinstall \
&& cd ~ \
&& rm -rf kweb-1.7.9.8 kweb-1.7.9.8.tar.gz;
No optimisation