本帖最后由 602293544 于 2019-10-13 22:49 编辑
某宝买的DHT12 5块钱一个
这是针脚说明
我用的是NodeMcu Lua WIFI V3
刷espeasy论坛有教程这里就不再说了设置图如下
接线
VDD-----3.3V
SDA-----D2(图中红圈的自己设置)
SCL------D1 (图中红圈的自己设置)
GND----GND
yaml代码
sensor:
- platform: mqtt
name: "Temperature"
state_topic: "/esptest/DHT12/Temperature"
unit_of_measurement: °C
- platform: mqtt
name: "Humidity"
state_topic: "/esptest/DHT12/Humidity"
unit_of_measurement: "%"
esphome的方法不会希望有大佬可以教一下
esphome配置
substitutions:
device_name: chuanganqi
wifi_ssid: 'PDCN'
wifi_password: '15646420'
wifi_fast_connect: 'false'
wifi_reboot_timeout: 0s
ota_password: '123456'
api_reboot_timeout: 0s
esphome:
name: $device_name
platform: ESP8266
board: esp01_1m
web_server:
port: 80
css_url: https://esphome.io/_static/webserver-v1.min.css
js_url: https://esphome.io/_static/webserver-v1.min.js
wifi:
ssid: $wifi_ssid
password: $wifi_password
reboot_timeout: $wifi_reboot_timeout
power_save_mode: none
fast_connect: $wifi_fast_connect
logger:
api:
reboot_timeout: $api_reboot_timeout
ota:
safe_mode: true
password: $ota_password
# Example output entry
sensor:
- platform: dht12
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval: 10s
i2c:
sda: 12
scl: 13
scan: True
id: bus_a
sda和scl的针脚看图接
比如我的12和13就是GPIO12和GPIO13 也就是D6和D7
|