Queue ZigBee commands to account for delays

Hey there!

I’m trying to use a Tuya ZigBee IR blaster (TS1201) to control a Lasko tower fan, and have built a script to help me toggle between the different speeds based on the amount of button presses.

However, it seems that the delay between sending the command varies from three to around six seconds, and I was wondering if there could be a way to queue the next repetition of the command until the IR blaster can confirm it has successfully sent the previous one before giving up.

The relevant part of my script is as follows:

set_fan_speed:
  sequence:
    - choose:
        - conditions: "{{ percentage == 0 }}"
          sequence:
            - service: script.turn_off_fan
        - conditions: "{{ percentage == 20 }}"
          sequence:
            - choose:
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'low') }}"
                  sequence:
                    - repeat:
                        count: 4
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'medium') }}"
                  sequence:
                    - repeat:
                        count: 3
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'high') }}"
                  sequence:
                    - repeat:
                        count: 2
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'highest') }}"
                  sequence:
                    - service: zha.issue_zigbee_cluster_command
                      data:
                        cluster_type: in
                        endpoint_id: 1
                        command: 2
                        ieee: f0:82:c0:ff:fe:fd:f1:d5
                        command_type: server
                        params:
                          code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                        cluster_id: 57348
                    mode: single
                    - delay: "00:00:03"
            - delay: "00:00:05"
            - service: input_select.select_option
              target:
                entity_id: input_select.lasko_fan_speed
              data:
                option: "lowest"
        - conditions: "{{ percentage == 40 }}"
          sequence:
            - choose:
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'lowest') }}"
                  sequence:
                    - service: zha.issue_zigbee_cluster_command
                      data:
                        cluster_type: in
                        endpoint_id: 1
                        command: 2
                        ieee: f0:82:c0:ff:fe:fd:f1:d5
                        command_type: server
                        params:
                          code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                        cluster_id: 57348
                    mode: single
                    - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'medium') }}"
                  sequence:
                    - repeat:
                        count: 4
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'high') }}"
                  sequence:
                    - repeat:
                        count: 3
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'highest') }}"
                  sequence:
                    - repeat:
                        count: 2
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
            - delay: "00:00:05"
            - service: input_select.select_option
              target:
                entity_id: input_select.lasko_fan_speed
              data:
                option: "low"
        - conditions: "{{ percentage == 60 }}"
          sequence:
            - choose:
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'lowest') }}"
                  sequence:
                    - repeat:
                        count: 2
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'low') }}"
                  sequence:
                    - service: zha.issue_zigbee_cluster_command
                      data:
                        cluster_type: in
                        endpoint_id: 1
                        command: 2
                        ieee: f0:82:c0:ff:fe:fd:f1:d5
                        command_type: server
                        params:
                          code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                        cluster_id: 57348
                    mode: single
                    - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'high') }}"
                  sequence:
                    - repeat:
                        count: 4
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'highest') }}"
                  sequence:
                    - repeat:
                        count: 3
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
            - delay: "00:00:05"
            - service: input_select.select_option
              target:
                entity_id: input_select.lasko_fan_speed
              data:
                option: "medium"
        - conditions: "{{ percentage == 80 }}"
          sequence:
            - choose:
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'lowest') }}"
                  sequence:
                    - repeat:
                        count: 3
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'low') }}"
                  sequence:
                    - repeat:
                        count: 2
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'medium') }}"
                  sequence:
                    - service: zha.issue_zigbee_cluster_command
                      data:
                        cluster_type: in
                        endpoint_id: 1
                        command: 2
                        ieee: f0:82:c0:ff:fe:fd:f1:d5
                        command_type: server
                        params:
                          code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                    mode: single
                    - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'highest') }}"
                  sequence:
                    - repeat:
                        count: 4
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
            - delay: "00:00:05"
            - service: input_select.select_option
              target:
                entity_id: input_select.lasko_fan_speed
              data:
                option: "high"
        - conditions: "{{ percentage == 100 }}"
          sequence:
            - choose:
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'lowest') }}"
                  sequence:
                    - repeat:
                        count: 4
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'low') }}"
                  sequence:
                    - repeat:
                        count: 3
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'medium') }}"
                  sequence:
                    - repeat:
                        count: 2
                        sequence:
                          - service: zha.issue_zigbee_cluster_command
                            data:
                              cluster_type: in
                              endpoint_id: 1
                              command: 2
                              ieee: f0:82:c0:ff:fe:fd:f1:d5
                              command_type: server
                              params:
                                code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                              cluster_id: 57348
                          mode: single
                          - delay: "00:00:03"
                - conditions: "{{ is_state('input_select.lasko_fan_speed', 'high') }}"
                  sequence:
                    - service: zha.issue_zigbee_cluster_command
                      data:
                        cluster_type: in
                        endpoint_id: 1
                        command: 2
                        ieee: f0:82:c0:ff:fe:fd:f1:d5
                        command_type: server
                        params:
                          code: Aw0FggFAAwW4AQ0FDQVABQO4AbgBQAXgBQMHDQW4AbgBwB9AB0ADBrgBDQUNBYIgBQGCAUALA4IBDQVAB8ADBQ0FggG4AeAHLwG4AUADAbgBQAUCDQWCIANAB0ADBQ0FuAGCAeABLwaCAQ0FDQW4IAUBuAFAC+AHAwENBUAX4AEvBbgBDQUNBUAFBbgBggENBeAHAwENBUAX4AEvBoIBDQUNBbggBQG4AUAL4AcDAQ0FQBfgDS8EuAENBYLgBgMFDQW4AYIB4A0vA4IBDQXgBwMBDQVAF+A7LwUIAoIBDQXgBwMBDQXgAV8BhQSAIwMNBQgCQAMDNgENBeAHL0AjAzYBwB9AB0ADBQ0FCAKACwMNBYUEQAsBCAJAC0ADADYgE0ADQAuAFwHAH0AHQAMBggGAE0ALQCPgAwPAGwE2AeABLwM2AQ0FQCtAA0ALwAMD/wANBUALgBfgES8C/wDdIANAB4AD4AEvAXMCQAMC/wDdIBMBcwJAA0ALAJ0gDxGdAJcMuwDdBYUEcwJuAMAfCAI=
                        cluster_id: 57348
                    mode: single
                    - delay: "00:00:03"
            - delay: "00:00:05"
            - service: input_select.select_option
              target:
                entity_id: input_select.lasko_fan_speed
              data:
                option: "highest"

Is this a viable solution, or is there perhaps something I am missing?

Thanks in advance!

I’m assuming there is no way HA knows how long the delay is ?
If I understand the problem correctly, the IR blaster sends a command pretty instantly, but the fan itself takes a few seconds to change its setting, and if you send another command too quickly it would get ignored ?

If this is the case, i think your delay tactic might be the only way, unless…

You could put a power monitoring plug on the fan, and assuming the power level changes enough, depending on the fan setting, you could use this to know the fan speed has changed.

Also… see this thread

With RF there is often no way of making that confirmation.
You can either do a so long delay that it should have been sent successfully, but it would still be a guess, or you would need to invent a sensor to detect it, which Rofo has a good suggestion on.