Temperature and Humidity monitoring Module for MagicMirror2 This module works for DHT11, DHT22 and AM2302 sensors.
- An installation of MagicMirror2
- npm
- rpi-dht-sensor
-
Clone this repo into
~/MagicMirror/modules
directory. -
Configure your
~/MagicMirror/config/config.js
:{ module: 'MMM-Temperature-Humidity', position: 'top_right', config: { ... } }
-
Run command
npm install
in~/MagicMirror/modules/MMM-STT
directory. -
Run command
sudo apt-get install rpi-dht-sensor
. -
sudo npm start in
~/MagicMirror
.
Option | Default | Description |
---|---|---|
refreshInterval |
50000 |
Time in milli seconds before successive readings are taken. |
temperaturePrefix |
'Room temperature: ' |
Text to display as prefix of Temperature Reading |
temperatureSuffix |
'°C' |
Text to display as suffix of Temperature Reading |
humidityPrefix |
'Humidity: ' |
Text to display as prefix of Humidity Reading |
humiditySuffix |
'%' |
Text to display as suffix of Humidity Reading |
Principle is to poll the sensor every set time period for a reading and display the same to the mirror
Note : This module uses the BCM2835 library that requires access to /open/mem. Because of this, you will typically run node with admin privileges.
Also, these values are hard coded in node_helper.js
sensorType and Pin Number-
var dht = new rpiDhtSensor.DHT11(2);
USAGE : var dht = new rpiDhtSensor.DHT22(pinNumber);//For DHT22 Type sensor var dht = new rpiDhtSensor.DHT11(pinNumber);