Skip to end of metadata
Go to start of metadata

Component list

  1. Raspberry Pi
  2. DHT11/22 or AM2302 temperature and humidity sensor
  3. 4.7K or 10K resister
  4. Breadboard
  5. Jumper wires

1. Overall idea

The overall idea of this implementation is, simply send email alert to predefined user, when exceeding the predefined threshold temperature value. We have a temperature/humidity monitoring device and it send temperature/humidity readings to Gadgetkeeper server periodically. We have already defined a set of rules about the threshold values on Gadgetkeeper when we create the "Event and trigger". So that it can trigger the event and send the email notification if the threshold value is exceeded.

2. How to prepare the RPI and sensor Hardware

First follow the step by step tutorial on this url to prepare the RPI and sensor hardware.Temperature monitoring with Raspberry Pi and DHT11/22 temperature and humidity sensor

You only need to follow the steps from 1 to 4. Assuming that now we have the working scripts and you can follow the instructions given below.

3. Create Event and Trigger on GadgetKeeper

Follow the step by step instructions on this URL and create "event and trigger" Create Event And Trigger .(You can manually test the email notification as described on step 4)

4. Prepare the Scripts

Next step is prepare the relevant script to fetch the sensor reading and upload it to Gadgetkeeper.

Set the execute permission for the script as follows,

5. Test the script

Now you can test the script as follows. The script accept 3 arguments and behave accordingly. These are the options that support by the script.

  1. Update the Temperature to Gadgetkeeper
  2. Update the Humidity to Gadgetkeeper
  3. Send Test value to trigger the event for testing purpose

You can try each of above options as follows.


How to see all available options.

Update the Temperature to Gadgetkeeper

Update the Humidity to Gadgetkeeper

Send Test value to trigger the event for testing purpose

6.Exception handle and error messages

Script return some error messages depending on some conditions. These are the basic error messages thrown by the script and reason for them.

Error.please try again!

This error message appears when the curl request fails. It can be due to network problem or connection problem to the server.

Event update: FAIL

This error message appears when we query the sensor too quick. (In such case the sensor doesn't return temperature/humidity reading and, this error thrown due to the null reading from the sensor)

7. Automatically update the sensor value to Gadgetkeeper

Add a cronjob as follows. It will update the sensor reading every minute to the Gadgetkeeper 

  • No labels