Getting an "expected a dictionary for dictionary value @ data" error, can't figure it out

Hi!

I’m totally new to this.
I found a blueprint that works great, until it doesn’t.
(Daily Thermostat Schedule)

Let me explain:
I have a HVAC unit that periodically loses connectivity for 15 minutes to two hours.

If that happens when the automation is triggered, then of course nothing changes on the unit.
I therefore tried, to the best of my ability, editing the blueprint to make a new version, with a repeat until.

I’ve tried dozens of variations of indentations and with or without - but nothing works.
I’m at my wit’s end now, could you please look at what’s wrong?

action:
  - repeat:
      - choose:
          - conditions:
            - condition: state
              entity_id: !input "climate_id"
              state: heat
            sequence:
              - service: climate.set_temperature
                entity_id: !input "climate_id"
                data:
                  temperature: !input "heating_temp"
          - conditions:
            - condition: state
              entity_id: !input "climate_id"
              state: cool
            sequence:
              - service: climate.set_temperature
                entity_id: !input "climate_id"
                data:
                  temperature: !input "cooling_temp"
        until:
          condition:
            and:
              - condition: time
                before: !input "retry_timeout"
              - not:
                - condition: state
                  entity_id: !input "climate_id"
                  state: "unavailable"
mode: single

This is the complete error from the logs:

Logger: homeassistant.components.automation
Source: components/automation/__init__.py:285
Integration: Automation (documentation, issues)
First occurred: 15:42:38 (9 occurrences)
Last logged: 15:58:47

Blueprint HVAC Daily Schedule, local version generated invalid automation with inputs OrderedDict([('climate_id', 'climate.tillbyggnad_hall'), ('cooling_temp', 22), ('heating_temp', 23), ('at_time', '06:30:00'), ('retry_timeout', '17:00:00'), ('on_sunday', False), ('on_saturday', False)]): expected a dictionary for dictionary value @ data['action'][0]['repeat']. Got None
Blueprint HVAC Daily Schedule, local version generated invalid automation with inputs OrderedDict([('climate_id', 'climate.in2124614'), ('cooling_temp', 22), ('heating_temp', 23), ('at_time', '06:30:05'), ('retry_timeout', '17:00:00'), ('on_saturday', False), ('on_sunday', False)]): expected a dictionary for dictionary value @ data['action'][0]['repeat']. Got None

You’re missing sequence for repeat, you went straight to a choose

You have:

repeat:
- choose:
  ...
  until:
  ...

it should be

repeat:
  sequence:
    - choose:
       ...
  until:
  ...

The error tells you exactly where to look:

Your first action, which is a repeat. The 0 indicates 1st.

Thanks!

That got me to a new error:

Logger: homeassistant.components.automation
Source: components/automation/__init__.py:285
Integration: Automation (documentation, issues)
First occurred: 17:41:49 (3 occurrences)
Last logged: 17:41:49

Blueprint HVAC Daily Schedule, local version generated invalid automation with inputs OrderedDict([('climate_id', 'climate.tillbyggnad_hall'), ('cooling_temp', 22), ('heating_temp', 23), ('at_time', '06:30:00'), ('retry_timeout', '17:00:00'), ('on_sunday', False), ('on_saturday', False)]): Unexpected value for condition: '{'and': [{'condition': 'time', 'before': '17:00:00'}, {'not': [{'condition': 'state', 'entity_id': 'climate.tillbyggnad_hall', 'state': 'unavailable'}]}]}'. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data['action'][0]['repeat']['until'][0]. Got None
Blueprint HVAC Daily Schedule, local version generated invalid automation with inputs OrderedDict([('climate_id', 'climate.in2124614'), ('cooling_temp', 22), ('heating_temp', 23), ('at_time', '06:30:05'), ('retry_timeout', '17:00:00'), ('on_saturday', False), ('on_sunday', False)]): Unexpected value for condition: '{'and': [{'condition': 'time', 'before': '17:00:00'}, {'not': [{'condition': 'state', 'entity_id': 'climate.in2124614', 'state': 'unavailable'}]}]}'. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data['action'][0]['repeat']['until'][0]. Got None

How it looks like now:

action:
  repeat:
    sequence:
      - choose:
          - conditions:
            - condition: state
              entity_id: !input "climate_id"
              state: heat
            sequence:
              - service: climate.set_temperature
                entity_id: !input "climate_id"
                data:
                  temperature: !input "heating_temp"
          - conditions:
            - condition: state
              entity_id: !input "climate_id"
              state: cool
            sequence:
              - service: climate.set_temperature
                entity_id: !input "climate_id"
                data:
                  temperature: !input "cooling_temp"
    until:
      condition:
        and:
          - condition: time
            before: !input "retry_timeout"
          - not:
            - condition: state
              entity_id: !input "climate_id"
              state: "unavailable"
mode: single

So where do you think your problem lies, now that I mentioned how to trace the error?

Thanks for methodically walking me through it.

I also reverted to the expanded syntax for conditions to make it clearer for me.

Here’s the final, working, version:

action:
  repeat:
    sequence:
      - choose:
          - conditions:
            - condition: state
              entity_id: !input "climate_id"
              state: heat
            sequence:
              - service: climate.set_temperature
                entity_id: !input "climate_id"
                data:
                  temperature: !input "heating_temp"
          - conditions:
            - condition: state
              entity_id: !input "climate_id"
              state: cool
            sequence:
              - service: climate.set_temperature
                entity_id: !input "climate_id"
                data:
                  temperature: !input "cooling_temp"
    until:
      condition: and
      conditions:
        - condition: time
          before: !input "retry_timeout"
        - not:
          - condition: state
            entity_id: !input "climate_id"
            state: "unavailable"
mode: single