Help needed with light transition

The transitions works, yes, but obviously it does not start at 12% nor does it ramp down.

try this:

- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - data:
      brightness_pct: 12
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - data:
      brightness_pct: 100
      transition: 18000
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - data:
      brightness_pct: 12
      transition: 18000
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on

@sparkydave, that’s how I thought it should work but unfortunately, it doesn’t. The first stage where it sets to 12% works, but it does not ramp up from there.

What Dave gave you should work, try putting a 5 second delay between each step.
Why do you want to do this.?
It will all go badly wrong if you ever have to turn the lights on or off during this process

I want to emulate sunrise to sunset on my fish tank, so slowly increasing then decreasing light levels throughout a 10 hour period. I’m open to other suggestions on how to achieve the same.

In that case just use the circadian lighting custom component

Thanks, but I really only need a simple transition from 12%-100%-12% over a 10 hour period.

Have you tried with a delay between the actions as per what Muttley suggested?

- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - data:
      brightness_pct: 12
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - delay: '00:00:01'
  - data:
      brightness_pct: 100
      transition: 18000
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - delay: '00:00:01'
  - data:
      brightness_pct: 12
      transition: 18000
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on

my original code should have worked for you.

Maybe try formatting the code in the proper way rather than per the GUI editor:

- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - service: light.turn_on
    entity_id: light.0x680ae2fffeb18442_light
    data:
      brightness_pct: 12
  - delay: '00:00:01'
  - service: light.turn_on
    entity_id: light.0x680ae2fffeb18442_light
    data:
      brightness_pct: 100
      transition: 18000
  - delay: '00:00:01'
  - service: light.turn_on
    entity_id: light.0x680ae2fffeb18442_light
    data:
      brightness_pct: 12
      transition: 18000

Dave, we are both idiots.
The delay needed for an 18000 transition is 18000.
Do you know how stupid I feel ?

…but there shouldn’t need to be a delay. The transition of 18000 means it should slowly increase to 100% brightness over 5 hours.

1 Like

Does that mean that the next command doesn’t execute until 5 hours have passed?

That’s what I’m starting to think, is it just going straight from the first 12% on to the last one, i.e. each action is overriding the transition delay of the previous?

lets test each component.

  1. does the light slowly turn on from 0 to 100 over 5 hours using only:
- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - service: light.turn_on
    entity_id: light.0x680ae2fffeb18442_light
    data:
      brightness_pct: 100
      transition: 18000

(perhaps change the transition to 120 for testing)

I tried this at 120, transitioning to 12%, last night and transitions work on a single action.

Mutt is right. With no delay between the second and third service calls, the third one will be executed immediately. Thus the final command is the only one that will be noticed.

Should be:

  • Set to 12%
  • delay 1 second
  • transition to 100%
  • delay (or wait_template) until at 100%
  • transition back to 12%

The commands aren’t queued they just happen serially (so they are queued in a way)
But you issued the command to transition to 100pct over 5 hours then immediately issue a command to transition to 12% over 5 hours and the switch goes “no need, I’m already at 12%” job done! But as bedfellows points out nothing happens.
So set the automation as Dave lays out but increase the delay after the command to 100% to allow it to get there ie 18000

Edit: dang Marc beat me to it

1 Like

It seems that a wait template may be a preferable solution, as then there wouldn’t be any race condition between timers. Could anyone help me with the template?

wait_template: "{{ is_state_attr('light.0x680ae2fffeb18442_light' , 'brightness' , 255) }}"
1 Like

Not sure 18000/255 may mean that it will reach 255 before 5hrs given the resolution

255 is 100% brightness