My RPi HVAC Project

When I got my first Pi I started with some basic projects. I learned how to control relays, how to take temperature readings, how to build a LAMP stack, as well as many other projects. I learned a lot about Linux and Python.

I decide to try and control my home furnace and air conditioner from a Pi. Seemed like a simple project: read the temperature, turn the furnace on or off. It’s not that straightforward.

I got the sensors and the relays working. I stored settings and temperatures in a database. Now I needed an interface. I got a web server running and set out to build a secure interface with a public and private side that would interact with database. It didn’t take long to see that WordPress was a lot better solution than anything I could come up with.


echo "
config wifi-device 'radio0'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'platform/soc/fe300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'
        option htmode 'VHT80'

config wifi-iface 'wifinet0'
        option device 'radio0'
        option mode 'sta'
        option network 'wwan'
        option encryption 'psk2'
        option ssid 'cat'
        option key 'huskerpower'

" > /etc/config/wireless

echo "

config interface 'wwan'
        option proto 'dhcp'

" >> /etc/config/network


opkg update
opkg install luci-ssl-nginx
opkg install openssh-sftp-server
opkg install nano

opkg install kmod-usb-net-rtl8152
opkg install kmod-usb-net-asix-ax88179

opkg install openvpn-openssl
opkg install luci-app-openvpn

Chromium Media Edition for RPi Pixel

Chromium sucks for streaming on the Raspberry Pi Pixel Desktop. One of my gripes was Youtube TV, ‘format not supported.’ Chromium Media Edition is much better. Ventz Petkov has a sweet install script. Here’s the tl;dr version.

curl -fsSL https://pi.vpetkov.net -o ventz-media-pi
sh ventz-media-pi

Check out his article at Raspberry Pi Netflix One Line Easy Install – along with Hulu, Amazon Prime, Disney Plus, HBO, Spotify, Pandora, and many others

Famous 10 Minute WordPress Install

WordPress touts their install to be 5 minutes. I take it a step further. This script can take a freshly mint SD card and install a LAMP stack, phpMyAdmin, and WordPress in about 10 minutes.


wget https://github.com/huskerjason/raspberry-press/archive/master.zip
unzip master.zip
cd raspberry-press-master
bash install.sh

RPi Speed and Temp

clear && printf 'current\n' && sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq && printf '\nmin\n' && sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq && printf '\nmax\n' && sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq && printf '\ntemp\n' && cat /sys/class/thermal/thermal_zone0/temp && echo



Start Up with New User

sudo nano /boot/firmware/config.txt


# Clone a user and prvileges. I got most of my information from
# https://unix.stackexchange.com/questions/204970/clone-linux-user-copy-user-based-on-another-one

# New user and password

# user to be cloned, $USER is the current user. 

# get the groups the source user belongs to
SRC_GROUPS=$(id -Gn ${SRC_USER} | sed "s/ /,/g" | sed -r 's/\<'${SRC_USER}'\>\b,?//g')

# get the shell of the source user
# SRC_SHELL=$(awk -F : -v name=${SRC_USER} '(name == $1) { print $7 }' /etc/passwd)
# Rasbian defaults to bash, Ubuntu to sh. I like bash better.

# create user then add the password
sudo useradd --groups ${SRC_GROUPS} --shell ${SRC_SHELL}  --create-home ${NEW_USER}
echo "${NEW_USER}:${NEW_PASS}" | sudo chpasswd

# The new user will be asked their password and I don't like that. This stops it.
echo | sudo EDITOR='tee -a' visudo
echo '# Stop asking for my password' | sudo EDITOR='tee -a' visudo
echo "${NEW_USER} ALL=(ALL) NOPASSWD: ALL" | sudo EDITOR='tee -a' visudo

# change the timezone and here are the common US zones
#            America/New_York 
#            America/Chicago 
#            America/Denver 
#            America/Los_Angeles 
sudo timedatectl set-timezone America/Detroit

# Gotta always do this
sudo apt update
sudo apt upgrade -y
sudo apt clean

# Raspbian doesn't have git and Ubuntu doesn't have unzip.
sudo apt install git unzip -y

# # RPi4 overclocking
# sudo sed -i 's|^#arm_freq=800|arm_freq=2147|' /boot/config.txt
# sudo sed -i '/arm_freq=/ a gpu_freq=750' /boot/config.txt
# sudo sed -i '/arm_freq=/ a over_voltage=6' /boot/config.txt
# sudo sed -i '/arm_freq=/ a \\n# adding gpu_freq and over_voltage settings' /boot/config.txt



sudo sshfs -o allow_other,default_permissions root@xxx.xxx.xxx.xxx:/ /mnt/droplet
sudo sshfs -o allow_other,default_permissions pi@ /mnt/hvac/home

sudo sshfs -o allow_other,default_permissions pi@ /mnt/hvac/wp-content

sudo nano /etc/fstab
sshfs#pi@ /mnt/hvac/home
sshfs#pi@ /mnt/hvac/wp-content

Vivaldi for RPi Pixel

Chromium sucks for streaming on the Raspberry Pi Pixel Desktop. One of my gripes was Youtube, if I fast forward (hitting the arrow key) to advance through a video, ‘Aw, Snap!’ was sure to pop up. It’s a lot less of a problem if you’re over clocking. Chromium Media Edition has the same problem too. It’s not a problem if you’re using Vivalda.

Grab the Linux DEB ARM version.