X AND either (y OR z) - condition.... Isn't working as I'd expect?


#1

Hey all, I have these two automations, basically I need a different thing to happen based on whether I’m present or not. However, when these are triggered, they are BOTH executed at the same time… I’m confused how as bedroompresence is either off or on… It should be (for the first), that bedroompresence is On, and lightingstyle is either Dark or Cloudy.

Could someone let me know what I’m misunderstanding here? Thanks

- alias: 'Lights on sunset present'
  trigger:
    - platform: sun
      event: sunset
      offset: '-00:15:00'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.bedroompresence
        state: 'off'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_select.lightingstyle
            state: 'Dark'
          - condition: state
            entity_id: input_select.lightingstyle
            state: 'Cloudy'


- alias: 'Lights on sunset notpresent'
  trigger:
    - platform: sun
      event: sunset
      offset: '-00:15:00'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.bedroompresence
        state: 'off'
      - condition: or
        conditions:
          - condition: state
            entity_id: input_select.lightingstyle
            state: 'Dark'
          - condition: state
            entity_id: input_select.lightingstyle
            state: 'Cloudy'

#2

Your bedpresence state for both is ‘off’.


#3

Hahaha,

/slaps forehead.

Thank you for the fresh eyes :slight_smile:


#4

Maybe you can combine the two automations if you put a condition (or a template) for the input_boolean.bedroompresence in the action part of the automation.