ESOHome monochromatic light turn on on boot

Hi All!!,
I’m trying to configure a Wemos D1 Mini to run my studio light using monochromatic component using this code:

# Output Lights    
light:
  - platform: monochromatic
    name: "Ceiling Light"
    output: light_1
    default_transition_length: 2s
    
# Output Lights
output:
  - platform: esp8266_pwm
    id: light_1
    pin: D1 
    frequency: 5000 Hz

Everything works good so far. Now I want to add an automatic turn on at boot, with the 2s transistion for a smooth effect.
So I’m trying this code (inspired by the light component guide on ESPhome website):

esphome:
  name: lab_light
  platform: ESP8266
  board: d1_mini
  on_boot:
    - light.turn_on:
      id: light_1
      brightness: 90%

But it seems that there’s something wrong because I have an X at the beginning of the - light.turn_on: row. How can I fix that? I’ve also tryed with the dafaul state option but I don’t like the “full on” startup, I really want a smooth power up…
Thanks to all!!
Best regards
Simone

Thank you for your reply!
I’ve now tryed to change it like that:

esphome:
  name: lab_light
  platform: ESP8266
  board: d1_mini
  on_boot:
  - light.turn_on: light_1

now I have an error on the first row which says that ID 'light_1' of type esp8266PWM doesn't inherit from light::LightState. Please double check your ID is pointing to the correct value
But my ID is correct… I’ve also done some test changing from monochromatic to binary light with no success.

The easy way is to add the restore_mode configuration to the light component. See below:

# Output Lights    
light:
  - platform: monochromatic
    name: "Ceiling Light"
    output: light_1
    default_transition_length: 2s
    restore_mode: ALWAYS_ON # Always initialize the light as ON on bootup.
    
# Output Lights
output:
  - platform: esp8266_pwm
    id: light_1
    pin: D1 
    frequency: 5000 Hz
1 Like

The problem is that the light you are trying to turn on (light_1) is actually the output component, not the light you made from the output.

Give an ID to the light itself, then use THAT id in the on_boot service call.

IE:

esphome:
  name: lab_light
  platform: ESP8266
  board: d1_mini
  on_boot:
    then:
      - light.turn_on:
          id: light_actual_light  #<-This ID needs to be for the light, not the output
          brightness: 90%
light:
  - platform: monochromatic
    name: "Ceiling Light"
    output: light_1
    default_transition_length: 2s
    id: light_actual_light        #<-Add an ID to the light itself!
    
output:
  - platform: esp8266_pwm
    id: light_1
    pin: D1
    frequency: 5000 Hz
    
5 Likes

Thank you very much! I’ve done some confusion with ID. Now it works perfect!! Thanks again!

1 Like

Thanks for saving my sanity! This did the trick

This was a helpful hint. Thanks a lot