Skip to content

BKeyport/MMM-DHT-Sensor

 
 

Repository files navigation

NOTE: THIS MODULE IS TO BE HOSTED ONLY AT https://github.com/BKeyport/MMM-DHT-Sensor - Any other hosting location is invalid.

MMM-DHT-Sensor

This a module for the MagicMirror.

This module gets data form DHT11, DHT22 and AM2302 sensors.

bcm2835

This module uses node-dht-sensor to get the sensor data, and this module depends on bcm2835 to do so, therefore you need to install it in your Pi in order to use this module.

cd ~
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz
tar zxvf bcm2835-1.52.tar.gz
cd bcm2835-1.52
./configure
make
sudo make check
sudo make install

Installation

git clone https://github.com/ryck/MMM-DHT-Sensor.git
cd MMM-DHT-Sensor
npm install

Config

The entry in config.js can include the following options:

Option Description
sensorPin Required This is the GPIO pin the sensor is connected to. Note: This is not the hardware pin number.

Type: integer
sensorType Required This is the the sensor type. It should work for DHT11, DHT22 and AM2302 sensors

Type: integer
Possible values: 11 for DHT11 or 22 for DHT22 / AM2302
units What units to use. Specified by config.js

Type: string
Possible values: config.units = Specified by config.js, metric = Celsius, imperial =Fahrenheit
Default value: config.units
updateInterval How often the sendor data is updated.

Type: integer
Default value: 1 hour
relativeScale Relative scale to choose the temparature icon.

Type: integer
Default value: 30
initialLoadDelay The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)

Type: integer
Possible values: 1000 - 5000
Default value: 0
animationSpeed Speed of the update animation. (Milliseconds)

Type: integer
Possible values:0 - 5000
Default value: 1000 (1 second)
debug Show debug information.

Possible values: true or false
Default value: false

Here is an example of an entry in config.js

{
	module: "MMM-DHT-Sensor",
	position: "top_right",
	header: "Upstairs",
	config: {
		sensorPin: 2,
		sensorType: 22,
		updateInterval: 60 * 60 * 1000,
		initialLoadDelay: 0,
		animationSpeed: 1000,
		units: "metric",
		relativeScale: 35,
		debug: false
	}
},

Notes

Notifications

This module implements the following notifications:

  • INDOOR_TEMPERATURE (int) Temperature in Celsius
  • INDOOR_HUMIDITY (int) Humidity in relative humidity (%)

Dependencies

Issues

WARNING! Could not load config file. Starting with default configuration. Error found: Error: The module '/home/pi/MagicMirror/modules/MMM-DHT-Sensor/node_modules/node-dht-sensor/build/Release/node_dht_sensor.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 53. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).

If you get this error after installing the module (or your MagicMirror is just a black screen) try this:

cd MMM-DHT-Sensor
npm install electron-rebuild
./node_modules/.bin/electron-rebuild

Thanks To...

About

Magic Mirror 2 module to get data form DHT11, DHT22 and AM2302 sensors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.9%
  • CSS 1.1%