{"id":26525063,"url":"https://github.com/michaelbolanos/home-assistant-door-sensor","last_synced_at":"2026-06-29T11:31:27.034Z","repository":{"id":280852183,"uuid":"943395124","full_name":"michaelbolanos/home-assistant-door-sensor","owner":"michaelbolanos","description":"This automation manages an alarm system based on the status of the rear door sensor and a bypass button. It ensures that the alarm triggers when the rear door is opened unless the bypass mode is active.","archived":false,"fork":false,"pushed_at":"2025-03-19T15:01:32.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-06T19:50:04.648Z","etag":null,"topics":["automation","home-assistant","senior-centers","unifi-protect","unifi-protect-cameras"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelbolanos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-05T16:31:17.000Z","updated_at":"2025-03-19T15:01:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e3f9928-8776-4cd0-b3d7-c9bac47eb696","html_url":"https://github.com/michaelbolanos/home-assistant-door-sensor","commit_stats":null,"previous_names":["michaelbolanos/home-assistant-door-sensor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michaelbolanos/home-assistant-door-sensor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelbolanos%2Fhome-assistant-door-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelbolanos%2Fhome-assistant-door-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelbolanos%2Fhome-assistant-door-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelbolanos%2Fhome-assistant-door-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelbolanos","download_url":"https://codeload.github.com/michaelbolanos/home-assistant-door-sensor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelbolanos%2Fhome-assistant-door-sensor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34925718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","home-assistant","senior-centers","unifi-protect","unifi-protect-cameras"],"created_at":"2025-03-21T14:50:44.988Z","updated_at":"2026-06-29T11:31:27.028Z","avatar_url":"https://github.com/michaelbolanos.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Home Assistant Automation: Door Sensor Alarm Control\n\n## Overview\nThis automation manages an alarm system based on the status of the rear door sensor and a bypass button. It ensures that the alarm triggers when the rear door is opened unless the bypass mode is active.\n\nThis system was created to **monitor individuals who may be at risk of unknowingly exiting a door**. It provides an additional layer of security without modifying an existing home or commercial alarm system. This alarm can be used **at any time** for a **specific door**, avoiding the need to tamper with an overall security system.\n\n## Hardware Components Used\n- **Shelly Button 1** – Used to toggle the alarm bypass mode.\n- **Shelly 1 Plus Relay (Status Light)** – Controls the status indicator.\n- **Shelly 1 Plus Relay (12V Siren)** – Controls the siren activation.\n- **12V DC Power Adapter** – Powers the combined siren and flashing red light.\n- **Aqara Door Sensor** – Detects when the rear door is opened or closed.\n- **SMLIGHT SLZB-06M Zigbee Coordinator** – Manages Zigbee-based devices, including the Aqara door sensor.\n- **UniFi Cameras** – Integrated with Home Assistant to provide real-time monitoring of the rear door.\n\n## Home Automation Setup \u0026 Raspberry Pi Performance\n\u0001\n- **Performance Considerations:** The Raspberry Pi 4 has more memory and processing power than previous models, making it well-suited for running Home Assistant, HACS (Home Assistant Community Store), and multiple integrations efficiently.\n- **Device Networking:** All applicable devices have static IP addresses.\n- **Backup Considerations:** Backups are crucial due to the risk of SD card corruption. A high-quality SanDisk SD card is used.\n- **Heat Management:** The Raspberry Pi 4 tends to get hot, which may require additional cooling solutions.\n- **Display Connectivity:** Raspberry Pi 4 requires a **Micro HDMI to HDMI cable** to connect to an external display. If using a **VGA monitor**, an additional **HDMI-to-VGA adapter** is needed.\n- **Home Assistant Core:** Manages all automations and integrations.\n- **Integrations Used:**\n  - **Shelly Integration** – Manages Shelly Button 1 and relays.\n  - **ZHA (Zigbee Home Automation)** – Handles the Aqara door sensor via the SMLIGHT SLZB-06M Zigbee Coordinator.\n  - **UniFi Integration** – Provides real-time camera feeds, including monitoring of the rear door and status light.\n\n## Dashboard \u0026 Battery Monitoring\n- A **custom Lovelace dashboard** is set up in Home Assistant to:\n  - Display the status of the **rear door sensor**.\n  - Show the **status light** in real time.\n  - Stream the **UniFi camera feed** for immediate visual confirmation of door activity.\n\n## Automation Details\n\n### Battery Monitoring \u0026 Replacement Guidelines\n- The Aqara Door Sensor uses a battery, and its battery level is monitored in Home Assistant.\n- The battery status has been added to the Lovelace dashboard to ensure timely replacement and prevent unexpected failures.\n- Batteries should be replaced when they reach **60% or below** to maintain optimal performance and prevent device disconnections.\n- **Alias:** 11 - Door Sensor\n- **Description:** Controls alarm based on rear door status and bypass button.\n\n## Triggers\n1. **Button Pressed**\n   - Triggered when the Shelly Button 1 is pressed.\n2. **Door Opened**\n   - Triggered when `binary_sensor.rear_door_sensor_opening` is `on` for 2 seconds.\n3. **Door Closed**\n   - Triggered when `binary_sensor.rear_door_sensor_opening` is `off` for 2 seconds.\n\n## Actions\n### Button Press Handling\n- If the alarm bypass is **off**, pressing the button will:\n  - Turn **on** the `input_boolean.alarm_bypass`.\n  - Turn **on** the alarm switch.\n- If the alarm bypass is **on**, pressing the button will:\n  - Turn **off** the `input_boolean.alarm_bypass`.\n  - Turn **off** the alarm switch.\n\n### Door Open Handling\n- If the alarm bypass is **off**, opening the rear door will turn **on** the alarm switch, activating the siren and flashing red light.\n\n### Door Close Handling\n- Closing the rear door will:\n  - Turn **off** the alarm switch.\n  - Ensure the alarm system is fully deactivated.\n\n## Mode\n- The automation runs in **restart** mode, meaning it will restart if triggered again while running.\n\n## Variables\n- `bypass_active`: Tracks whether the bypass mode is active.\n\n## Notes\n- The automation ensures the alarm only triggers when the door is opened and the bypass is inactive.\n- The bypass button allows temporary disabling of the alarm system.\n- The alarm system resets when the door is closed.\n- The status light provides a visual indication of the alarm system state.\n- This alarm is designed to work alongside an existing home or commercial security system **without requiring modifications**, providing additional protection for a specific door when needed.\n\n## Problems \u0026 Considerations\n### 1. **Sonoff Button Issues**\n- The **Sonoff Zigbee button** did not work reliably and was replaced with the **Shelly 1 WiFi button**, which is also **hard-wired**.\n\n### 2. **Zigbee Device Stability**\n- **Aqara door sensor** sometimes disconnects; considering **Konnected Alarm Panel** for hard-wired integration:  \n  [Konnected Alarm Panel - Wired Alarm System Conversion Kit](https://konnected.io/products/konnected-alarm-panel-wired-alarm-system-conversion-kit)\n\n### 3. **System Reboot for Stability**\n- Rebooting the system periodically enhances overall stability. Restarting Home Assistant and the Zigbee Coordinator helps refresh connections and ensures smooth operation.\n\n## Home Assistant YAML Configuration, Customization \u0026 Community Contributions\nThis automation is configured in Home Assistant's YAML file under Automations and can be managed via the UI.\n\n### Custom YAML Code \u0026 Entity ID Changes\nWe modified our YAML configuration to ensure flexibility and ease of maintenance. The entity IDs were carefully renamed for better readability and consistency. Some key changes include:\n- Renaming `binary_sensor.rear_door_sensor_opening` to a more intuitive ID.\n- Ensuring that `input_boolean.alarm_bypass` aligns with other related automations.\n- Optimizing the conditions to make the system more efficient and reduce unnecessary triggers.\n\n### Improvements and Features\n- **Hard-wired Shelly 1 WiFi Button**: Instead of relying on battery-powered Zigbee devices, we switched to a hard-wired Shelly button for more reliable operation.\n- **Zigbee Stability Improvement**: Best practices like rebooting the Zigbee Coordinator first before HA to improve system reliability.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelbolanos%2Fhome-assistant-door-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelbolanos%2Fhome-assistant-door-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelbolanos%2Fhome-assistant-door-sensor/lists"}