dht11-temp

star 8

Read temperature and humidity from DHT11 sensor. Supports custom GPIO pins via CLI argument or environment variable.

modbender By modbender schedule Updated 3/6/2026

name: dht11-temp description: Read temperature and humidity from DHT11 sensor. Supports custom GPIO pins via CLI argument or environment variable. metadata: {"openclaw": {"emoji": "๐ŸŒก๏ธ", "requires": {"bins": ["python3", "sudo", "RPi.GPIO"]}}}

DHT11 Temperature & Humidity Sensor

Read temperature and humidity from a DHT11 sensor.

Hardware Setup

Wiring (adjust pin as needed):

DHT11 Pinout:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1. VCC     โ†’ 5V (Pin 2 oder 4)
2. DATA    โ†’ GPIO <PIN> + 10K Pull-Up Widerstand โ†’ 5V
3. GND     โ†’ GND (Pin 6)

Important: The 10K pull-up resistor must be connected between DATA and VCC (5V)!

Installation

# Install dependencies
pip3 install RPi.GPIO

Usage

Read Sensor (default pin 19)

sudo python3 scripts/dht/main.py

Read Sensor (custom pin)

sudo python3 scripts/dht/main.py 4     # Uses GPIO 4

Using Environment Variable

export DHT_PIN=4
sudo python3 scripts/dht/main.py

Output

  • Line 1: Temperature (ยฐC)
  • Line 2: Humidity (%)

Customization

Variable Default Description
DHT_PIN 19 GPIO pin number

Example crontab entry

# Read every 30 minutes
*/30 * * * * sudo python3 ~/scripts/dht/main.py >> /var/log/dht.log 2>&1
Install via CLI
npx skills add https://github.com/modbender/skill-library-mcp --skill dht11-temp
Repository Details
star Stars 8
call_split Forks 2
navigation Branch main
article Path SKILL.md
More from Creator