# Procedures

# Procedures

A multi-step profile you run with one click, such as a heat soak, a fire profile
or a mission. Every ordered step is a `step`. A step that groups steps is a
procedure. If aborted, it returns to its declared safe state.

```python
step("heat_soak",
    step("heat", set(ch["/demo/heater_on"], True),  hold("60s")),
    step("cool", set(ch["/demo/heater_on"], False), wait("30s")),
    safe=safe({"/demo/heater_on": False}),
)
```

| | |
|---|---|
| **`safe`** | `safe({...})` sets values to restore if it stops partway. `safe()` drives every declared output to its own safe value |
| steps | ordered actions inside each step: `set`, then `hold` or `wait`. Durations are strings like `"60s"` or `"250ms"` |

Put it on a **Run** button on the [live page](https://phloem.ai/docs/trellis/page/) with
`start(step="heat_soak")`. The event log shows each step. The run records its
outcome: completed, aborted or tripped.

> **Note:** A procedure step is the only place a trellis can command a **peer**
> device. See [Peers](https://phloem.ai/docs/trellis/peers/).
