调整亮度可以了,但是一点不丝滑,
#旋转调整亮度
sensor:
- platform: rotary_encoder
name: "亮度旋钮"
pin_a:
number: RX
inverted: True
mode:
input: true
pullup: true
pin_b:
number: TX
inverted: True
mode:
input: true
pullup: true
resolution: 2
min_value: 0
max_value: 30
publish_initial_value: true
id: rotary1
on_clockwise:
- homeassistant.service:
service: light.turn_on
data:
entity_id:
light.lemesh_wy02_c2d9_switch_status
# light.test_taideng_2024
brightness_step_pct: "15"
- delay: 0.05s
on_anticlockwise:
- homeassistant.service:
service: light.turn_on
data:
entity_id:
light.lemesh_wy02_c2d9_switch_status
# light.test_taideng_2024
brightness_step_pct: "-15"
- delay: 0.05s
|