Python queued mode

Tags: #<Tag:0x00007f7399c2a4e8>

I am trying to run a bunch of commands really fast using python and calling a service, but instead of guessing how long it takes for the commands to execute i’d rather just queue them all up

I know the yaml scripting has a queue mode but I’m trying to call the preexisting light.turn_on script in queue mode. My attempt was this but it doesn’t work:"light", "turn_on", {"mode:" "queued"},service_data, False)

I also tried creating my own queue mode with python by waiting to see if the state of the bulb changed to what I wanted it to be but this didn’t work either at least using this code:

timeout = time.time()
while hass.states.get(entity_id).attributes['hs_color'][0] != h:
    if time.time() - timeout >= 0.1:

I can’t this of any other way to do this so any suggestions would be appreciated.