Automation - Slow actions

I am having an issue with the actions on one my automation running slowly, The switch turns on immediately but then there is a noticeable delay between light1 and light2 turning off.

The lights I am using are Tplink, not sure if this helps. I have other automation that run without delay but the TPlink bulbs seem to be the problem. If I toggle them off and on from HA they turn on/off instantly.

    - id: '1540834766257'
  alias: Cube - DoubleTap - SideLight
  trigger:
  - event_data:
      action_type: tap_twice
      entity_id: binary_sensor.cube_158d000278e537
    event_type: cube_action
    platform: event
  action:
  - data:
      entity_id: switch.lamp
    service: switch.turn_on
  - data:
      entity_id: light.light_1
    service: light.turn_off
  - data:
      entity_id: light.light_2
    service: light.turn_off

Have you made any progress on this? Not sure where the delays may be coming from. Are these dimmable lights? It may be that when you just turn them on or off they by default will slowly ramp on or off, but if you turn them on to a specific level they turn on instantly. I know at least some zwave dimmers work that way.

I don’t know if this will help, but at the very least you can combine the last two steps of your automation into one:

- id: '1540834766257'
  alias: Cube - DoubleTap - SideLight
  trigger:
  - event_data:
      action_type: tap_twice
      entity_id: binary_sensor.cube_158d000278e537
    event_type: cube_action
    platform: event
  action:
  - service: switch.turn_on
    entity_id: switch.lamp
  - service: light.turn_off
    entity_id: light.light_1, light.light_2

Hi there

many thanks for your reply. ive put both entities on one automation now and that solved my problem.

Much appreciated