I’m playing with a EPS32C6 to control a servo motor to automate my blast gates. So far my configuration seems to work but I’m having some trouble getting the UI to look/behave the way I want. Below is my device YAML. Under the device, I have this controls toggle, but it does not appear to stay in the On position. If I click it once, after a few seconds it will flip back to Off even though it’s not off. If I click into the control entity, I get a pop-up that’s a larger toggle button. Even though I may have switched On the servo previously, it should always show Off in here. If I then try to toggle in this view, the servo would behave but it never registers it as On. I’m guessing I’m missing something in terms of sensor in my configuration but I’m not clear on how it should look like.
Fixed version
esphome:
name: blast-gate
friendly_name: Blast Gate
esp32:
board: esp32-c6-devkitc-1
variant: esp32c6
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
- platform: esphome
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Blast-Gate Fallback Hotspot"
password: ""
captive_portal:
# PWM output for servo
output:
- platform: ledc
pin: GPIO0
id: servo_pwm
frequency: 50 Hz
# Servo definition
servo:
- id: blast_gate_servo
output: servo_pwm
min_level: 2.5%
idle_level: 7.5%
max_level: 12.5%
# Switch to control servo position
switch:
- platform: template
name: "Blast Gate"
id: blast_gate_switch
turn_on_action:
- servo.write:
id: blast_gate_servo
level: 100% # 90 degrees
- switch.template.publish:
id: blast_gate_switch
state: ON
turn_off_action:
- servo.write:
id: blast_gate_servo
level: 0% # 0 degrees
- switch.template.publish:
id: blast_gate_switch
state: OFF

