CCCPaste

055697d345de9

sensor:
  - platform: time_date
    display_options:
      - time
      - date
      - date_time
      - date_time_utc
      - date_time_iso
      - time_date
      - time_utc

automation:
  - alias: Doorbell Motion – Turn On Light After Dark (Only if Off)
    description: Turn on porch light to 100% brightness when doorbell detects motion, but only after dark and only if the light is off.
    trigger:
      - platform: state
        entity_id: switch.front_doorbell_motion_detection
        to: "on"
    condition:
      - condition: and
        conditions:
          - condition: or
            conditions:
              - condition: sun
                after: sunset
              - condition: sun
                before: sunrise
          - condition: state
            entity_id: light.front_porch_light
            state: "off"
    action:
      - service: light.turn_on
        target:
          entity_id: light.front_porch_light
        data:
          brightness_pct: 100
      - delay: "00:05:00"
      - service: light.turn_off
        target:
          entity_id: light.front_porch_light
    mode: restart