Skip to main content

A web connected DHT sensor reading temperature and humidity values on Raspberry Pi

Project description

pi_dht_webthing

A web connected humidity and temperature sensor

This project provides a webthing API to a DHT11 or DHT22 humidity and temperature sensor running on a Raspberry Pi. As a webthing, the DHT sensor can be discovered and used by home automation systems or custom solutions supporting the webthing API.

The pi_dht_webthing exposes an http webthing endpoint which supports reading the humidity and temperature sensor values via http. E.g.

# webthing has been started on host 192.168.0.23

curl http://192.168.0.23:8070/properties 

{
   "temperature" : 17.3,
   "humidity" : 79.9
}

A RaspberryPi/DHTxx hardware setup and wiring may look like DHT22 example.

To install this software you may use Docker or PIP package manager such as shown below

** Docker approach**

sudo docker run --privileged -p 8070:8070 -e gpio=2 grro/pi_dht_webthing:0.1.0

PIP approach

sudo pip install pi_dht_webthing

After this installation you may start the webthing http endpoint inside your python code or via command line using

sudo dht --command listen --h--port 8070 --gpio 2

Here, the webthing API will be bind on port 8070 and be connected to the DHTxx signal pin using gpio 2

Alternatively to the listen command, you can use the register command to register and start the webthing service as systemd unit. By doing this the webthing service will be started automatically on boot. Starting the server manually using the listen command is no longer necessary.

sudo dht --command register --port 8070 --gpio 2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pi_dht_webthing-0.1.1.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

pi_dht_webthing-0.1.1-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page