『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 604|回复: 2

[基础教程] 带esp01s 的dht11模块 编译时出错

[复制链接]

1

主题

6

帖子

56

积分

注册会员

Rank: 2

积分
56
金钱
50
HASS币
0
发表于 2022-11-12 20:01:42 | 显示全部楼层 |阅读模式
按照向导生成代码后
教程说把 下面的代码加入到最后
添加dht11代码
点击test工程下EDIT编程yaml文件,在结尾处添加如下代码:

#Example configuration entrysensor:   
- platform: dht
    pin: GPIO2
    temperature:
      name: "Room Temperature"
    humidity:
      name: "Room Humidity"
        update_interval: 60s
        model: DHT11
我加入后这样:
esphome:
  name: test

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "2QomEtRj53ndOSXQnR9Pxx1HbRpEIjC7+77i2jrPkbk="

ota:
  password: "5e773360b6b335090d5cc80a7ce1faef"

wifi:
  ssid: tyunet
  password: uo98809880

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: "ehDaBCMi8SUB"

captive_portal:





#Example configuration
entrysensor:   
- platform: dht
    pin: GPIO2
    temperature:
      name: "Room Temperature"
    humidity:
      name: "Room Humidity"
        update_interval: 60s
        model: DHT11


save 后 install
出错:
INFO Reading configuration /config/esphome/test.yaml...ERROR Error while reading config: Invalid YAML syntax:mapping values are not allowed here  in "/config/esphome/test.yaml", line 36, column 8:        pin: GPIO2            ^
请问大神们怎么解决?
我只是想要家里增加个温湿度检测






回复

使用道具 举报

2

主题

125

帖子

1470

积分

金牌会员

Rank: 6Rank: 6

积分
1470
金钱
1345
HASS币
0
发表于 2022-11-13 00:02:58 | 显示全部楼层
缩进的问题
回复

使用道具 举报

7

主题

114

帖子

1032

积分

论坛DIY达人

积分
1032
金钱
908
HASS币
60
发表于 2022-11-13 10:20:48 | 显示全部楼层
试试tasmota,你会发现新的大门。

https://tasmota.github.io/docs/DHT11/

esp01+dht11只能开发用,实际使用的时候dht11温度会收到esp01的发热影响,温度会高出5-10度,另dht11的温湿度不精确,在极端情况下会发飘。如果非要使用dht11那建议用杜邦线分离dht11和esp01
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-18 07:49 , Processed in 0.046648 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表