Automation question.. simple I hope

I have 2 simple automations that are not working so I figured I have to be missing something simple…
Any input or help would be appreciated very much!! Both are about the same so I’ll just post one to hopefully get some input.
NOW each device works fine on its own… turns on or off, reports motion etc… but in this automation the light is not being triggered…

- alias: 11a - Turn on Hall lights
  id: Turn on Hall lights
  triggers:
    - trigger: state
      entity_id: binary_sensor.hall_light_on_off_motion
      from: "off"
      to: "on"

  condition:
    condition: and
    conditions:
      #- condition: numeric_state
      #  entity_id: sensor.lr_window_light_level
      #  below: 500.00
      - condition: time
        before: "23:00:00"
        after: "16:00:00"
  actions:
    - action: light.turn_on
      entity_id: light.hallway

- alias: 11b - Turn off Hall lights
  id: Turn off Hall lights
  triggers:
    - trigger: state
      entity_id: binary_sensor.hall_light_on_off_motion
      from: "on"
      to: "off"
      for: "00:00:30"
  actions:
    - action: light.turn_off
      entity_id: light.hallway

I’m probably overlooking something simple but I cannot for the life of figure out why it’s not working…

Thank you!

You’re missing the target key.

  actions:
    - action: light.turn_on
      target:
        entity_id: light.hallway

FWIW, the and condition is unecessary… it shouldn’t cause an actual issue, it’s just not needed.

1 Like

Hi, I think you should change the AND condition to OR

1 Like

Both excellent suggestions and I Thank you both…
I do need both conditions to be met otherwise I get blinded in the middle of the night LOL
The other condition could possibly be met even during the day if it’s a dark and gloomy day when lights are not a bad thing :slight_smile:

I only had the first one commented out as I was trying to get it working all day… and the light sensor was too bright so it wouldn’t fire.

Just for testing purposes I even commented out ALL conditions and still no go.

I did at the ‘target’ but still not working as written and it’s jsut strange…

- alias: 11a - Turn on Hall lights
  id: Turn on Hall lights
  triggers:
    - trigger: state
      entity_id: binary_sensor.hall_light_on_off_motion
      from: "off"
      to: "on"
  condition:
    condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.lr_window_light_level
        below: 500.00
      - condition: time
        before: "23:00:00"
        after: "16:00:00"
  actions:
    - action: light.turn_on
      target:
        entity_id: light.hallway

OKAY… found it… IT does NOT like the like the second line…
this one => id: Turn on Hall lights
Comment that out… it’s working!!! :slight_smile:

Not sure why that would be…

1 Like

understand now :slight_smile:

Shortened it… got rid of the second automation… combined it all into one… works great!! Thank you for your input, I appreciate it!

- alias: 11 - Turn on Hall lights 
  triggers:
    - trigger: state
      entity_id: binary_sensor.hall_light_on_off_motion
      to: "on"
  condition:
    condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.lr_window_light_level
        below: 500.00
      - condition: time
        before: "23:00:00"
        after: "16:00:00"
  actions:
    - action: light.turn_on
      target:
        entity_id: light.hallway
    - delay: "00:00:15"
    - action: light.turn_off
      target:
        entity_id: light.hallway