Wait for vacuum to arrive at location

Hi there,
I have trouble with a robo vacuum maintenance script. I can’t send it to the desired location directly: A in our house door is sometime closed which means the path is blocked while the robot cleans. The map inside the vacuum is not updated fast enough, so it often thinks the door is when it isn’t. This leads to not being able to path find to the maintenance location. I have a door sensor to make sure the door is open, so I want to script the following workflow:

  1. Send robot to location ~1m in front of the door
  2. Wait for completion
  3. Send robot to location ~0.5m in front of the door (this is to make sure it’s orientation is correct for the next steps)
  4. Wait for completion
  5. Manually move the robot forward through the door
  6. Send robot to maintenance spot

I’ve tested this workflow manually and it works. But my script fails to recognize step 2, waiting for the task to complete. I played around a bit, but with no luck, so this is my current script (created with the UI):

'1567541434052':
  alias: RockyMaintanance
  sequence:
  - data:
      command: app_goto_target
      params:
      - 21750
      - 26550
    service: vacuum.send_command
    target:
      entity_id: vacuum.rocky
  - wait_template: '{{ is_state(''vacuum.rocky'', ''idle'') }}'
    timeout: 00:00:30
  - data:
      command: app_goto_target
      params:
      - 21350
      - 26550
    service: vacuum.send_command
    target:
      entity_id: vacuum.rocky
  - service: xiaomi_miio.vacuum_remote_control_move_step
    data:
      entity_id: vacuum.rocky
      velocity: 0.29
      rotation: 0
      duration: 4000
  - wait_template: '{{ is_state(''vacuum.rocky'', ''idle'') }}'
    timeout: 00:00:30
  - data:
      command: app_goto_target
      params:
      - 21600
      - 30150
    service: vacuum.send_command
    target:
      entity_id: vacuum.rocky
  mode: single

Can anyone help me to figure out the waiting steps? Many thanks in advance!