Creating our dashboard using CherryPy

In Chapter 7, Setting Up a Raspberry Pi Web Server, we created a weather dashboard using the Bootstrap framework with the WeatherDashboardHTML.py file. We will revisit that code and modify it for our home security dashboard.

To create our home security dashboard, do the following:

  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:
import cherrypyfrom SecurityData import SecurityDataclass SecurityDashboard:        def __init__(self, securityData):        self.securityData = securityData        @cherrypy.expose    def index(self):        return """               <!DOCTYPE html>                <html lang="en">                <head>                    <title>Home Security Dashboard</title> <meta charset="utf-8"> ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.