
Smart Night Security with Z-Wave JS UI and Home Assistant
Home Assistant continues to be one of the best platforms for building advanced smart home automations without depending on cloud services. One area where Home Assistant truly shines is security and awareness around doors, locks, lighting, and notifications.
In this guide, we will build a practical automation using Z-Wave JS UI and a Z-Wave door lock. The automation will detect when the door is unlocked after 22:00, automatically turn on hallway lights, and send a push notification to your phone.
This type of automation is simple, but incredibly useful in daily life. It improves convenience, increases visibility at night, and gives you better awareness of activity around your home.
We will also look at a few additional examples that expand on the same concept.
Why Use Z-Wave for Door Locks?
Z-Wave is one of the most reliable wireless protocols for smart homes. Unlike many Wi‑Fi devices, Z-Wave creates a mesh network where powered devices relay messages between each other.
This makes Z-Wave particularly well suited for:
- Door locks
- Security sensors
- Motion detectors
- Smart lighting
- Energy monitoring
- Low-power battery devices
Door locks especially benefit from Z-Wave because:
- Communication is encrypted
- Battery life is usually excellent
- The mesh network improves reliability
- Local control works even without internet access
With Home Assistant and Z-Wave JS UI, you gain full local control of your smart lock and can create powerful automations.
What is Z-Wave JS UI?
Z-Wave JS UI is an advanced management interface for Z-Wave networks used together with Home Assistant.
It acts as the bridge between your Z-Wave controller and Home Assistant while also providing:
- Device management
- Network healing
- Debugging tools
- MQTT support
- OTA firmware updates
- Detailed device statistics
- Smart Start provisioning
Compared to the older Z-Wave integrations, Z-Wave JS UI gives significantly more visibility into how your Z-Wave network performs.
Many Home Assistant users run Z-Wave JS UI as a Home Assistant add-on.
Useful hardware for this setup includes:
- Aeotec Z-Stick
- Zooz 800 Series USB stick
- Home Assistant Connect ZBT-1
- Raspberry Pi or Home Assistant Green
Components Used in This Automation
This example uses the following entities:
| Component | Purpose |
|---|---|
| Z-Wave door lock | Detect unlock events |
| Hallway light | Automatically illuminate entry area |
| Mobile App integration | Send push notifications |
| Home Assistant automation | Coordinate actions |
| Z-Wave JS UI | Handle Z-Wave communication |
Example entities:
lock.front_door
light.hallway
notify.mobile_app_pixel_9
Your entity names will likely differ.
The Goal
The automation should:
- Detect when the front door becomes unlocked
- Check if the time is after 22:00
- Turn on the hallway lights
- Send a push notification
- Optionally switch the lights off again after a few minutes
This creates a much nicer nighttime experience.
Instead of entering a dark hallway, the lights automatically switch on. At the same time, you receive an immediate notification that the door was unlocked.
Example Automation
Below is a complete Home Assistant YAML automation example.
alias: Front Door Unlock Night Alert
mode: single
trigger:
- platform: state
entity_id: lock.front_door
to: "unlocked"
condition:
- condition: time
after: "22:00:00"
action:
- service: light.turn_on
target:
entity_id: light.hallway
data:
brightness_pct: 70
color_temp_kelvin: 3000
- service: notify.mobile_app_pixel_9
data:
title: "Front Door Unlocked"
message: "The front door was unlocked after 22:00."
- delay:
minutes: 5
- service: light.turn_off
target:
entity_id: light.hallway
How the Automation Works
Let us break down the automation step by step.
Trigger
trigger:
- platform: state
entity_id: lock.front_door
to: "unlocked"
The automation starts whenever the door lock changes state to unlocked.
This works with most Z-Wave locks supported by Home Assistant.
Condition
condition:
- condition: time
after: "22:00:00"
The condition ensures the automation only runs during nighttime.
You can adjust the time to match your routines.
Some users prefer using sun conditions instead:
condition:
- condition: sun
after: sunset
Both approaches work well.
Turn on the Lights
- service: light.turn_on
The hallway lights are turned on with:
- 70% brightness
- Warm white color temperature at 3000 K
Using a warm white temperature creates a softer nighttime atmosphere.
Send Push Notification
- service: notify.mobile_app_pixel_9
This sends a notification through the Home Assistant Companion App.
Example notification:
Front Door Unlocked
The front door was unlocked after 22:00.
This is useful for:
- Security awareness
- Family monitoring
- Knowing when guests arrive
- Detecting unexpected activity
Automatic Light Shutdown
- delay:
minutes: 5
After five minutes, the hallway lights switch off automatically.
This prevents lights from staying on all night.
Improving Reliability with Z-Wave Mesh Design
Door locks are often installed near exterior walls where signal quality can sometimes be weaker.
To improve reliability:
- Add powered Z-Wave devices near the lock
- Use smart plugs or wall switches as repeaters
- Avoid placing the controller inside metal cabinets
- Prefer newer 700 or 800 series Z-Wave controllers
A strong Z-Wave mesh makes a major difference for locks.
Battery-powered devices do not repeat signals, so focus on powered devices for network stability.
Example 2: Flash Outdoor Lights if Unlock Happens Late at Night
You can expand the same idea for additional security.
This automation flashes outdoor lights if the door unlocks between midnight and 05:00.
alias: Late Night Door Activity
mode: single
trigger:
- platform: state
entity_id: lock.front_door
to: "unlocked"
condition:
- condition: time
after: "00:00:00"
before: "05:00:00"
action:
- service: light.turn_on
target:
entity_id: light.outdoor
- delay:
seconds: 2
- service: light.turn_off
target:
entity_id: light.outdoor
- delay:
seconds: 2
- service: light.turn_on
target:
entity_id: light.outdoor
- service: notify.mobile_app_pixel_9
data:
title: "Late Night Door Activity"
message: "The front door was unlocked during nighttime hours."
This type of automation can help draw attention to unexpected activity.
Example 3: Automatically Disarm Alarm When Specific User Unlocks Door
Many Z-Wave locks support user codes.
Some locks expose which code unlocked the door, allowing advanced automations.
Example:
alias: Disarm Alarm for Family
trigger:
- platform: event
event_type: zwave_js_value_notification
event_data:
command_class_name: Notification
label: Access Control
condition:
- condition: template
value_template: >
{{ 'Keypad unlock operation' in trigger.event.data.value }}
action:
- service: alarm_control_panel.alarm_disarm
target:
entity_id: alarm_control_panel.house
This creates a seamless arrival experience.
The alarm automatically disarms when a trusted user unlocks the door.
Combining Motion Sensors and Locks
A very effective setup combines:
- Door locks
- Motion sensors
- Hallway lighting
- Cameras
- Push notifications
For example:
- Door unlocks
- Hallway light turns on
- Camera recording starts
- Notification snapshot sent to phone
- Heating adjusts automatically
This creates a much more intelligent home environment.
Energy Considerations
Smart automations can also reduce energy usage.
Instead of leaving lights on overnight, motion and lock-based automations ensure lighting is only active when needed.
In many homes, lighting automation can help reduce unnecessary electricity consumption measured in kWh throughout the year.
Using dimmed lighting during nighttime hours also reduces power usage while remaining comfortable.
LED hallway lighting at 70% brightness typically uses very little electricity.
Recommended Z-Wave Locks
Popular Z-Wave lock manufacturers include:
- Yale
- Danalock
- Nuki
- ID Lock
- Schlage
Before purchasing:
- Verify Home Assistant compatibility
- Check regional Z-Wave frequency support
- Confirm Z-Wave JS compatibility
- Prefer S2 security support
European users should ensure the device supports the correct EU Z-Wave frequency.
Security Best Practices
When using smart locks, always follow good security practices.
Recommendations:
- Use S2 secure inclusion when available
- Keep Home Assistant updated
- Update Z-Wave firmware regularly
- Use strong Home Assistant passwords
- Enable multi-factor authentication
- Limit remote access exposure
Local control with Home Assistant already provides a significant privacy advantage compared to cloud-only systems.
Final Thoughts
Automations around Z-Wave door locks are some of the most useful smart home features you can build.
With only a few lines of YAML, you can:
- Improve nighttime visibility
- Increase security awareness
- Reduce energy usage
- Create smoother arrival experiences
- Receive immediate notifications
Z-Wave JS UI combined with Home Assistant gives you a highly flexible platform that works entirely locally.
Even simple automations like turning on hallway lights after 22:00 can make a smart home feel significantly more polished and responsive.
Once you start combining locks, sensors, lighting, and notifications, the possibilities quickly expand.
Some of the links in this article are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.