Help needed with light transition

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

255 is 100% brightness

Does this look correct?

- 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: 30
  - wait_template: "{{ is_state_attr('light.0x680ae2fffeb18442_light' , 'brightness' , 30) }}"
  - service: light.turn_on
    entity_id: light.0x680ae2fffeb18442_light
    data:
      brightness: 255
      transition: 18000
  - wait_template: "{{ is_state_attr('light.0x680ae2fffeb18442_light' , 'brightness' , 255) }}"
  - service: light.turn_on
    entity_id: light.0x680ae2fffeb18442_light
    data:
      brightness: 30
      transition: 18000

You have a random ’ on the end of the second wait_template, and you don’t really need the first one, you just need a one second delay to make sure the light is completely on before the next command is executed, but as a belt and braces approach should be fine.

I spotted that one and edited as you was typing :smiley:

Cool - yeah, give it a punt and let us know if it works :+1:

Marc,
This is solved so it’s more of an interlectual exercise now.
12% of 255 is 30.6 (call it 31) and a rise to 255 over 5 hrs (18000 secs) is 1 step every 80s (18000/224) so a full analogue interpretation would reach 255 at the end of 5 hours but 254 at 80.43 secs earlier so a switch point would occur 40.2 secs before end time.
Assuming a full 8bit implementation (255 steps) even when using percent (not sure on that but probable)
Having said all that I won’t lose any sleep over 40 secs in a 5 hour period

I genuinely read my name and then tasted purple. I have no idea whether it works as you say, or whether the final increment is delivered on the final millisecond, but yeah I don’t think 40 seconds will make much difference either way :slightly_smiling_face:

1 Like

:rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl:

I have never heard “tasted purple” in my life. But I had fun Googling it ! :smiley:

1 Like

I will need to google this, but suspect I best not do so at work :smiley:

No, it’s not rude.
But you should not be cruising the Internet at work anyway, as that’s a breach of trust with your employer :wink:

For anyone else who reads this thread and doesn’t watch futurama…

https://comb.io/ckyWei

… Or the urban dictionary definition…

https://www.urbandictionary.com/define.php?term=Tasted%20Purple

Both are suitable for work, promise :slightly_smiling_face:

I get breaks :wink:

Still doesn’t work. This is current code, which sets to 30 when executed but does not progress from there:

- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - data:
      brightness: 30
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - wait_template: '{{ is_state_attr(''light.0x680ae2fffeb18442_light'' , ''brightness''
      , 30) }}'
  - data:
      brightness: 255
      transition: 120
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - wait_template: '{{ is_state_attr(''light.0x680ae2fffeb18442_light'' , ''brightness''
      , 255) }}'
  - data:
      brightness: 30
      transition: 120
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on

Any errors in the log?

Also, I don’t know what’s going on with your quotes, but that’s not how we had it a few posts ago.

And there shouldn’t be a new line halfway through the templates either, again not what we had earlier.

I don’t know what on earth is goign on either, I literally copy an pasted it from the earlier post into hassio.

I’ve amended it again and this is now what it looks like:

- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - data:
      brightness: 30
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - wait_template: "{{ is_state_attr('light.0x680ae2fffeb18442_light' , 'brightness' , 30) }}"
  - data:
      brightness: 255
      transition: 120
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
  - wait_template: "{{ is_state_attr('light.0x680ae2fffeb18442_light' , 'brightness' , 255) }}"
  - data:
      brightness: 30
      transition: 120
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on

Still doesn’t work though!

I’ve edited it to the first step and this transitions ok:

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

It seems to this that doesn’t work:

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

In thsi example, the light does not switch off after 3 minutes:

- id: '1584046806268'
  alias: Marine Tank Dimmer
  description: ''
  trigger:
  - at: '12:00'
    platform: time
  condition: []
  action:
  - data:
      brightness: 255
      transition: 180
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_on
- wait_template: "{{ is_state_attr('light.0x680ae2fffeb18442_light' , 'brightness' , 255) }}"
  action:
    entity_id: light.0x680ae2fffeb18442_light
    service: light.turn_off

Manually trigger it and then have a look at the logs and see if there is an error.

As an experiment, set the light’s initial brightness to some low value (30) then run the simplified 3-minute example you just posted. I’m curious to see if the light’s starting state influences the first wait_template (probably not but if we’re poking at this thing, let’s see how it reacts to that).