HTS221 I2C humidity and temperature sensor
npm install hts221-sensor


HTS221 I2C temperature and humidity sensor module for Node.js on Linux boards
like the Raspberry Pi or BeagleBone.
Supports Node.js versions 10, 12, 14, 15 and 16.
* Features
* Installation
* Usage
* Report Temperature and Humidity
* Report Temperature and Humidity Continuously
* API
* Related Packages
* Simple temperature and humidity sensing
* Promise based asynchronous API
```
npm install hts221-sensor
#### Report Temperature and Humidity
`js
'use strict';
const hts221 = require('hts221-sensor');
hts221.open().then(sensor =>
sensor.read().
then(reading => {
console.log('celsius: ' + reading.celsius);
console.log('humidity: ' + reading.humidity);
}).
then(_ => sensor.close())
).catch(console.log);
`
#### Report Temperature and Humidity Continuously
`js
const hts221 = require('hts221-sensor');
hts221.open().then(sensor =>
setInterval(_ =>
sensor.read().
then(reading => {
console.log('celsius: ' + reading.celsius);
console.log('humidity: ' + reading.humidity);
}).catch(console.log),
1000
)
).catch(console.log);
``
- [open([options])](#openoptions)
#### open([options])
Returns a promise for a Hts221 object.
The following options are supported:
- i2cBusNumber - integer, I2C bus number, optional, default 1
- i2cAddress - integer, Hts221 I2C address, optional, default 0x5f
#### close()
Returns a promise which will resolve when all resources used by the HTS221
object have been freed.
#### read()
Returns a promise for an object containing a
sensor reading.
- onoff - GPIO access and interrupt detection
- i2c-bus - I2C serial bus access