粘配置:

由于esphome相对成熟只需要少量的配置文件就可。

本文是一个自制舵机门锁案例,esp8266,s90g,电池,门锁,hass。

esphome:
  name: esp82661
  friendly_name: ESP82661

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "JCyqHo6ED3rwKNq3KO2sY1SLNmojftdrruXOYrQ="

  services:
    - service: control_servo
      variables:
        level: float
      then:
        - servo.write:
            id: my_servo
            level: !lambda 'return level / 100.0;'
      

ota:
  safe_mode: true
  password: baivbaipass


wifi:
  ssid: BV
  password: 08611558
  manual_ip:
    static_ip: 192.168.2.70
    gateway: 192.168.2.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp82661 Fallback"
    password: "FYjfyhwTdX1bp"

captive_portal:
    
light:
  - platform: status_led
    name: "lock state"
    pin: GPIO2
  
      
servo:
  - id: my_servo
    output: pwm_output


# Example output platform
# On ESP32, use ledc output
output:
  - platform: esp8266_pwm
    id: pwm_output
    pin: GPIO0
    frequency: 50 Hz

interval:
  - interval: 20s
    then:
      - servo.detach: my_servo

Servo Component — ESPHome 这里有伺服电机相关的文档

ESPHome示例代码-CSDN博客 这里是一些非常不错的学习示例