Home security dashboard with quick response

You may have noticed that it takes a really long time for our page to refresh. This is due to the 30-second refresh time, of course, as well as the long time it takes for the DHT11 to read a value.

Let's change our code to make it quicker, and give it a buzzer to scare away an intruders.

Replace the DHT11 with a buzzer connected to GPIO pin 17 (we shouldn't need a Fritzing diagram for this simple change).

We will start by creating the SecurityDataQuick data class:

  1. Open up Thonny from Application Menu | Programming | Thonny Python IDE
  2. Click on New to create a new file
  3. Type the following into the file:
from gpiozero import MotionSensorfrom gpiozero import Buttonfrom datetime import datetimefrom ...

Get Internet of Things Programming Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.