Tool v1.0.0

dht11-temp

从DHT11传感器读取温湿度,支持通过CLI参数或环境变量自定义GPIO引脚

ClawHub 更新于 2026-03-25 14 浏览
下载 SKILL

技能说明

从DHT11传感器读取温湿度,支持通过CLI参数或环境变量自定义GPIO引脚

使用场景

Reads temperature and humidity from DHT11 sensor with customizable GPIO via CLI or environment variable

查看英文原始说明

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

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/dht11-temp
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 9.7 kB
SKILL.md text/markdown
---
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

```bash
# Install dependencies
pip3 install RPi.GPIO
```

## Usage

### Read Sensor (default pin 19)
```bash
sudo python3 scripts/dht/main.py
```

### Read Sensor (custom pin)
```bash
sudo python3 scripts/dht/main.py 4     # Uses GPIO 4
```

### Using Environment Variable
```bash
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

```bash
# Read every 30 minutes
*/30 * * * * sudo python3 ~/scripts/dht/main.py >> /var/log/dht.log 2>&1
```

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。