Skip to main content

dhtsensor

Simplifies reading temperature and humidity data from a DHT11/22 sensor using pigpio

Requirements

pip install pigpio

Install

pip install dhtsensor

Quickstart

# Create a new Sensor object for a DHT22 temperature and humidity sensor
# GPIO to read from: 21
# GPIO that powers the sensor: 20
from dhtsensor.sensor import Sensor
s = Sensor(pi, 21, powered_by=20)

# Turn on power to the sensor
s.activate()

# Get temperature and humidity measurement from the sensor
# Do not call read_once repeatedly! Use .read instead
reading = s.read_once()

# Temperature and humidity as separate variables
temp, rh = s.read_once()

# Read from the sensor 10 times, with a 5-second interval between reads
# Outputs a list of 10 Reading objects
reading = s.read(10, interval=5)

Acknowledgment

pigpio Python examples

Contact

kentkawashima@gmail.com

License: MIT License

Release files for dhtsensor 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dhtsensor 0.2.0
File Size Uploaded
dhtsensor-0.2.0.tar.gz 4.0 kB Details

Release files / dhtsensor-0.2.0.tar.gz

Download URL dhtsensor-0.2.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7402474db8e9023c5ceb47b69a6d571deed773030e49953894649fd1a33a4038
BLAKE2b-256 checksum
How to use checksums
dacf32c3d05655330734edeb386bef9bbdbe0364fb31ab747c04f04f22025878
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page