Run your home on a Raspberry Pi
This week we’re joined by Mike Riley and we’re talking about his book Portable Python Projects (Running your home on a Raspberry Pi). We breakdown the details of the latest Raspberry Pi hardware, various automation ideas from the book, why Mike prefers Python for scripting on a Raspberry Pi, and of course why the Raspberry Pi makes sense for home labs concerned about data security.
Use the code PYPROJECTS
to get a 35% discount on the book. That code is valid for approximately 60 days after the episode’s publish date.
Discussion
Sign in or Join to comment or subscribe
Sylvain
2022-05-14T22:01:42Z ago
I you are starting your home automation journey, I strongly suggest to have a look at the Home Assistant project.
It integrates with a ton of devices and can run on Raspberry PIs.
I use AppDaemon for scripting automations with Python.
Hank Barta
2022-05-18T20:50:31Z ago
This episode resonated with me in so many ways. I have a small army of Raspberry Pis helping with some home automation tasks (which are mostly home monitoring at this point.) I’ll start with a quick description of my setup and add posts for other topics to avoid going too long going too long on this one.
I’m running Homeassistant in a Docker container on a Pi 3B with Mosquitto MQTT broker and MariaDB also in Docker containers. I’m using the 64 bit variant of R-Pi OS because (IIRC) I could not find a 32 bit ARM Docker image for MariaDB. I used to keep the MariaDB data store on a ZFS volume but a recent kernel upgrade caused the ZFS modules not to build. *I should consider moving this to a Pure Debian installation where stuff like this shouldn’t happen.) The CPU usage typically runs about 1-2% and free memory is about 570K. Of course, YMMV and my system only has about a half dozen MQTT messages/minute so traffic is pretty low. I suspect I would be memory constrained before I was CPU bound. And the system boots/runs from an SSD.
Regarding AWOL hosts (in my small army) I’ve started using the MQTT last will and testament facility so the broker reports if a host has not reported in a timely manner.
Refrigerator/freezer monitoring next.
Hank Barta
2022-05-18T21:16:28Z ago
I’m monitoring both refrigerator and freezer. My firs try was with a commercial freezer alarm. It required a small wire to extend past the freezer gasket. The tiny opening this caused in the gasket resulted in ice buildup in the freezer. I tried unsuccessfully building up around the wire with achieve a better seal. I finally switched to a flat ribbon cable (truly flat, not like the old style ATA or floppy drive cables) to get past the door socket and connected to a DS18B20 sensor. The sensor is monitored by a Pi Zero W which published temperature via MQTT. Today I would use an ESP8266/ESP32 instead of a Pi. I constructed a similar arrangement for monitoring refrigerator temperature. I also monitor energy usage for both refrigerator and freezer using smart plugs that are queried by a Linux host and published via MQTT. I need to close the loop for these but in the mean time I can glance at a plot of temperature or power usage on the Homeassistant overview and see if everything is OK.
Jerod Santo
Bennington, Nebraska
Jerod co-hosts The Changelog, crashes JS Party & takes out the trash (his old code) once in awhile.
2022-05-19T13:30:54Z ago
Are you happy with these? Can you provide links to the ones you’re using?
Why is that? I got a Pi from a friend and am going to try to monitor our freezer like I said on the show…
Hank Barta
2022-05-19T14:17:35Z ago
Here are the sensors. I used: https://smile.amazon.com/gp/product/B01IVMJ1L2/ They’ve been working for a couple years now with no problems. (*) I’ve also bought some of the waterproof ones but have not deployed them.
If you have a Pi already (hopefully one with WiFi) then use that. For a single task application the advantages I see for the ESP based devices include:
Disadvantages
(*) No sensor problems, that is. I did have one setup malfunction due to a bad solder connection that separated.
Hank Barta
2022-05-18T21:38:16Z ago
Other Pi tips:
raspi-config
settings.) Be sure to uninstallunattended-upgrades
or your Pi will come to a grinding halt when the firstapt update
runs and fills the writable space in the overlay. If you do want some writable space, an additional partition will remain writable when the boot and root partitions are read only.raspi-confiig
can be run non-interactively so that the overlay can be disabled prior to running update/upgrade. It will still require reboots before and after the upgrade. Should allow this to be done using Ansible.wpa_supplicant.conf
in the boot partition.touch ssh
in the boot partition to enable ssh. Put a properly configureduserconf.txt
in the boot partition to specify the user and password to use. (The folk that produce the Pi OS have finally eliminated the default user/password in their images.) With these changes you can boot a Pi headless first time, ssh in and perform further configuration. (I’m not sure I can post links but the info for these should be easily found.)/boot/config.txt
. I useThen I tie GPIO7 to GPIO3 and use a momentary push-button between GPIO7 and any convenient ground.