# Automation Examples

# Automation Examples

**Create powerful automations with Everything Presence Lite in Home Assistant.**

## Prerequisites

* EPL added to Home Assistant and entities available (see [Home Assistant Entities](/doc/c4893273-871e-49a4-beaf-e12f5b01932f))
* At least one light or scene controllable in Home Assistant
* (Optional) Zones configured for zone-based automations

## Automation Basics

* **Trigger**: when something happens (e.g., Occupancy turns on)
* **Condition** (optional): only at certain times or if a device is off
* **Action**: what to do (e.g., turn on a light)


---

## Example 1: Turn on a light when room is occupied

The simplest automation—lights on when someone enters.


1. Go to **Settings → Automations & Scenes → Create Automation**
2. Click **Add Trigger** → **State**
3. Select your EPL **Occupancy** entity
4. Set **To**: `on`
5. (Optional) Add a **Condition** → **Sun** → **After sunset**
6. Click **Add Action** → **Device** → Select your light → **Turn on**
7. Save the automation


---

## Example 2: Turn off the light when room is clear


1. Create a new automation
2. **Trigger**: State → EPL Occupancy → **To**: `off` → **For**: 2 minutes
3. (Optional) **Condition**: State → Your light → is `on`
4. **Action**: Turn off the same light


:::tip
The EPL has an **Occupancy Off Delay** setting (default 15 seconds). Combined with the automation's "For" duration, this prevents false-offs when people are sitting still.

:::


---

## Example 3: Zone-based lighting

Trigger different lights based on which zone is occupied. This is where the EPL really shines!

**Automation A - Desk zone:**


1. **Trigger**: State → Zone 1 Occupancy → **To**: `on`
2. **Action**: Turn on desk lamp

**Automation B - Couch zone:**


1. **Trigger**: State → Zone 2 Occupancy → **To**: `on`
2. **Action**: Dim living room lights to 30%


:::tip
Set up zones first using the [Zone Configurator](/doc/5b75125c-e11e-4009-a366-59e9e9ff1a72) before creating zone-based automations.

:::


---

## Example 4: All zones clear = room empty

Only turn off lights when ALL zones are empty:


1. **Trigger**: State → EPL Occupancy → **To**: `off` → **For**: 1 minute
2. **Conditions** (all must be true):
   * State → Zone 1 Occupancy → is `off`
   * State → Zone 2 Occupancy → is `off`
3. **Action**: Turn off all room lights

This ensures lights stay on if someone moves between zones.


---

## Example 5: Entry notification

Get notified when someone enters a specific area (useful for doorways or security):


1. **Trigger**: State → Zone 1 Occupancy → **To**: `on` (configure Zone 1 as your entry area)
2. **Condition**: Time → After 11:00 PM, Before 6:00 AM
3. **Action**: Send notification to your phone


---

## Example 6: Target count-based actions

The EPL can count how many people are in a zone:

**Turn on extra lights when multiple people present:**


1. **Trigger**: Numeric state → Zone 1 Target Count → **Above**: 1
2. **Action**: Turn on additional lights

**Trigger alarm if too many people detected:**


1. **Trigger**: Numeric state → EPL Target Count → **Above**: 3
2. **Action**: Send alert notification


---

## Example 7: Distance-based dimming (Advanced)

Use target distance to control brightness:


1. **Trigger**: State → Target 1 Active → **To**: `on`
2. **Action**: Call service → `light.turn_on`
   * Target: Your light
   * Brightness: Template: `{{ 255 - (states('sensor.epl_target_1_distance') | float * 40) | int }}`

This dims the light as you move further from the sensor.


---

## Verify Your Automation

* Walk into the room/zone and watch the automation run
* Check **Settings → Automations → [Your Automation] → Traces** if it didn't fire
* Open the [Zone Configurator](/doc/5b75125c-e11e-4009-a366-59e9e9ff1a72) to see exactly where targets are detected

## Troubleshooting

| Symptom | Likely Cause | Fix |
|---------|--------------|-----|
| Automation never triggers | Wrong entity or state | Verify entity name in Developer Tools → States |
| Zone automation doesn't fire | Zone not enabled | Enable zone entities in device settings |
| Lights turn off too quickly | Off delay too short | Increase Occupancy Off Delay in EPL settings |
| Multiple zones trigger at once | Zones overlap | Adjust zone boundaries in Zone Configurator |


---

## Next Steps

* [Home Assistant Entities](/doc/c4893273-871e-49a4-beaf-e12f5b01932f) - All available sensors and controls
* [How to Create Zones](/doc/5b75125c-e11e-4009-a366-59e9e9ff1a72) - Set up detection zones
* [How to Tune Your EPL Sensor](/doc/515d8862-90dd-4d60-a5b9-af421e94cf22) - Optimize detection
* [Troubleshooting](/doc/b3d7072a-ad98-435e-a456-4ab814955ebd) - Common issues and solutions

---

**Documents**

- [EP1 vs EPL: Which Sensor is Right for You?](https://docs.everythingsmart.io/s/products/doc/ep1-vs-epl-which-sensor-is-right-for-you-5B3RxiY3Kp)
- [Everything Presence One (EP1)](https://docs.everythingsmart.io/s/products/doc/everything-presence-one-ep1-3R178yZSUP)
- [Everything Presence Pro](https://docs.everythingsmart.io/s/products/doc/everything-presence-pro-nh3fIXmow9)
- [Everything Presence Lite (EPL)](https://docs.everythingsmart.io/s/products/doc/everything-presence-lite-epl-ZVnBzYzuX2)
- [Zone Configurator](https://docs.everythingsmart.io/s/products/doc/zone-configurator-93b9scGsa2)
- [Knowledge Base Articles](https://docs.everythingsmart.io/s/products/doc/knowledge-base-articles-KnRRmk4zvt)