Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions content/components/sensor/dht.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,40 @@ sensor:
- **update_interval** (*Optional*, [Time](#config-time)): The interval to check the
sensor. Defaults to `60s`.

## Sensor halting

A possible solution is to use a GPIO port as power supply and restart the sensor on error.

```yaml
switch:
- platform: gpio
pin: GPIO12
id: pwrsensor
name: "Power for sensor"
restore_mode: ALWAYS_ON

sensor:
- platform: dht
pin: GPIO14
temperature:
name: "Temperature"
id: current_temperature
on_value:
then:
- if:
condition:
- lambda: "return isnan(x);"
then:
- switch.turn_off: pwrsensor
- delay: 5s
- switch.turn_on: pwrsensor
humidity:
name: "Humidity"
id: current_humidity
update_interval: 30s
model: AM2302
```

{{< note >}}
The default `accuracy_decimals` value of the *humidity* levels is `0`, as the DHT11 for which this was
originally written does not have a higher resolution. All other DHT sensors have a higher resolution, it's worth
Expand Down