Hi there,
I tried to set a simple light automation in esphome, but I really found difficulties in managing RGB values.
This is my project:
- Turn on a RGB light, I choose a color and a brightness (don’t mind what)
- At 7:00 RGB values are read and saved (set.globals?)
- RGB light color goes to green
- At 8:00 recall the previous values
- RGB light previous values are restored
This is my esp32 .yaml file
output:
- platform: esp8266_pwm
id: output_red
pin: GPIO14
max_power: 0.75
- platform: esp8266_pwm
id: output_green
pin: GPIO12
max_power: 0.75
- platform: esp8266_pwm
id: output_blue
pin: GPIO13
max_power: 0.75
light:
- platform: rgb
name: "Luce RGB"
id: luce_rgb
red: output_red
green: output_green
blue: output_blue
default_transition_length: 0.25s
# I suppose these can be 3 globals to work with
globals:
- id: rgb_r
type: float
restore_value: no
initial_value: "0"
- id: rgb_g
type: float
restore_value: no
initial_value: "0"
- id: rgb_b
type: float
restore_value: no
initial_value: "0"
time:
- platform: sntp
on_time:
- seconds: 0
minutes: 00
hours: 7
then:
- globals.set
id: rgb_r
value: # I dont know what to set just the red value
id: rgb_g
value: # I dont know what to set just the red value
id: rgb_b
value: # I dont know what to set just the red value
- light.turn_on:
id: luce_rgb
brightness: 1.00
red: 0
green: 1.00
blue: 0
- delay: 950ms
Of course, I need suggestions about how to restore previous values at 8:00
Thank you all