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

 找回密码
 立即注册
查看: 2784|回复: 1

【学习记录】ESPHOME 点亮 NODEMCU 的2个板灯 还有D5接了个DHT

[复制链接]

2

主题

9

帖子

83

积分

注册会员

Rank: 2

积分
83
金钱
74
HASS币
0
发表于 2021-4-21 20:11:54 | 显示全部楼层 |阅读模式
本帖最后由 franklin87 于 2021-4-21 20:17 编辑
esphome:
  name: diy-nodemcu-temp
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "wifi账号"
  password: "密码"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Diy-Nodemcu-Temp"
    password: "密码"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


time:
  - platform: homeassistant
    id: time2
    
switch:
  - platform: restart
    name: "Reboot the light"
    id: light_home_restart
   
#控制2路灯 
output:
  - platform: gpio
    pin: GPIO2
    id: relay
  - platform: gpio
    pin: GPIO16
    id: relay2
    
light:
  - platform: binary
    name: "light_home"
    id: light_home
    output: relay
  - platform: binary
    name: "light_home_2"
    id: light_home2
    output: relay2  

#暂时没用,还没物理面板
binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO13
      mode: INPUT_PULLUP
      inverted: True
    name: "light_home Physical Switch Sensor"
    on_press:
      then:
        - light.turn_on: light_home
    on_release:
      then:
        - light.turn_off: light_home
    on_multi_click:
    - timing:
        - ON for at most 0.5s
        - OFF for at most 0.5s
        - ON for at most 0.5s
        - OFF for at most 0.5s
        - ON for at most 0.5s
        - OFF for at most 0.5s
        - ON for at most 0.5s
        - OFF for at least 0.2s
      then:
        - switch.turn_on: light_home_restart


#开启网页端
web_server:
  port: 80


sensor:
  - platform: dht
    pin: D5
    temperature:
      name: temperature
      id: temp
    humidity:
      name: humidity
      id: humi
    model: DHT11
    update_interval: 10s
    

评分

参与人数 1金钱 +5 收起 理由
sorrypqa + 5 感谢楼主分享!

查看全部评分

回复

使用道具 举报

50

主题

1338

帖子

5586

积分

论坛DIY达人

积分
5586
金钱
4248
HASS币
20
发表于 2022-6-12 20:23:09 | 显示全部楼层
不错,学习一下,谢谢分享!
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-21 22:24 , Processed in 0.647942 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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