-
Notifications
You must be signed in to change notification settings - Fork 131
Raspberry Pi
This page will describe how to set up a Raspberry Pi mini computer to run MisterHouse including the Insteon PLM.
- About the Raspberry Pi
- Step 1, Getting the Pi to boot
- Step 2, Configure the Operating System
- Step 3, MisterHouse installation
- Step 4, MisterHouse Configuration
- Post installation steps
- Things to avoid on the Pi
The Raspberry Pi is a credit-card sized computer originally designed for educational purposes in the UK, but it's taken off as a platform for low cost, low power hobby computing projects. It works wonderfully as a full MisterHouse server. There are now 4 generations of Raspberry Pi from the Model A to the Pi 4, the original Raspberry Pi (Model A) had 256mb memory and one USB port and sold for less than $25, for todays like up, please see The Raspberry Pi Web site. Pis have GPIO pins that can be used for advanced projects. We have seen MisterHouse running on all models of Pi, except the Pi Zero which may be a little underpowered (can anyone confirm/deny this?)
MisterHouse setup is actually easier than installing unix on an old spare machine because the operating system comes as an image already setup with all the drivers for the hardware and it even includes all the software you need for a typical MisterHouse installation. More about the raspberry Pi can be found here
There is a number of ways to get you Pi to boot from your chosen media with excellent guides on the internet and in these pages, they mostly rely on booting from a Micro Sd card, then migrating to a USB disk later;
- The simplest way is to use the raspberry Pi Imager
- You can use an image as described here
These instructions assume you have your Pi connected to a screen via HDMI and a USB keyboard and mouse.
Next you need to make changes to enable remote log in by SSH, static IP address etc. Note that if you used the Pi Imager, some of these steps may have already been done during the initial boot.
Open a terminal window on the Pi and run sudo raspi-config
and set the following;
- change the pi password from raspberry
- set timezone and locale,
- set hostname
- enable GPIO access(if needed)
You will need to `sudo reboot' for these to take effect.
Next (if you skipped this during the initial boot up) you need to make sure your Pi has the latest updates. Open a terminal window and run;
sudo -s
apt-get update
apt-get upgrade
If you need to change the password again, use the passwd
command
If you want to boot from a USB device, the mechanism is different for different models of Pi, see here for details.
Edit /etc/dhcpcd.conf
(e.g. sudo nano /etc/dhcpcd.conf
to add the following at the end
/*
interface eth0
static ip_address=192.168.100.66
static routers=192.168.100.1
static domain_name_servers=192.168.100.1
In this example my ip address is 192.168.100.66
etc..
You need to sudo reboot
for these to take effect
To check if the IP address is correct
ifconfig -a
Some installs did not include nslookup
, if this command fails, you need to sudo apt-get install dnsutils
See here for how to set up the hardware watchdog.
First you need to set up the pi to use your chosen sound output (HDMI or 3.3mm jack) see here
The alsa-utils
package comes ready installed on the default Pi distribution. This page has good instructions on the sound options for Raspberry Pi
- check the hostname (this will allow you to
ssh hostname.local
instead of remembering the IP address) by enteringhostname
, if its wrong, change it using sudoraspi-config
- check the date and time is correct by typing
date
, some installs had errors see here for advice.
Follow instructions in the wiki for initial MisterHouse setup.
You should not encounter any errors running the standard MisterHouse with Insteon support enabled as the Perl frameworks and modules it needs should come pre-installed on the Pi's OS.
That being said, if you get an error like Can't locate foo/bar.pm in @INC
it means that the perl module foo:bar
has not been installed. To fix this run;
sudo perl -MCPAN -e shell
install foo:bar
exit
Using the MCPAN shell like this allows you to do many installs in one session.
If this fails to install your chosen module, e.g. vsLock try;
sudo -s
apt-get install cpanminus
cpanm install vsLock
There is a number of mechanisms for this;
- The simplest mechanism is SFTP - this will work with the same userid and password as you use for SSH
- Samba share the Pi's Disk
- NFS mount a drive onto your Pi
-
winscp on Windows but if you're running Unix or Mac, you should have the scp command already built in. With WinSCP, make sure to choose
SCP
from the pulldown menu instead ofSFTP
. Usepi
as the user name and whatever password you set.
If you are using a SD disk it is good practice to increase the SD card life by minimising the number of times MisterHouse writes to it. See here for details.
Two techniques for auto-starting MisterHouse are described here
Dont forget the post installation steps described here
See here for how to use Houselinc using a PLM connected to a Pi.
PLMTerminal.pl
is useful for sending raw Insteon commands to your network through your PLM and looking at the raw responses. This is probably something only a MisterHouse developer would need to do, but here's how to do it in case anyone needs it:
sudo cpan install Term::ReadKey
cd /home/pi/MisterHouse/misterhouse/lib/Insteon
./PLMTerminal /dev/ttyUSB0**
If you want to add support for a new Insteon device but you can't find its commands documented, try using HouseLinc to control the device. Set HouseLinc logging level to Trace
and look at C:\Users\Public\SmartLabs\HouseLinc\Logs\HouseLinc.log
to see what commands are being sent/received. If the log isn't working you can also run a network packet sniffer like Wireshark if you're connecting to the PLM over the network.
The Leafpad
text editor is far too simplistic for editing MisterHouse code. It doesn't even have a way to search upward for matches instead of downward. geany
is an excellent alternative (install using sudo apt-get install geany
) Note that geany
will use more memory and run slower than Leafpad
but even with geany
and MisterHouse running for six days a Pi model B is only at 35% CPU and 120mb free memory.
We suspect that LXTerminal
leaks memory because the longer you leave it running, the less memory you have, and closing it often frees a lot of memory.