Continue automation after error calling rest_command

Hi, i’m trying to config an automation for a call service/action with a rest_command.

What the automation do is, when HA detects I’m away (using router integration with home / away device tracker), it switches off a switch which is actually a template calling the rest_command using voice monkey to trigger an Alexa routine.

The problem is, sometimes the rest_command fails due to a timeout on request to server i think, and the automation stops.
I’ve tried the continue_on_error and the repeat until commands, but continue_on_error does not work and when error tirggers the automation stops.

Also tried custom integratio retry.action butn it does not work neither.

Can someone help me on this?

What I really want is to repeat/retry the automation till the switch is off when the rest_command fails.

automation:

alias: Apagar ambientadores al salir
description: ""
triggers:
  - trigger: state
    entity_id:
      - device_tracker.a2_0c_05_5f_72_d0
      - device_tracker.52_30_79_73_88_48
    to: not_home
conditions:
  - condition: and
    conditions:
      - condition: state
        entity_id: device_tracker.52_30_79_73_88_48
        state: not_home
      - condition: state
        entity_id: device_tracker.a2_0c_05_5f_72_d0
        state: not_home
actions:
  - target:
      entity_id: switch.ambientadores
    action: switch.turn_off
    data: {}
mode: single

switch template:

switch:
  - platform: template
    switches:
    #Ambientadores
      ambientadores:
        friendly_name: "Ambientadores Casa"
        turn_on:
          service: rest_command.trigger_voice_monkey
          data:
            deviceId: monkey-encender-ambientadores
        turn_off:
          service: rest_command.trigger_voice_monkey
          data: 
            deviceId: monkey-apagar-ambientadores

Thanks.

Please expand on this. It should definitely work unless there is a bug.
What is your code with continue_on_error and what is the outcome?

When you look at the traces, are there any errors shown there? Those are the only ones that continue on error will trap.

As @koying says, we need more detail, but it sounds as if the automation is working correctly and the template switch is failing to toggle because of outside issues.