Automation Condition Troubleshooting

I have a sunset timer on a front porch light. I just added a gate sensor to turn on the same light. I want to turn off the light when the gate closes, but not between sunset and 2200 (I have an automation that turns the porch light off based on time).

I setup a sensor to track when the porch light turns on via automation. This gets sets to ‘on’ when the sunset automation runs, and set to ‘off’ when the time automation runs.

In my gate close automation, I added a condition that the state of this sensor should be off. Meaning, if someone closes the gate between sunset and 2200, the gate automation should not turn off the light. However, I cannot get this to work. Here’s my automation for Gate Close:

- id: '1575140640643'
  alias: Front Gate - Light Off
  description: ''
  trigger:
  - entity_id: binary_sensor.gate_status
    platform: state
    to: 'off'
  condition:
  - condition: state
    entity_id: sensor.porch_light_automation
    state: 'off'
  action:
  - data:
      node: 3
      path: switch_binary/value
      value: 0
    service: rest_command.engen_api

If I go to Developer Tools > Template and type {{ is_state('sensor.porch_light_automation', 'off') }} it reports false. Yet, when I go to Configuration and manually trigger the Front Gate - Light Off, the porch light turns off. Eventually I’ll change this to turn off after X minutes, but for now I thought this would be easier to test. This seems basic… What am I missing?

Manually triggering an automation bypasses triggers and conditions and just runs the actions.

Ha. Well that explains that… Thanks!