dht-express
A simple express webserver serving data of the DHT11/ DHT22 temperature and humidity sensors.
Installation
You need to install the Broadcom BCM 2835 libary first.
After that clone the repository.
git clone https://github.com/edjopato/dht-express.gitcd dht-expressnpm install
If you want to include the endpoint in your existing Express webserver take a look in the topic at the end of the README
Configuration
Remember to configure the webserver in the standalone.js after the comment
// add more sensors on routes hereapp.use( '/', sensor( 11, 4 ) );
You have to configure the express route, the sensor type (11 or 22 for DHT11/ 22) and the pin.
Run
This module uses the BCM2835 library through node-dht-sensor that requires access to /open/mem. Because of this, you will typically run node with admin privileges.
npm start
After that you can configure and run homebridge with the homebridge-http-temperature-humidity plugin.
Include in existing express webserver
Install in your project
npm install --save dht-express
use in your project
you can use every other express router
var sensorRouter = requires('dht-express');...app.use( '/my/super/route', sensor( type, pin ) );
Don't forget the admin privileges of this module (run with sudo)