Now, we will set up the app and write the required code:
- From the Terminal, once you are inside the Google-IoT-Device folder, run the following command:
$ npm init -y
- Next, we will install jsonwebtoken (https://www.npmjs.com/package/jsonwebtoken) and mqtt (https://www.npmjs.com/package/mqtt) from npm. Execute the following command:
$ npm install jsonwebtoken mqtt--save
- Next, we will install rpi-dht-sensor (https://www.npmjs.com/package/rpi-dht-sensor) from npm. This module will help in reading the DHT11 temperature and humidity values:
$ npm install rpi-dht-sensor --save
- Your final package.json file should look similar to the following code snippet:
{ "name": "Google-IoT-Device", "version": "1.0.0", ...