Skip to content

Scan Automations

Scott Gusler edited this page Feb 13, 2026 · 1 revision

Scan Automations Service

Overview

The Scan Automations service helps you discover which of your Home Assistant automations use time or date-based triggers and conditions. This is useful for:

  • Understanding which automations might benefit from Clockwork calculations
  • Identifying automations that rely on time-based logic
  • Planning migration of existing automation logic to Clockwork entities

How to Use

Via Configuration Menu

  1. Go to Settings > Devices & Services
  2. Find Clockwork in the integrations list
  3. Click Configure
  4. Select Scan Automations for Time Patterns
  5. The scan results will display immediately, showing:
    • Number of automations detected
    • Automation names
    • Detected time/date patterns (e.g., time triggers, conditions)

Via Service Call

You can also call the service directly from Developer Tools:

  1. Go to Developer Tools > Services
  2. Search for and select clockwork.scan_automations
  3. Click Call Service
  4. Results will appear in the notification area showing JSON with all detected automations

What Patterns Are Detected?

The scanner looks for:

  • at: triggers - Time-specific triggers
  • platform: time triggers - Recurring time triggers
  • Time conditions - before, after, weekday conditions
  • time() functions - now() and utcnow() function usage
  • Time fields - Hour, minute, second conditions or triggers
  • Date functions - Functions that manipulate dates/times

Example Results

When you run the scan, you might see results like:

Found 3 automations with time/date patterns:

• **Evening Lights**: at, platform: time
• **Workday Check**: before, after
• **Sunset Trigger**: platform: sun

Using Results with Clockwork

Once you identify automations with time/date patterns, you can:

  1. Create corresponding Clockwork calculations for the same logic
  2. Replace the time/date conditions with Clockwork sensors
  3. Simplify your automation conditions by using the calculated entities

Example: Garage Door Open Too Long Alert

Once you identify an automation that monitors your garage door, you can use a Clockwork Offset Calculation to handle delayed triggering:

Traditional Approach:

---
automation:
  - alias: "Garage Door Alert"
    trigger:
      platform: state
      entity_id: binary_sensor.garage_door
      to: "on"
    action:
      - delay: "00:30:00"  # Wait 30 minutes
      - condition: state
        entity_id: binary_sensor.garage_door
        state: "on"  # Still open?
      - service: notify.send_alert
        data:
          message: "Garage door has been open for 30 minutes"

With Clockwork:

  1. Create an Offset Calculation:

    • Name: "Garage Door Open 30min"
    • Entity: binary_sensor.garage_door
    • Time Offset: "30 minutes"
    • Behavior Mode: "pulse" (or "duration" to keep alert active)
    • Trigger Event: "on"
  2. Simplify your automation:

automation:
  - alias: "Garage Door Alert"
    trigger:
      platform: state
      entity_id: binary_sensor.garage_door_open_30min
      to: "on"
    action:
      service: notify.send_alert
      data:
        message: "Garage door has been open for 30 minutes"

Key Benefits:

  • The offset calculation survives Home Assistant restarts - the 30-minute timer continues accurately even after a restart
  • Your automation trigger is simple: just when the binary sensor activates after the offset time has elapsed
  • Clockwork handles all the timing logic automatically with "latch", "pulse", or "duration" modes
  • No delays or extra conditions cluttering your automation logic
  • Easy to adjust the delay time without modifying automation logic

Technical Details

Service Name

clockwork.scan_automations

Response Format

The service returns JSON with the following structure:

{
  "automations": [
    {
      "id": "automation_id_123",
      "alias": "Automation Name",
      "patterns": ["pattern1", "pattern2"]
    }
  ]
}

Where Results Appear

  • Config Flow: Results display in the UI form
  • Service Call: Results logged to Settings > Logs
  • Actions Page: Results shown in the notification panel

Next: Get started with Clockwork →

Clone this wiki locally