---
title: "Режим „Кучето е вкъщи“: коридорът, който се грижи за Арчи, докато ни няма"
description: "Когато всички врати на стаите са затворени, Home Assistant праща известие, изчаква пет минути и пуска режим за кучето: гаси лампите, оставя приглушена светлина в коридора и върти вентилаторите при нужда."
canonical: "https://realhomeautomations.com/bg/projects/rezhim-kucheto-e-vkashti-osvetlenie-i-avtomatizatsii-za-domashnia-lyubimets/"
language: bg-BG
updated: 2026-11-23T16:28:57+00:00
---

# Режим „Кучето е вкъщи“: коридорът, който се грижи за Арчи, докато ни няма

Когато всички врати на стаите са затворени, Home Assistant праща известие, изчаква пет минути и пуска режим за кучето: гаси лампите, оставя приглушена светлина в коридора и върти вентилаторите при нужда.

> Канонична HTML страница: https://realhomeautomations.com/bg/projects/rezhim-kucheto-e-vkashti-osvetlenie-i-avtomatizatsii-za-domashnia-lyubimets/

- **Difficulty:** Средно ниво
- **Build time:** 60–120 минути
- **Време за четене:** 5 minutes

## Tools required

- Sonoff SNZB-04PR1 (Zigbee датчик за врата, по един на врата; при нас три)
- Осветление на коридора (което Home Assistant управлява)
- Помощник input_boolean (за включване и изключване на автоматичното осветление)
- Zigbee хъб или Home Assistant със Zigbee адаптер
- Мобилното приложение на Home Assistant (за известията)


## What readers will learn

- To detect "all doors are closed"
- Да дадеш пет минути за отмяна, преди да започне режимът
- Да върнеш нормалното осветление, щом се отвори врата


## Skill requirements

- Да редактираш автоматизация с wait_for_trigger в YAML
- Да ползваш input_boolean като превключвател

## Комплект за проекта

- [Умен сензор за врати и прозорци Sonoff SNZB-04PR1 – протокол Zigbee 3.0, захранване с батерия CR2477, известия в реално време при отваряне, eWeLink и Home Assistant](https://realhomeautomations.com/bg/produkt/smart-door-and-window-sensor-sonoff-snzb-04pr1-zigbee-3-0-protocol-cr2477-battery-powered-real-time-opening-alerts-ewelink-home-assistant/index.md)

Our French bulldog Archi doesn't like being alone: as soon as we all go out, he starts making puddles all around the house. That is why at our place the room doors are closed and Archi spends the day in the hallway. Over time this hallway became a smart place: the light, the climate and the fans look after him without anyone having to touch them.

 ## Какво ще получиш

 A mode that switches on by itself when all the room doors are closed and switches off as soon as one opens. While it is on, the hallway lights up dimly, the other lamps in the house go out, and your phones get a notification. The automation only watches the doors: it doesn't track Archi and doesn't send photos.

 ## Какво ти трябва

- [Sonoff SNZB-04PR1](https://realhomeautomations.com/bg/produkt/smart-door-and-window-sensor-sonoff-snzb-04pr1-zigbee-3-0-protocol-cr2477-battery-powered-real-time-opening-alerts-ewelink-home-assistant/): a Zigbee door sensor, one for each door you close. At our place there are three doors (living room, children's room, bedroom), so three sensors. Ours are from the previous model SNZB-04P; SNZB-04PR1 is its successor.
- Осветление в коридора, което Home Assistant управлява.
- Помощник `input_boolean`that switches the hallway's automatic lighting on and off.
- Мобилното приложение на Home Assistant за известията.

 Нужен е Zigbee хъб или Home Assistant със Zigbee адаптер.

 По желание: датчик за температура и влажност в коридора и вентилатор, който Home Assistant може да пуска. Те не са нужни за основния режим.

 Време за настройка: около час, плюс няколко дни, в които да видиш как режимът се държи в обичайното ти излизане.

 ## Как работи

- You close the last door → Home Assistant sends a notification: "the mode starts in 5 minutes".
- През тези пет минути следи дали някоя врата се отваря. Ако се отвори, режимът се отменя и получаваш ново известие.
- If the doors stay closed, the hallway's automatic lighting switches off, all the other lamps go out, and the hallway lights up at 35% and after a second at 55% at 4308 K: bright enough not to be in the dark, and soft enough for napping.
- При отваряне на врата втора автоматизация връща автоматичното осветление и нормалната светлина на коридора.

 The five minutes leave time for a door that closes for a moment and opens again. That way the mode doesn't switch on at every closing.

 ## Какво още има при нас

 Режимът не е само светлина. При нас са навързани няколко неща, които работят заедно:

- **Известия.** Both our phones get a warning when the mode is about to start, and a separate message when it has started. It comes at random from a list of playful texts, for example "King of the castle" or "The house is in good paws".
- **Светлина.** Приглушената светлина оставя коридора достатъчно светъл за Арчи, без да му пречи на дрямката.
- **Климат.** Към коридора са вързани температура и влажност, а вентилаторите от банята и от гардероба се пускат, когато е нужно, при отворени врати на тези помещения. Вентилаторът в банята работи по влажност: тръгва при бързо покачване и спира, когато влажността падне.

 All this happens while the doors of the living room, the children's room and the bedroom are closed and Archi is in the hallway.

 ## Стъпки

- Прегледай датчиците на вратите. Затворена врата трябва да е `off`, отворена: `on`.
- Направи `input_boolean`, например `input_boolean.hallway_auto_lights`, и го включи.
- Създай първата автоматизация от примера. Смени имената на обектите, зоната и услугите за известия със свои.
- Създай втората автоматизация, която връща помощника и нормалното осветление при отваряне на врата.
- Затвори всички врати и изчакай. Известието трябва да дойде веднага, а промяната в осветлението след пет минути.

 All the entity names below are examples. You paste each automation as a new one, through the three-dots menu and "Edit in YAML".

 ```
alias: Mode "Dog at home" (example)
mode: single
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.bedroom_door_opening
      - binary_sensor.kids_bedroom_door_opening
      - binary_sensor.living_room_door_opening
    to: "off"
conditions:
  - condition: state
    entity_id: binary_sensor.bedroom_door_opening
    state: "off"
  - condition: state
    entity_id: binary_sensor.kids_bedroom_door_opening
    state: "off"
  - condition: state
    entity_id: binary_sensor.living_room_door_opening
    state: "off"
actions:
  - action: notify.mobile_app_telefon  # replace with your phone
    data:
      title: The dog mode starts soon
      message: All the doors are closed. If they stay closed, the mode switches on in 5 minutes.
  - wait_for_trigger:
      - trigger: state
        entity_id:
          - binary_sensor.bedroom_door_opening
          - binary_sensor.kids_bedroom_door_opening
          - binary_sensor.living_room_door_opening
        to: "on"
    timeout: "00:05:00"
    continue_on_timeout: true
  - if:
      - condition: template
        value_template: "{{ wait.trigger is not none }}"
    then:
      - stop: The mode is cancelled because a door has opened.
  - action: input_boolean.turn_off
    target:
      entity_id: input_boolean.hallway_auto_lights
  - action: light.turn_off
    target:
      entity_id: >-
        {{ states.light | map(attribute='entity_id')
           | reject('in', area_entities('hallway')) | list }}
  - action: light.turn_on
    target:
      area_id: hallway
    data:
      brightness_pct: 35
      transition: 0.3
  - delay: "00:00:01"
  - action: light.turn_on
    target:
      area_id: hallway
    data:
      brightness_pct: 55
      color_temp_kelvin: 4308
```

 Условията гарантират, че и трите врати са затворени. Ако някой датчик е `unavailable`, the mode doesn't start.

 ```
alias: Mode "Dog at home" - switch off (example)
mode: single
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.bedroom_door_opening
      - binary_sensor.kids_bedroom_door_opening
      - binary_sensor.living_room_door_opening
    to: "on"
conditions:
  - condition: state
    entity_id: input_boolean.hallway_auto_lights
    state: "off"
actions:
  - action: input_boolean.turn_on
    target:
      entity_id: input_boolean.hallway_auto_lights
  - action: script.hallway_lights_normal_on  # your script for the normal light
```

 Второто условие прави автоматизацията да работи само когато режимът е бил включен.

 ## Проверка на резултата

- Нормално изпълнение: затваряш последната врата и известието идва веднага. След пет минути коридорът светва приглушено, а останалите лампи угасват.
- Граничен случай: отваряш врата през петте минути. Режимът се отменя и идва известие за отмяна.
- Restoring: you open a door when the mode is on. The hallway's automatic lighting returns and the light becomes normal.
- Missing data: if a sensor's battery runs down, it becomes `unavailable` and the mode simply doesn't start until you bring it back.

 ## If it doesn't work

- The mode doesn't start → some door is `unavailable` → check the sensor's battery and connection.
- Lamps don't go out → the template for "all lamps except the hallway" caught only some of them → check which lamps are in the hallway's area.
- The second automation doesn't restore the light → `input_boolean.hallway_auto_lights` вече е включен → провери състоянието му.

 ## Как се спира

 Switch off the two automations from Settings → Automations & scenes. The hallway lighting is controlled as before, and the switches and the apps keep working.

 ## Източници и статус на проверката

 The door and lighting automations were read in Marto's Home Assistant on 23.11.2026 (read-only): doors, notifications, the five-minute wait and the hallway lighting. The examples are simplified and use example entity names.

- [Home Assistant: Automation triggers](https://www.home-assistant.io/docs/automation/trigger/)
- [Home Assistant: Scripts, wait_for_trigger](https://www.home-assistant.io/docs/scripts/)
- [Home Assistant: Input boolean](https://www.home-assistant.io/integrations/input_boolean/)
- [Home Assistant: Zigbee Home Automation](https://www.home-assistant.io/integrations/zha/)