Blueprint/Automation from Device Powered On

Hi, I have a blueprint that I’ve used to create an automation which cycles colors on my lights. I am trying to have the lights default to that automation when they are powered on.

My current attempt is an automation which triggers “When” the device changes “From” “Any State” to “On”.

This however, does not start the color cycling. Instead, the light is set to the latest solid color it was set to.

How can I fix this? Alternatively, is there a setting for lights to just return lights to their last setting when they have been turned off and then back on?

Thanks!

In general, Home Assistant does not seem to know if my devices are on or off…

  1. What does your automation look like. Here are some pointers on formatting code in here: How to help us help you - or How to ask a good question.
  2. Did your automation trigger at all. You can look at the traces to see if it triggered, it will leave a trace.

TBH a easy automation is all you need to do this. You should always write an automation as the basis for your blueprint automations anyway. Makes it easier.

An automation for this would trigger when the light goes from any to on, delay like 5 seconds, and start up your random color script or actions.

Hi @Sir_Goodenough,

Thanks for the tip on formatting. The YAML for this automation looks like this:

alias: Overhad Blucycle Color Loop From Any Automation
description: ""
trigger:
  - platform: state
    entity_id:
      - light.ledvance_a19_g2_rgbw_light
    to: "on"
    from: null
condition: []
action:
  - service: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.color_loop
mode: single

OK…
The from: null I would eliminate. Lights are never at a null state so it will never trigger. If you say ONLY to: "on" it will trigger when the light is turned on no matter what state it is in, including on. Another possibly useful thing to put there is from: "off". (Automation Trigger - Home Assistant)

Then, automation.turn_on is not doing what you think it is doing there. That command enables the automation to look for triggers and function. It does not make the automation trigger. (Automation services - Home Assistant)

You may want to either add the trigger here to the automation.color_loop thing, or turn automation.color_loop into a script and call that action with a service call. (Scripts - Home Assistant)

This is now starting the automation if I toggle the light on/off through Home Assistant, but not if I physically hit the power switch.

alias: Overhad Blucycle Color Loop From Any Automation
description: ""
trigger:
  - platform: state
    entity_id:
      - light.ledvance_a19_g2_rgbw_light
    to: "on"
condition: []
action:
  - service: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.color_loop
mode: single

What do you think automation.turn_on does? Like what do you expect to happen when you run that.

Look, I’m just not going to be able to help you. I try to tell you something and you are gone for 2 days, repeat the thing back to me that isn’t working, show not a bit of understanding from what I said.
I’m not going to be able to help you…

Hey, sorry I don’t respond quicker. I don’t have a ton of free time these days.

I figured automation.turn_on triggers/starts an automation. When that function is called, does it not start the automation from its first step?

I enacted your suggestion and removed the

trigger:
  ...
  from: null

line, which is reflected in the second YAML I posted. It’s better than what I had before, in that the automation does consistently start when the light is turned on/off through software, but not when it is physically turned on/off by cutting/returning power to the light

Am I incorrect with what I assume automation.turn_on does?
Are there more edits I need to make to have that happen when I power cycle the light?

Thanks

No you are not correct.

Ok, so I swapped automation.turn_on for automation.trigger and it’s working as I hoped. for the next person, the full script is now:

alias: Overhad Blucycle Color Loop From Any Automation
description: ""
trigger:
  - platform: state
    entity_id:
      - light.ledvance_a19_g2_rgbw_light
    to: "on"
condition: []
action:
  - service: automation.trigger
    target:
      entity_id:
        - automation.color_loop
    data:
      skip_condition: true
mode: single

Thanks @Sir_Goodenough !

Actually, I spoke too soon. I can’t set this to a solid color anymore, it always triggers the color loop automation.

My goal was to do the color loop by default when the light is switched on, but to be able to change it to other settings afterwards.