franklin87 发表于 2021-4-21 20:11:54

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

本帖最后由 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
   

sorrypqa 发表于 2022-6-12 20:23:09

不错,学习一下,谢谢分享!
页: [1]
查看完整版本: 【学习记录】ESPHOME 点亮 NODEMCU 的2个板灯 还有D5接了个DHT