Two Ways to Turn On the Same Garage Lights in Home Assistant

Use a garage door event or Frigate person detection to turn on the same Home Assistant lights, then wait for both doors closed and the garage clear.

Watch on YouTube ↗Get the code ↗Explore the gear →

When we pull into the garage after dark, the door opening is enough to turn on the lights. When I come in through the house, neither garage door moves. The camera can still tell Home Assistant somebody walked in.

Trust but verify. Two sensor signals control one Home Assistant garage light.

I use both signals to turn on the same two-bulb fixture. Once the lights are on, Home Assistant keeps checking the doors and the camera. That gives me light while I unload the car, even after the door closes.

Connect the doors, camera, and lights

  1. Add your garage door controllers to Home Assistant and check that each cover reports open and closed in Developer Tools → States.
  2. Connect the Frigate integration and enable person detection on the interior camera. Use that camera’s person occupancy sensor and detection switch. Walk through the garage once to see the sensor switch on and then clear.
  3. Put the bulbs in one Home Assistant light group. Test that the group controls both bulbs. If you want the optional wall-switch reminder, test an announcement through your own notify entity too.

My doors already report their position through the Garadget setup I use for arrival and garage routines. The same approach works with another door controller that reports cover state.

Decide what each signal can tell you

  • Turn on from the driveway. Opening either garage door turns on the lights while the sun is more than six degrees below the horizon. Home Assistant follows civil dusk and dawn throughout the year.
  • Turn on from the house. Frigate seeing a person can turn on the lights after dark, or during daylight when both garage doors are closed. When the last door closes, Home Assistant also checks for someone already inside.
  • Turn off when the garage stays clear. Start the 10-minute wait when both doors are closed and person occupancy is clear. A returning person or a door change interrupts the wait. When Frigate comes back from an outage, the automation needs a valid clear reading before the countdown can finish.

If I deliberately switch detection off, the rule uses the doors alone for the shutoff timer. With detection enabled, an unavailable sensor leaves the lights on until the inputs recover. Reloading automations or restarting Home Assistant ends the current run.

Copy the Home Assistant YAML

These are the two lighting automations from my Garadget package on GitHub. Put them in a YAML package and replace the cover, light group, individual bulbs, Frigate sensor, detection switch, and notification entity with yours. If you already have an automation: section in that package, add the entries to the existing list.

Show the garage lighting and wall-switch YAML
automation:
  - alias: Small Garage Lights After Dark
    id: small_garage_lights_after_dark
    description: >-
      A door opening or Garagecam detecting a person turns on the small garage
      fixture between civil dusk and dawn. In daylight, person detection can
      start it once both doors are closed. Both doors must stay closed and
      occupancy clear for 10 minutes to turn it off. If detection is switched
      off, use the doors alone. An automation reload or restart ends the run.
    mode: single
    max_exceeded: silent
    triggers:
      - trigger: garage_door.opened
        id: door_opened
        target:
          entity_id: &garage_light_doors
            - cover.large_garage_door
            - cover.small_garage_door
      - trigger: garage_door.closed
        id: door_closed
        target:
          entity_id: *garage_light_doors
      - trigger: occupancy.detected
        id: person_detected
        target:
          entity_id: binary_sensor.garagecam_person_occupancy_2
    conditions:
      - condition: or
        conditions:
          - alias: A door opened after dark
            condition: and
            conditions:
              - condition: trigger
                id: door_opened
              - &garage_light_dark
                condition: sun.elevation
                options:
                  threshold:
                    type: below
                    value:
                      number: -6
          - alias: A person is inside with both doors closed or was detected after dark
            condition: and
            conditions:
              - condition: trigger
                id:
                  - person_detected
                  - door_closed
              - condition: state
                entity_id:
                  - switch.garagecam_detect_2
                  - binary_sensor.garagecam_person_occupancy_2
                state: 'on'
              - condition: or
                conditions:
                  - condition: state
                    entity_id: *garage_light_doors
                    state: 'closed'
                  - condition: and
                    conditions:
                      - condition: trigger
                        id: person_detected
                      - *garage_light_dark
    actions:
      - action: light.turn_on
        target:
          entity_id: light.garage_lights
      - repeat:
          sequence:
            - alias: Wait for both doors closed and no person detected
              wait_template: >-
                {{ is_state('cover.large_garage_door', 'closed')
                   and is_state('cover.small_garage_door', 'closed')
                   and (is_state('switch.garagecam_detect_2', 'off')
                        or (is_state('switch.garagecam_detect_2', 'on')
                            and is_state('binary_sensor.garagecam_person_occupancy_2', 'off'))) }}
            - alias: Restart the hold when a door or the occupancy inputs change
              wait_for_trigger:
                - trigger: state
                  entity_id:
                    - cover.large_garage_door
                    - cover.small_garage_door
                    - binary_sensor.garagecam_person_occupancy_2
                    - switch.garagecam_detect_2
                  to: null
              timeout: &garage_lights_hold "00:10:00"
          until:
            - "{{ not wait.completed }}"
            - condition: state
              entity_id:
                - cover.large_garage_door
                - cover.small_garage_door
              state: 'closed'
              for: *garage_lights_hold
            - condition: or
              conditions:
                - condition: state
                  entity_id: switch.garagecam_detect_2
                  state: 'off'
                  for: *garage_lights_hold
                - condition: and
                  conditions:
                    - condition: state
                      entity_id: switch.garagecam_detect_2
                      state: 'on'
                      for: *garage_lights_hold
                    - condition: state
                      entity_id: binary_sensor.garagecam_person_occupancy_2
                      state: 'off'
                      for: *garage_lights_hold
      - action: light.turn_off
        target:
          entity_id: light.garage_lights

  - alias: Garage Light Switch Power Reminder
    id: garage_light_switch_power_reminder
    description: Remind through the Garage Echo if both bulbs on the shared fixture lose contact.
    mode: single
    triggers:
      - trigger: state
        entity_id: light.garage_lights
        from:
          - 'on'
          - 'off'
        to: 'unavailable'
        for: "00:00:30"
    conditions:
      # The group can also be unavailable if its members are missing during setup.
      - condition: state
        entity_id:
          - light.dimmable_light_1_2
          - light.garage_2_bulb
        state: 'unavailable'
    actions:
      - action: notify.send_message
        target:
          entity_id: notify.garage_speak
        data:
          message: "The garage light switch may be off. Please turn it back on."

The wall-switch reminder is a separate automation. If both bulbs stay unreachable for 30 seconds, the Garage Echo asks us to check the switch. A Hue bridge outage can cause the same states, so the announcement says the switch may be off.

Test both ways in

  1. After dusk, open a garage door with the light group off. Check the automation trace for the door trigger.
  2. With both garage doors shut and the lights off, walk in from the house. Check that Frigate sees a person and that the light group switches on.
  3. Leave the garage closed and empty for 10 minutes. Come back partway through another run and watch the clear period start over. If the timer never completes, check for a door that still reports open or a person sensor that never clears.

Watch both triggers in the garage

In the video you can see us drive in, then see me walk in separately with both doors closed. Watch for what stays on after the door closes and what changes once the garage is clear. The video shows the original 20-minute wait. I shortened it to 10 minutes after filming.

Advertisement

Keep building

The next useful idea, in your inbox.

Get new vCloudInfo posts by email.

Get new posts