Closet Light Control with Zigbee Ghosting Protection and Timeout

Just needs a Door Sensor and Light Entity to work

  • Light on when door opens (Door Open → Light On)
  • Light off when door closes (Door Close → Light On)
  • Ghost OFF Protection (Light Off Door Open-> Light On)
  • Ghost On Protection (Light on Door Closed → Light Off)
  • 10-minute auto-off timeout (Light On 10 mins → Light Off)
blueprint:
  name: Closet Light - Smart Control
  description: >
    Turns closet light on/off with door, includes ghost trigger protection
    and auto-off after 10 minutes.
  domain: automation
  input:
    door_sensor:
      name: Closet Door Sensor
      selector:
        entity:
          domain: binary_sensor
    closet_light:
      name: Closet Light
      selector:
        entity:
          domain: light

mode: restart
trigger:
  - platform: state
    entity: !input door_sensor
    to: "on"
    id: door_opened

  - platform: state
    entity: !input door_sensor
    to: "off"
    id: door_closed

  - platform: state
    entity: !input closet_light
    to: "on"
    id: light_on

  - platform: state
    entity: !input closet_light
    to: "off"
    id: light_off

  - platform: state
    entity: !input closet_light
    to: "on"
    for: "00:10:00"
    id: light_timeout

condition: []

action:
  - choose:
      - conditions:
          - condition: trigger
            id: door_opened
        sequence:
          - service: light.turn_on
            target:
              entity_id: !input closet_light

      - conditions:
          - condition: trigger
            id: door_closed
        sequence:
          - service: light.turn_off
            target:
              entity_id: !input closet_light

      - conditions:
          - condition: trigger
            id: light_on
          - condition: state
            entity: !input door_sensor
            state: "off"
        sequence:
          - delay: "00:00:05"
          - condition: state
            entity: !input door_sensor
            state: "off"
          - service: light.turn_off
            target:
              entity_id: !input closet_light

      - conditions:
          - condition: trigger
            id: light_off
          - condition: state
            entity: !input door_sensor
            state: "on"
        sequence:
          - delay: "00:00:05"
          - condition: state
            entity: !input door_sensor
            state: "on"
          - service: light.turn_on
            target:
              entity_id: !input closet_light

      - conditions:
          - condition: trigger
            id: light_timeout
        sequence:
          - service: light.turn_off
            target:
              entity_id: !input closet_light

Hello rupin,
Thanks for contributing to the community with a new Blueprint.

I have a suggestion for you. Many people who are not familiar with directory structures will have problems installing this without the Home Assistant MY tools

Adding a MY link for this Blueprint to your top post would help them a lot.

Here is the link to make that
Create a link – My Home Assistant

1 Like