esphome:name:servosplatform:ESP8266board:nodemcuv2wifi:ssid:"wifi"password:"密码"manual_ip:static_ip:192.168.0.222gateway:192.168.0.1subnet:255.255.255.0# Enable fallback hotspot (captive portal) in case wifi connection failsap:ssid:"Servos Fallback Hotspot"password:"VYTOwxqxxlOT"captive_portal:# Enable logginglogger:# Enable Home Assistant APIapi:services:-service:control_servovariables:level:floatthen:-servo.write:id:my_servolevel:!lambda'return level / 100.0;'ota:binary_sensor:-platform:gpiopin:D2name:"手动喂狗"on_state:then:-servo.write:id:my_servolevel:-100.0%-delay:2s-servo.write:id:my_servolevel:0%servo:-id:my_servooutput:pwm_output# Example output platform# On ESP32, use ledc outputoutput:-platform:esp8266_pwmid:pwm_outputpin:D5frequency:50Hz
automation:
- alias: Write Servo Value to ESP
trigger:
platform: state
entity_id: input_number.servo_control
action:
# Replace livingroom with the name you gave the ESP
- service: esphome.servos_control_servo
data_template:
level: '{{ states(''input_number.servo_control'') | int }}'