光和未来温湿度计esp8266+dht11 接入Home Assistant
制作刷机线
按如图所示通过杜邦线将usb公头与usb转ttl模块连接起来,定义如下:
usb公头 | usb转ttl模块 |
---|---|
电源正 | 3V3或者5V |
信号负(D-) | TXD |
信号正(D+) | RXD |
电源负 | GND |
安装esphome. pip install esphome
启动esphome
🦉 [esp_tools] esphome config/ dashboard 17:16:07 2023-07-09 17:16:10,238 WARNING Calling ESPHome with the configuration before the command is deprecated and will be removed in the future. 2023-07-09 17:16:10,238 WARNING Please instead use: 2023-07-09 17:16:10,238 WARNING esphome dashboard config/ 2023-07-09 17:16:10,395 INFO Starting dashboard web server on http://0.0.0.0:6052 and configuration dir config/... 2023-07-09 17:16:18,731 INFO 304 GET / (127.0.0.1) 7.28ms 2023-07-09 17:16:18,790 INFO 200 GET /static/fonts/material-icons/material-icons.css?hash=ead4c276 (127.0.0.1) 5.89ms 2023-07-09 17:16:18,793 INFO 200 GET /static/css/esphome-2.css?hash=eca4d739 (127.0.0.1) 1.90ms 2023-07-09 17:16:18,797 INFO 200 GET /static/js/esphome/index-bfcf9cd9.js (127.0.0.1) 4.84ms 2023-07-09 17:16:18,798 INFO 200 GET /static/fonts/material-icons/MaterialIcons-Regular.woff2?hash=570eb838 (127.0.0.1) 5.34ms 2023-07-09 17:16:18,853 INFO 304 GET /devices (127.0.0.1) 1.40ms 2023-07-09 17:16:18,855 INFO 200 GET /static/images/logo-text.svg (127.
编写esphome esp8266+dht11 yaml 文件
esphome: name: dht11 friendly_name: dht11 esp8266: board: esp01_1m # Enable logging logger: # Enable Home Assistant API api: encryption: key: "TVxqtHvxKnBp6IZBYgXd82Tur1jQMpba7pVav79lH3k=" ota: password: "eac6bcd07edf61d83828ae7d84a77f9a" # 2.4G Wi-Fi 信息 wifi: ssid: "xxxx" password: "xxxx" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Hdt11 Fallback Hotspot" password: "ijH5DOuX3FQT" captive_portal: web_server: port: 80 sensor: - platform: dht pin: GPIO4 temperature: name: "dht11 temperaturel" humidity: name: "dht11 humidity" update_interval: 60s # 数据上传间隔 60s model: DHT11
编译生成bin文件
将固件刷入esp8266
接入 home Assistant