Skip to content
This repository was archived by the owner on Oct 31, 2020. It is now read-only.

Create NodeMCU-DHT11 #22

Merged
merged 1 commit into from
Oct 13, 2019
Merged
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
98 changes: 98 additions & 0 deletions _devices/NodeMCU-DHT11
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
title: NodeMCU ESP8266 with Temperature & Humidity Sensor (DHT11)
date-published: 2019-10-13
type: sensor
standard: global
---

1. TOC
{:toc}

## GPIO Pinout

| Pin | Function |
|---------|------------------------------------|
| GPIO5 | Temperature & Humidity Input |


# This Configuration uses "substitutions" to enable you to have multiple devices of the same type
# while allowing you to only need to change a minimal device specific yaml configfuration file
# by adding specified substutions.

# Then at compile time the two files are merged.

## Device Specific Configuration (Substitution) Yaml File
```yaml
substitutions:
name: nodemcu_lr
ip: 192.168.1.21
friendly_name: Livingroom Sensor
friendly_name_temp: Livingroom Temperature
friendly_name_humidity: Livingroom Humidity
<<: !include common_nodemcu_dht11.yaml
```

## Common Configuration File (common_nodemcu_dht11.yaml)
```yaml
esphome:
name: ${name}
platform: ESP8266
board: nodemcuv2

wifi:
#hostname: ${name}
ssid: !secret wifi_ssid
password: !secret wifi_pwd
fast_connect: true
manual_ip:
static_ip: ${ip}
gateway: 192.168.1.1
subnet: 255.255.255.0

logger:

api:
#password: !secret esphome_api_pwd

ota:
#password: !secret esphome_ota_pwd

switch:
- platform: restart
name: ${friendly_name} Restart

sensor:
- platform: dht
pin: D3 #GPIO5
temperature:
name: ${friendly_name_temp}
filters:
- filter_out: nan
- heartbeat: 15s
- sliding_window_moving_average:
window_size: 2
send_every: 2
send_first_at: 1
- lambda: return x * (9.0/5.0) + 32.0; # report temperature in Fahrenheit
unit_of_measurement: "°F"
humidity:
name: ${friendly_name_humidity}
filters:
- filter_out: nan
- heartbeat: 15s
- sliding_window_moving_average:
window_size: 2
send_every: 2
send_first_at: 1
accuracy_decimals: 1 # humidity gets 0 decimals by default
model: DHT11
update_interval: 60s

- platform: wifi_signal
name: ${friendly_name} WiFi Signal Strength
update_interval: 60s

text_sensor:
- platform: version
name: ${friendly_name} ESPHome Version
```