New condition error

I must be missing something in the new conditions. I am getting an error:

Invalid config for [automation]: invalid list value @ data[‘condition’][0]

Here is my first automation with a condition

  - alias: 'lunch making'
    trigger:
      platform: time
      after: '07:15:00'
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
    action:
      service: switch.turn_on
      entity_id: switch.kitchen_undercab_switch_12

It worked prior when it was platform with condition above. Any help would be greatly appreciated,

 - alias: 'lunch making'
    trigger:
      platform: time
      after: '07:15:00'
    condition:               <-----
      condition: time        <-----
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
    action:
      service: switch.turn_on
      entity_id: switch.kitchen_undercab_switch_12

Try that - note that there is the key to say that this is the conditions to check, and then there is the key which say what sort of condition it is.

EDIT – changed the alignment as per reply below,

That worked with slight adjustment of moving condition inline with trigger, I thought I had tried that, must just be tired.

1 Like

I ran into something similar. I think the new code is a lot stricter on the spacing. It can pass the yaml syntax check but still generate a load of errors.

We actually did not make any changes there. It’s just as strict as 0.18.

probably something to do with two condition statements, if it is on the wrong level it will see it as a list of conditions, not the condition type (ie sun, time)

I don’t know. Seems that something is stricter or different.

I cannot even pass this automation


automation:
- alias: 'Turn on office lights when PC is on'
  trigger:
    platform: template
    value_template: '{% if 'home' in states('device_tracker.work_pc') %}true{% else %}false{% endif %}'
  condition: time
  after: '19:00:00'
  before: '23:59:00'
  action:
    service: homeassistant.turn_on
    entity_id: light.office

worked before the upgrade and now it halts everything.

I think figured out my problem why I thought it didnt work on one my attempts that was correct, If I didnt have any new errors the log was showing the old error and I didnt check the time stamp. My lights were on this morning like they were before the update.

Same thing - you need to key it as a condition, then set the condition parameter.

automation:
- alias: 'Turn on office lights when PC is on'
  trigger:
    platform: template
    value_template: '{% if 'home' in states('device_tracker.work_pc') %}true{% else %}false{% endif %}'
  condition:             <-----
    condition: time      <-----
    after: '19:00:00'
    before: '23:59:00'
  action:
    service: homeassistant.turn_on
    entity_id: light.office