Can I make it faster?

Hi all,
my best wishes to you and your family.

I have the following script for the night of new years eve, which is working (almost fine). It turns off all the lights and switches I want and after a while it turns them on. The problem is that

  1. it turns off the lights (one by one) so it is taking 2-3 seconds in order to turn them off (I would like to happen at once) and there is a delay also (8-9 seconds) to turn them on.

Ideally I would like to turn off all of them at once and to turn on the lights after 2-3 seconds at most. Not a big problem but is there something I could to to improve the speed?

I don’t see a script… so difficult to figure out what can be improved but did you put the lights in a light group?

you are right. here is the script

new_year:
  alias: New Year
  icon: mdi:toggle-switch
  sequence:
  - service: scene.create
    data:
      scene_id: new_year_before
      snapshot_entities:
      - light.77626641ecfabc96e072  #dim
      - light.77626641ecfabc976395  #Dimmer
      - light.bedroom_ceiling_light  #Bedroom Ceiling Light
      - light.bedside_lamp  #Bedside Lamp
      - light.yee_notify_lamp  #Notify Lamp
      - switch.bedroom_balcony_mss510h_main_channel  #Bedroom Balcony
      - switch.book_main_mss520h_book_2  #Book 2
      - switch.book_main_mss520h_main_channel  #book and outdoor central (mss520h) - Main channel
      - switch.book_main_mss520h_outdoor  #Outdoor
      - switch.book_mss510h_main_channel  #Book
      - switch.dinning_spot_mss510h_main_channel  #Dinning Spot (mss510h) - Main channel
      - switch.kid_balcony_light_mss510h_main_channel  #Kid Balcony
      - switch.kitchen_main_mss520h_kitchen  #Kitchen
      - switch.kitchen_main_mss520h_kitchen_spot  #Kitchen Spot
      - switch.kitchen_main_mss520h_main_channel  #Kitchen central (mss520h) - Main channel
      - switch.shellyplug_s_801c26  #Soundbar plug
      - switch.smart_plug_2  #TV Bedroom
      - switch.smart_wall_switch_mss520h_main_channel  #Balcony All
      - switch.smart_wall_switch_mss520h_switch_1  #Balcony 1
      - switch.smart_wall_switch_mss520h_switch_2  #Balcony 2
      - switch.sonoff_10001bb5c7  #Floor Light
      - switch.sonoff_10009bd11e  #Kitchen Led 2
      - switch.sonoff_1000a05283  #Kitchen Led
      - switch.tradfi_outlet  #TV to close (ikea)
      
  - service: homeassistant.turn_off
    data:
      entity_id: 
      - light.77626641ecfabc96e072  #dim
      - light.77626641ecfabc976395  #Dimmer
      - light.bedroom_ceiling_light  #Bedroom Ceiling Light
      - light.bedside_lamp  #Bedside Lamp
      - light.yee_notify_lamp  #Notify Lamp
      - switch.bedroom_balcony_mss510h_main_channel  #Bedroom Balcony
      - switch.book_main_mss520h_book_2  #Book 2
      - switch.book_main_mss520h_main_channel  #book and outdoor central (mss520h) - Main channel
      - switch.book_main_mss520h_outdoor  #Outdoor
      - switch.book_mss510h_main_channel  #Book
      - switch.dinning_spot_mss510h_main_channel  #Dinning Spot (mss510h) - Main channel
      - switch.kid_balcony_light_mss510h_main_channel  #Kid Balcony
      - switch.kitchen_main_mss520h_kitchen  #Kitchen
      - switch.kitchen_main_mss520h_kitchen_spot  #Kitchen Spot
      - switch.kitchen_main_mss520h_main_channel  #Kitchen central (mss520h) - Main channel
      - switch.shellyplug_s_801c26  #Soundbar plug
      - switch.smart_plug_2  #TV Bedroom
      - switch.smart_wall_switch_mss520h_main_channel  #Balcony All
      - switch.smart_wall_switch_mss520h_switch_1  #Balcony 1
      - switch.smart_wall_switch_mss520h_switch_2  #Balcony 2
      - switch.sonoff_10001bb5c7  #Floor Light
      - switch.sonoff_10009bd11e  #Kitchen Led 2
      - switch.sonoff_1000a05283  #Kitchen Led
      - switch.tradfi_outlet  #TV to close (ikea)

  #- delay: '00:00:01'
  
  - service: scene.turn_on
    data:
      entity_id: scene.new_year_before

Home Assistant sends a separate command to control each one of the 24 entities in the scene you have defined.

The only way to reduce the number of transmitted commands is to take advantage of native ZigBee or Z-Wave groups (not Home Assistant’s Groups). For example, a single Zigbee group command can control multiple devices (thereby reducing communication traffic and improving device responsiveness). Z-Wave has a similar capability as do some other technologies (Insteon, UPB, etc).

2 Likes