Is there a way to have ALL conditions met in automation, not "Test if any of 5 conditions matches"

I have a automation for lights, It dims when watching movie, turns on backlight of TV etc, BUT when someone moves the sensor triggers full lights, looking into the automation I noticed at the top it says

Test if any of 5 conditions matches

I would want all 5 conditions met, not any of the 5. Is there a way to get all conditions to be met before triggering the lights on full?

Cheers

Conditions are always using an AND logic, so it only starts the automation if all the conditions are met.

If that is not happening, why don’t you share your code so we can take a look and understand what is happening?

OK, then you probably have an OR condition there… You just have to remove that OR.

Again, share the code and I will try to help.

Thank You, there is a ‘or’ on line 10. remove that? or replace it with ‘and’? (aplogies formatting got bit messed up in the paste)

alias: Lounge Lamps On
description: ""
trigger:
  - type: motion
    platform: device
    device_id: 06d4e9658e4eedc35a13f6ff55d7eadd
    entity_id: binary_sensor.lounge_motion_occupancy
    domain: binary_sensor
condition:
  - condition: or
    conditions:
      - condition: sun
        after: sunset
        after_offset: "-00:15:00"
      - condition: sun
        before: sunrise
      - condition: device
        type: is_off
        device_id: 9c39b0dca9ab1c9f684aa270207bf348
        entity_id: light.tv_backlight
        domain: light
        for:
          hours: 0
          minutes: 0
          seconds: 0
      - condition: device
        device_id: 18a8940a00bf96748a0e385057232d34
        domain: media_player
        entity_id: media_player.lg_webos_tv_nano816pa
        type: is_off
      - type: is_motion
        condition: device
        device_id: 06d4e9658e4eedc35a13f6ff55d7eadd
        entity_id: binary_sensor.lounge_motion_occupancy
        domain: binary_sensor
        for:
          hours: 0
          minutes: 2
          seconds: 30
action:
  - service: scene.turn_on
    target:
      entity_id: scene.lounge_lamps
    metadata: {}
mode: single

Removed ‘or’ and replaced with ‘and’ and it looks like it is working. Thank you so much.

1 Like

Good to hear that.

You probably could replace those two conditions by a “below horizon” or, even better, in my opinion, use sun angle (usually you have quite good light on external areas when the Sun is higher than -6° from the horizon, even if it’s before sunrise or after sunset - and angle, even if you use a positive one, will adapt better to the different seasons when compared to the 15min).

1 Like

Is this correct? It won’t allow the automation to run unless you have movimento for more than 2min 30sec. If you have movement for only 2min it won’t work…

I put that in when couldn’t find answer and though by delaying the trigger it might help, I have reset it since, Your solution worked and will do sun horizon. Thank you again.

1 Like