Skip to Main Content
Raspberry Pi Cookbook, 4th Edition
book

Raspberry Pi Cookbook, 4th Edition

by Simon Monk
December 2022
Beginner to intermediate content levelBeginner to intermediate
618 pages
12h 41m
English
O'Reilly Media, Inc.
Book available
Content preview from Raspberry Pi Cookbook, 4th Edition

Chapter 18. Home Automation

18.0 Introduction

As a low-cost and low-power device, a Raspberry Pi makes a great home automation hub that you can leave running without fear of huge electricity bills. For the recipes described in this chapter, you don’t need the power of a Raspberry Pi 4 or 400. In fact, a Raspberry Pi 2 or 3 will be plenty fast enough and will run cooler and use less electricity than a Raspberry Pi 4.

We start with Message Queuing Telemetry Transport (MQTT), the basic communication mechanism for most home automation systems, and then move on to look at using Node-RED (which you first met in Chapter 17) as a basis for home automation.

Strictly speaking, home automation is all about making your home smarter and more able to do things for itself—for example, to turn on a light for a set amount of time when movement is detected, or to automatically turn everything off at bedtime. But most people who are interested in home automation are also interested in remote control of the parts of their home that have been automated. We also look at remote control by smartphone in this chapter.

18.1 Making a Raspberry Pi into a Message Broker with Mosquitto

Problem

You want to make your Raspberry Pi a hub for your home automation system capable of using the Mosquitto MQTT software.

Solution

Install the Mosquitto software so that your Raspberry Pi can act as an MQTT broker.

Run the following commands to install Mosquitto and start it as a service so that it automatically starts ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Raspberry Pi Cookbook, 3rd Edition

Raspberry Pi Cookbook, 3rd Edition

Simon Monk
bash Cookbook, 2nd Edition

bash Cookbook, 2nd Edition

Carl Albing, JP Vossen
Getting Started With Arduino, 4th Edition

Getting Started With Arduino, 4th Edition

Massimo Banzi, Michael Shiloh

Publisher Resources

ISBN: 9781098130916Errata PageSupplemental Content