Repeat is an invalid option for script

Thought I was being clever since my Iris Z-Wave thermostats aren’t always responsive to changing the target temp and implemented a repeat until option via script, but the config isn’t working. Any idea what might be wrong here?

set_upstairs_temp:
  alias: "Set upstairs thermostat target high and low temperatures"
  fields:
    target_high:
      description: Target temperature for when to engage A/C
      example: 80
    target_low:
      description: Target temperature for when to engage heat
      example: 68
  repeat:
    until: "{{ is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.hvac_mode', 'heat_cool') and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.fan_mode', 'Auto low') and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.target_temp_high' | float, target_high | float) and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.target_temp_low' | float, target_low | float) and repeat.index < 10 }}"
    sequence:
      - service: climate.set_fan_mode
        data:
          entity_id: climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2
          fan_mode: Auto low
      - service: climate.set_temperature
        data:
          entity_id: climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2
          hvac_mode: heat_cool
          target_temp_low: "{{ target_low | float }}"
          target_temp_high: "{{ target_high | float }}"

try this (you are missing the first “sequence”):

set_upstairs_temp:
  alias: "Set upstairs thermostat target high and low temperatures"
  fields:
    target_high:
      description: Target temperature for when to engage A/C
      example: 80
    target_low:
      description: Target temperature for when to engage heat
      example: 68
  sequence:
    repeat:
      until: "{{ is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.hvac_mode', 'heat_cool') and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.fan_mode', 'Auto low') and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.target_temp_high' | float, target_high | float) and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.target_temp_low' | float, target_low | float) and repeat.index < 10 }}"
    sequence:
      - service: climate.set_fan_mode
        data:
          entity_id: climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2
          fan_mode: Auto low
      - service: climate.set_temperature
        data:
          entity_id: climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2
          hvac_mode: heat_cool
          target_temp_low: "{{ target_low | float }}"
          target_temp_high: "{{ target_high | float }}"

Thank you - I’m still getting the same error after this update. Did I do something wrong with the data template, maybe? I’m not sure I have the syntax right for the variables and data types.

What is the “error” you get ? , have you tried this template in Developer tools ?

Try calling your services on a target instead on using the entity_id directly in the service data.

set_upstairs_temp:
  alias: "Set upstairs thermostat target high and low temperatures"
  fields:
    target_high:
      description: Target temperature for when to engage A/C
      example: 80
    target_low:
      description: Target temperature for when to engage heat
      example: 68
  sequence:
    - repeat:
        until: >- 
          {{ is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.hvac_mode', 'heat_cool') 
          and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.fan_mode', 'Auto low') 
          and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.target_temp_high' | float(0), target_high | float(0) ) 
          and is_state('climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2.target_temp_low' | float(0), target_low | float(0) ) 
          and repeat.index < 10 }}"
        sequence:
          - service: climate.set_fan_mode
            data:
              fan_mode: Auto low
            target:
              entity_id: climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2
          - service: climate.set_temperature
            data:
              hvac_mode: heat_cool
              target_temp_low: "{{ target_low | float(0) }}"
              target_temp_high: "{{ target_high | float(0) }}"
            target:
              entity_id: climate.radio_thermostat_company_of_america_ct101_thermostat_iris_mode_2

EDIT: Corrected indent error

1 Like

You might just “missed” a … - …in front of repeat

Thanks! This got rid of the ‘repeat is an invalid option for script’ error.

Note - I had to add a delay at the end of the sequence for this to work. I guess the thermostat takes a moment to respond and doesn’t like it if it gets a bunch of signals in a row from the Z-stick.