# Alerts

# Alerts

Tell someone in Slack, Teams or email when a condition fires, without stopping the test.

```python
alarm(
    "too_hot",
    when=ch["/demo/temperature"].above(80),
    severity="warn",
    notify=["test-conductor"],
)
```

| | |
|---|---|
| **`when`** | what fires it: a comparison on a channel, `above(x)`, `below(x)`, `within(lo, hi)` or `outside(lo, hi)` |
| **`severity`** | `info`, `warn` or `critical`. Any other value is refused |
| **`notify`** | role names: lowercase letters, digits, `-` and `_`, such as `test-conductor` |

A role names *who* to tell, not *where*. On **Alerts** in the console, map each
role to one or more channels on a Slack, Microsoft Teams or Email (SMTP)
connector. Change who gets paged there, with no redeploy. **Recent deliveries**
on the same page shows each firing's outcome, including **no such role** when
`notify=` names a role that doesn't exist.

Each firing is saved as a mark on the channel, so you can find it in
[Replay](https://phloem.ai/docs/review/replay/). That is why `when` is a comparison, not a `lambda`: Phloem must
be able to find the mark again in recorded data.

An alert only notifies. To act on hardware, use an
[interlock](https://phloem.ai/docs/trellis/interlocks/). To stop the test, use a
[stop condition](https://phloem.ai/docs/trellis/checks/).

- [Get a Slack message when a limit is crossed](https://phloem.ai/docs/guides/alert-in-slack/): Set up a role and an alarm, step by step
- [Stop conditions](https://phloem.ai/docs/trellis/checks/): Stop the test instead of telling someone
