ESPHome 编程源码

龚伯寅
2023-12-01
esphome:
  name: xxx
  friendly_name: xxx

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "FmNG2S8tc9ZtD/xDErosQdkWMzHCMIx93aXSN4HCD3s="

ota:
  password: "520f28a3eaf692bea556c302657da0f8"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.1.95    ##固定此设备IP地址为192.168.1.100;
    gateway: 192.168.1.1        ##路由器、网关地址;
    subnet: 255.255.255.0         ##子网掩码;
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xxx Fallback Hotspot"
    password: "Z9oPAu7BSIyE"

captive_portal:


light:
  - platform: binary
    name: "xxx"
    id: xxx
    output: light1

    on_turn_on:
    - light.turn_on: xxxled
    on_turn_off:
    - light.turn_off: xxxled

  - platform: binary
    name: "xxx_led"
    id: xxxled
    output: light4

  - platform: binary
    name: "xxx_l_led"
    id: xxx_l_led
    output: light3

  - platform: binary
    name: "xxx_r_led"
    id: xxx_r_led
    output: light2

output:
  - id: light1
    platform: gpio
    pin: GPIO14

  - id: light4
    platform: gpio
    pin: GPIO15

  - id: light2
    platform: gpio
    pin: GPIO12

  - id: light3
    platform: gpio
    pin: GPIO13

binary_sensor:
  - platform: gpio
    pin:
      number: 0
      mode:
        input: true
        pullup: true
    name: "xxx_switch" 
    on_release:                      
       then:
         - light.toggle: xxx

  - platform: gpio
    pin:
      number: 16
      mode:
        input: true
        
    name: "xxx_l_switch" 
    id: xxx_l_switch

  - platform: gpio
    pin:
      number: 2
      mode:
        input: true
        pullup: true
    name: "xxx_r_switch" 
    id: xxx_r_switch

 类似资料: