# Automations

An automation watches for something happening to a device and does something about it: it notifies
you, or it sets one of the device's controls. Qualithm runs it for you, so there is no server or
worker to host.

Each automation is built for one [device](https://docs.qualithm.com/devices.md) from a template. The app offers only the
templates that device's declared readings and controls support. See
[Declare capabilities](https://docs.qualithm.com/mqtt.md#declare-capabilities).

## Create an automation

You need the owner or manager role. Open **Automations** and choose **Create automation**, or choose
**Create automation** on a scope's **Automations** page or a dashboard reading.

1. Pick the **Device**.
2. Pick a **Template**:
   - **Notify on threshold**: tell you when a reading crosses a value. It checks each reading as it
     arrives and tells you once per crossing: readings that stay past the value send nothing more
     until one comes back.
   - **Control on threshold**: set a control when a reading crosses a value.
   - **Notify on disconnect**: tell you when the device drops off.
   - **Control on schedule**: set a control at set times.
   - **Control on external call**: set a control when another system calls a URL.
3. Fill in what the template asks for:
   - **When it runs**, for **Control on schedule**: every hour, day, week or month, at the time you
     choose. Times are in your time zone. The other templates run when what they watch happens.
   - **What to watch**: the reading, how it compares (rises above, falls below, equals, and so on)
     and the threshold.
   - **What to do**: notify by email or push to your browsers, or set a control to a value.
4. **Name** it, then choose **Create automation**.

Push to your browsers reaches only browsers you turned push on for in
[Notifications](https://docs.qualithm.com/notifications.md). Email arrives either way.

## Run and pause an automation

Open the automation to see its run history: each run's outcome, what started it and when.

- **Run now** runs it once, straight away.
- **Disable** pauses it. **Enable** starts it again.
- **Edit** changes its settings.

An automation started by an external call has a **Trigger secret**. Choose **Create trigger
secret**, copy the secret and address it shows once, and have the other system send a POST to that
address with the secret as a bearer token. A new secret replaces the current one straight away.

Runs count against your plan's automation runs each month. A run past the limit shows **Plan limit
reached**. See [Billing and usage](https://docs.qualithm.com/billing-and-usage.md).

## Delete an automation

Deleting an automation stops it running and removes its run history. Confirm once to delete. This
cannot be undone.

## See also

- [Devices](https://docs.qualithm.com/devices.md)
- [Dashboards](https://docs.qualithm.com/dashboards.md)
- [Activity](https://docs.qualithm.com/activity.md)
