Getting error for all automation conditions "Unsupported condition: or"

I am getting an error on all my automations; I could have sworn they were all working fine a few days ago. I’ve tried a number of variations on the indentation but the result is either the same, or a different error, related to the bad spacing.

I could have sworn that I immitated the example on the how-to: https://home-assistant.io/docs/automation/condition/

Has anyone seen something like this?

This is an example yaml:

- alias: Arriving Home
  id: arriving
  trigger:
    platform: state
    entity_id: group.people
    from: not_home
    to: home
  condition:
    condition: or
    conditions:
      - condition: time
        after: 06:30:00
      - condition: time
        before: '22:00:00'
  action:
  - service: switch.turn_on
    entity_id:
    - switch.synology_home_mode
  - service: switch.turn_off
    entity_id:
    - switch.foscam_motion
    - switch.ipwebcam_motion
    - switch.dlink_motion
  - service: notify.pushbullets7
    data:
      title: Home again
      message: Kelly and/or Matt are home again
  - service: mqtt.publish
    data:
      topic: say/a5
      payload: Cameras deactivated
      qos: 0

This is the error:

Unsupported condition: or
{
  "condition": "or",
  "conditions": [
    {
      "after": "06:30:00",
      "condition": "time"
    },
    {
      "before": "22:00:00",
      "condition": "time"
    }
  ]
}

try putting double quotes ( " ") around your time values

1 Like

I agree with @finity you need either single or double quotes round your times, personally I use single quotes :slight_smile:

1 Like

Thanks guys for the prompt assistance!

Great community, this

Unfortunately - the quotes didn’t solve the problem :frowning:

I realised that ‘and’ made more sense in this instance - but after changing it, I get the same error; except now it’s “Unsupported condition: and”.

Version is 0.60.0, maybe I’ll try a docker update. This just seems like I’ve collected a bug somehow…

Code:

- alias: Arriving Home
  id: arriving
  trigger:
    platform: state
    entity_id: group.people
    from: not_home
    to: home
  condition:
    condition: and
    conditions:
      - condition: time
        after: '06:30:00'
      - condition: time
        before: '22:00:00'
  action:
  - service: switch.turn_on
    entity_id:
    - switch.synology_home_mode
  - service: switch.turn_off
    entity_id:
    - switch.foscam_motion
    - switch.ipwebcam_motion
    - switch.dlink_motion
  - service: notify.pushbullets7
    data:
      title: Home again
      message: Kelly and/or Matt are home again

And error:

Unsupported condition: and
{
  "condition": "and",
  "conditions": [
    {
      "after": "06:30:00",
      "condition": "time"
    },
    {
      "before": "22:00:00",
      "condition": "time"
    }
  ]
}

Maybe you can’t use a condition of time after and time before?

Try removing one of those and substituting a different condition to test to see if that’s the issue.

1 Like

I get the same error with non-time related conditions as well:

- alias: Camera Mode On
  id: wakedisarm
  trigger:
  - platform: time
    at: '06:30:00'
  - platform: mqtt
    topic: auto/surv
    payload: 'homemodeon'
  condition:
    - condition: or
      conditions:
      - condition: state
        entity_id: group.people
        state: 'home'
      - condition: state
        entity_id: switch.foscam_motion
        state: 'on'
      - condition: state
        entity_id: switch.ipwebcam_motion
        state: 'on'
      - condition: state
        entity_id: switch.dlink_motion
        state: 'on'
      - condition: state
        entity_id: switch.synology_home_mode
        state: 'off'
  action:
  - service: switch.turn_on
    entity_id:
    - switch.synology_home_mode
  - service: switch.turn_off
    entity_id:
    - switch.foscam_motion

Is that all the home-assistant.log file says about the error you’re getting?

If there is more post it up to see if it leads anywhere else.

1 Like

Good point finity - I should have mentioned this already; the only errors I see are in the Automations web editor part of the console. The log has nothing interesting.

My current log started like this:

2018-01-30 07:41:00 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=337 from 2018-01-28 20:06:11.095179)
2018-01-30 07:43:11 WARNING (MainThread) [homeassistant.components.sensor.template] Could not render template Audio Station Active, the state is unknown.

Ok…

So when you make the changes to your configuration in automations.yaml as you did in the first post at the top and you restart home assistant what happens?

Do you get any errors then? Does the frontend load? Is there any errors about automations.yaml in the home-assistant.log file?

1 Like

No errors in the interface or main log - not when I hit ‘check config’ either. If I check it in an online yaml-checker it is fine too.

I thought everything was working, until I noticed an automation went off while I was not at home, against condition rules. This lead me to look at the conditions within the Automations web editor (http://hasshost:8123/config/automation), which is the only place that I see an issue.

I just ran a docker pull, but the version still says ‘0.60.0’

off the cuff I see nothing wrong with your yaml.

1 Like

You can always use this format with and/or conditions. Only problem is that specific times of day aren’t supported in this method (i.e. after 6pm):

- alias: Camera Mode On
  id: wakedisarm
  trigger:
  - platform: time
    at: '06:30:00'
  - platform: mqtt
    topic: auto/surv
    payload: 'homemodeon'
  condition:
    - condition: template
      value_template: "{{ is_state('group.people','home') or is_state('switch.foscam_motion', 'on') }}"
  action:
  - service: switch.turn_on
    entity_id:
    - switch.synology_home_mode
  - service: switch.turn_off
    entity_id:
    - switch.foscam_motion

You’d have to add all your or statements, but shouldn’t be too bad. That’s if you just want to get that working asap.

2 Likes

Thanks Petro, good workaround!

I even went as far as installing docker on a fresh Synology instance, pulled a fresh docker instance - and coipied my config over; same error…

So weird.

Has anyone managed to find what is causing this error? I am fairly new to HA and trying a simple automation example. As far as I can see, I have followed the example for an OR condition at https://www.home-assistant.io/docs/scripts/conditions/ For example:

Test multiple conditions in 1 condition statement. Passes if any embedded condition is valid.

condition:
condition: or
conditions:
- condition: state
entity_id: ‘device_tracker.paulus’
state: ‘home’
- condition: numeric_state
entity_id: ‘sensor.temperature’
below: ‘20’

So here is my actual automation code:

  • id: ‘1527151265839’
    alias: Light Off
    hide_entity: True
    trigger:
    • at: ‘22:28:00’
      platform: time
      condition:
      condition: or
      conditions:
      • condition: state
        entity_id: switch.hall_light
        state: ‘on’
      • condition: state
        entity_id: switch.familyroom
        state: ‘on’
        action:
    • alias: ‘Turn familyroom table light off’
      data:
      entity_id: switch.familyroom
      service: switch.turn_off
    • alias: ‘Turn hall table light off’
      data:
      entity_id: switch.halllight
      service: switch.turn_off

And here is what I see when I look at the Automation tab in HA:

Unsupported condition: or

{
“condition”: “or”,
“conditions”: [
{
“condition”: “state”,
“entity_id”: “switch.hall_light”,
“state”: “on”
},
{
“condition”: “state”,
“entity_id”: “switch.familyroom”,
“state”: “on”
}
]
}

So - my question is - does this work or doesn’t it? Is the ‘OR’ condition supported or isn’t it? I don’t want to waste time trying to correct something that just doesn’t work!! Thanks for any assistance…

I have this too but it’s only a GUI error. The automation works perfectly just the editor doesn’t support ‘or’ conditions.

2 Likes

Yes - that is what I came to realise. The automations were working fine, but forget trying to modify/author them in the GUI.

OK, thanks so much for the prompt replies - and great news to know that it’s really NOT a problem! I had a sneaky suspicion that the automation worked - I’d seen the lights go off!! But - as I wasn’t sure that the HA Automation was working, I’d kept the original non-HA app “live” for the two lights. Now I feel much more confident that I can go ahead and rely solely on HA. As an aside, is there any news as to when this - somewhat irritating, and slightly disconcerting - bug might be looked at? I see quite a number of respondents in various forums who, like me, are concerned that they appear to have done everything ‘by the book’ and still get error messages.

Most people who do more complicated automations won’t use the GUI and that is the standard advice I have seen. I don’t think it’s a priority from what I have seen.

1 Like