Configuring the modules

We are now going to configure each of the modules of our home automation system, so we can access them remotely later. The goal here is to configure the modules to respond to commands coming from our central server and to not act as independent units, as shown in earlier chapters.

Let's start with the sensors module; this is the complete code for this module:

// Modules var express = require('express'); var sensorLib = require('node-dht-sensor'); // Express app var app = express(); // aREST var piREST = require('pi-arest')(app); piREST.set_id('4g0d7f'); piREST.set_name('sensor_module'); piREST.set_mode('bcm'); // Start server app.listen(3000, function () { console.log('Raspberry Pi Zero motion sensor started!'); }); // Sensor ...

Get Building Smart Homes with Raspberry Pi Zero 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.