Homebridge plugin for the Sensirion SHT3x humidity and temperature sensor. Uses raspi-node-sht31 to communicate with the device and fakegato-history to show historical data graphs when using the Eve app.
Breakout boards for the SHT31 sensor are available from Adafruit or AliExpress.
This plugin has only been tested on a Raspberry Pi, but should work with any Linux-based board supported by i2c-bus, including C.H.I.P., BeagleBone, or Intel Edison.
Refer to your board documentation for instructions on how to enable the I²C interface and how to connect an I²C device. The i2c-bus documentation also includes a few examples.
Node.js v10.17.0 or greater is required.
This assumes Homebridge has already been installed. If not, see the Homebridge documentation for more information.
If using Homebridge Config UI X, search for the plugin in the Plugin screen, and install it from there. Otherwise you can install it manually with:
sudo npm install -g homebridge-sht3x
If using Homebridge Config UI X, you can configure the plugin from the graphical
settings editor, or you can edit the config.json
file manually.
The minimal accessory configuration, containing only the required attributes, is as follows:
"accessories": [
{
"accessory": "SHT3x",
"name": "SHT31"
}
]
See config-sample.json for a complete example.
The following table shows the list of supported configuration parameters:
Attribute | Description |
---|---|
accessory |
Accessory name registered with Homebridge. Has to be "SHT3x" . |
name |
Display name for the sensor. Can be anything you want. |
address |
I²C address of the sensor. Possible values are "0x44" (default) or "0x45" . |
bus |
I²C bus number. Defaults to 1 . See the I²C setup section below. |
interval |
Time interval at which the device is polled, in seconds (default: 60 ). |
history |
Options passed to fakegato-history as an object. Empty by default. |
The default I²C bus number (1
) is used by most Raspberry Pi models, except for
the early Raspberry Pi Model B (256MB) which uses bus number 0
. On other
boards, available buses typically are 1
or 2
on a C.H.I.P., 0
, 1
, or 2
on a BeagleBone, and 1
or 6
on an Intel Edison. Consult your board
documentation for details, and run i2cdetect -l
to list the available I²C
buses.
The I²C address for the SHT3x sensor is 0x44
by default, or 0x45
if the ADDR
pin is connected to logic high.
By default Fakegato saves history to memory, and data not yet downloaded by the Eve app will be lost when Homebridge is restarted. If you want to save history to disk instead, add the following line to the accessory configuration:
"history": {"storage": "fs"}
Data will be saved in a JSON file located in the Homebridge directory
(~/.homebridge
by default unless redefined with the -U
option) and read upon
restart. In order to store the file elsewhere, use the path
option:
"history": {
"storage": "fs",
"path": "/tmp"
}
See the Fakegato documentation for more information on available options.
Also note that Fakegato will automatically average out measurements and log an
entry to history every 10 minutes. If you want the history feature to work
reliably and avoid holes in the data, interval
should be no more than 600
.