Scripts are very slow

Hi,

because the transition doesn’t work with my IKEA Gateway and Bulb i’ve tried to build a workaround for getting a smooth fade on. But it takes very long time…i expected 2,5s but it takes over 5m until the light reaches full brightness.
Maybe someone can show me how to get what i want :slight_smile:
(btw. i’m just starting with HASS)

  lightonlow_lamp1_start:
    alias: "Lampe 1 langsam an begin"
    sequence:
      - service: light.turn_on
        entity_id: light.test_lampe_1
        data:
          brightness: 15
      - service: script.turn_on
        entity_id: script.lightonlow_lamp1  

        
  lightonlow_lamp1:
    alias: "Lampe 1 langsam an"
    sequence:
      - condition: template
        value_template: '{{states.light.test_lampe_1.attributes.brightness < 255}}'
      - service: light.turn_on
        entity_id: light.test_lampe_1
        data_template:
          brightness: '{{states.light.test_lampe_1.attributes.brightness + 1}}'
      - service: script.turn_on
        entity_id: script.lightonlow_lamp1_helper   
 

  lightonlow_lamp1_helper:
    alias: "Lampe 1 langsam delay"
    sequence:
      - delay:
          milliseconds: 10
      - service: script.turn_on
        data:
          entity_id: script.lightonlow_lamp1

Thanks

Don’t know about Ikea lamps, but AFAIK the reason why my Yeelights cannot do transitions is because there is a minimum amount of time between responses.

Perhaps the reason why it is slow is because of a similar reason?

On the other hand, try running your script with a different output and see if it is faster.

I guess that the complete script and the Ikea bridge need ~1 seconds to be executed, and you want to execute it 245 times, which would last several minutes…

I suppose that it’s not possible to have a real smooth transition using this way (however a very clever one :slight_smile: ).

To confirm this try with a brightness +30 for example and see how long it take in between each brightness increase.

Might work for you with a step of 20-50 and without timer? But it maybe won’t be that smooth and not sure that it’ll be as fast as 2,5s.

Another way is to use you own bridge, instead of the original one.

Something like a ZiGate https://www.kickstarter.com/projects/1361563794/zigate-universal-zigbee-gateway-for-smarthome

Every loop takes around 1s…and you sees every single steps if you increasing the brightness by 10 instead of 1. :cry:
Looks like i must wait until someone fix the transitions with the IKEA stuff.