Hello all! Trying to figure out how to control cwww leds color temperature with rotary encoder. Can’t find anything in the esphome documentation or google.
Here is my code. Need to paste something instaead of “???”
esphome:
name: mirror
platform: ESP32
board: lolin32
wifi:
ssid: !secret wifi1_ssid
password: !secret wifi_pass
fast_connect: on
manual_ip:
static_ip: 192.168.1.56
gateway: 192.168.1.1
subnet: 255.255.255.0
ap:
ssid: "Mirror Fallback Hotspot"
password: !secret esphome_ap_pass
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret esphome_pass
ota:
password: !secret esphome_pass
sensor:
- platform: rotary_encoder
name: "Rotary Encoder"
pin_a: GPIO19
pin_b: GPIO23
resolution: 1
internal: true
on_clockwise:
if:
condition:
binary_sensor.is_off: encoder_button
then:
- light.dim_relative:
id: mirror_light
relative_brightness: 5%
else:
???????
on_anticlockwise:
if:
condition:
binary_sensor.is_off: encoder_button
then:
- light.dim_relative:
id: mirror_light
relative_brightness: -5%
else:
???????
binary_sensor:
- platform: gpio
pin:
number: GPIO18
mode: INPUT_PULLUP
inverted: True
id: encoder_button
internal: true
on_click:
min_length: 50ms
max_length: 350ms
then:
- light.toggle:
id: mirror_light
transition_length: 0.1s
on_double_click:
min_length: 50ms
max_length: 350ms
then:
- light.turn_on:
id: mirror_light
color_temperature: 4500 K
transition_length: 0.5s
- platform: status
name: "Mirror Status"
output:
- platform: ledc
pin: GPIO1
id: pwm_ww
frequency: 156250
- platform: ledc
pin: GPIO3
id: pwm_cw
frequency: 156250
light:
- platform: cwww
name: "Mirror"
warm_white: pwm_ww
cold_white: pwm_cw
warm_white_color_temperature: 2700 K
cold_white_color_temperature: 5500 K
constant_brightness: false
id: mirror_light
switch:
- platform: restart
name: "Mirror Reboot"
I will be glad for any help!