代码如下:
switch:
- platform: template
name: "light"
optimistic: true
turn_on_action:
- servo.write:
id: my_servo1
level: -30%
- delay: 0.1s
- servo.write:
id: my_servo1
level: -6%
turn_off_action:
- servo.write:
id: my_servo1
level: +14%
- delay: 0.1s
- servo.write:
id: my_servo1
level: -6%
servo:
- id: my_servo1
output: ledc_output1
output:
- platform: ledc
id: ledc_output1
pin: GPIO14
frequency: 50 Hz
|