(SOLVED) Condition with 2 conditions (or)

Hi All,

Im new here and finaly find out how yaml work (not for full 100%) otherwise i didnt post this.
I have this script now. Work perfect. But i need 1 condition with a OR statement

device_tracker.geofency_peter = Home or device_tracker.geofency_kay = Home

Also idea was, when device_tracker goes to Home it start automation as well, but it wait for the 1 minute time. Can i change this. So when status change fire autmation, and when its active already automation will check every minute also?

- id: '1565250000052'
  alias: Scene Evening
  trigger:

  - entity_id: device_tracker.geofency_peter
    platform: state
    to: Home

  - platform: time_pattern
    minutes: /1

  - entity_id: sensor.harmony
    platform: state
    to: 'off'

  condition:
    condition: and
    conditions:
      - condition: sun
        after: sunrise
        before: sunset

      - condition: state
        entity_id: input_boolean.scene_evening
        state: 'off'

      - condition: state
        entity_id: sensor.harmony
        state: 'Off'

      - condition: or
        conditions:
          - condition: state
            entity_id: device_tracker.geofency_peter
            state: Home
          - condition: state
            entity_id: device_tracker.geofency_kay
            state: Home 

  action:
  - service: notify.pushover
    data:
      message: Scene evening is activated

  - service: input_boolean.turn_on
    data:
      entity_id: input_boolean.scene_evening

  - service: input_boolean.turn_off
    entity_id:
      - input_boolean.scene_kodi
      - input_boolean.scene_ziggo
      - input_boolean.scene_iptv
      - input_boolean.scene_daylight
      - input_boolean.scene_appletv

  - service: light.turn_on
    entity_id: light.nanoleaf
    data_template:
      brightness: 255
      effect: >
        {% if states.input_select.select_holiday.state == "Christmas" %} Christmas
        {% elif states.input_select.select_holiday.state == "Easter" %} Easter
        {% elif states.input_select.select_holiday.state == "Halloween" %} Halloween
        {% elif states.input_select.select_holiday.state == "Kingsday" %} Kingsday
        {% elif states.input_select.select_holiday.state == "Bday" %} Fireplace
        {% else %} NorthernLight
        {% endif %}

  - service: light.turn_on
    data:
      entity_id: light.livingroom_all
      brightness: 255
      kelvin: 2700

  - service: light.turn_on
    entity_id: light.dressoir_all
    data_template:
      brightness: 255
      color_name: >
        {% if states.input_select.select_diningdoor_open.state == "Closed" %} white
        {% elif states.input_select.select_diningdoor_open.state == "Open" %} blue
        {% endif %}

  - service: light.turn_on
    data:
      entity_id: light.balcony
      brightness: 255
      effect: 0

I read the condition page with the example:

condition:
  condition: and
  conditions:
    - condition: state
      entity_id: 'device_tracker.paulus'
      state: 'home'
    - condition: or
      conditions:
        - condition: state
          entity_id: sensor.weather_precip
          state: 'rain'
        - condition: numeric_state
          entity_id: 'sensor.temperature'
          below: 20

but what i try, it wont work… maybe im doing something wrong (newbie)

cheers,

You don’t need to specify the top level AND. It’s that logic by default.

This should work:

  condition:
    - condition: sun
      after: sunrise
      before: sunset

    - condition: state
      entity_id: input_boolean.scene_evening
      state: 'off'

    - condition: state
      entity_id: sensor.harmony
      state: 'Off'

    - condition: or
      conditions:
        - condition: state
          entity_id: device_tracker.geofency_peter
          state: Home
        - condition: state
          entity_id: device_tracker.geofency_kay
          state: Home 

Tried that also. But the automation won’t start

Read that already. But thanks

Problem solved…

its handy when you use the right type of the state… ‘home’ instead of ‘Home’

Sorry!!!

Check the states in your trigger and conditions.
device_tracker can be ‘home’ or ‘not_home’
sensors can be ‘on’ or ‘off’
Case matters, check them in Dev Tools/states.

You beat me to it. “home” vs “Home” is likely to be the issue.

Find it out also. Post my silly question at same time you post this :slight_smile: