# Condition-Based Maintenance

Some maintenance should follow how hard a machine works, not the calendar. A machine that ran three shifts last week needs its spindle serviced sooner than one that ran one. A **Condition** template generates a work order each time an asset's **run hours** or one of its **counters** passes a threshold. Because Machine 1's run hours come from Kanoa Ops, nobody has to log them.

:::action[Create the condition template]

1. In **Configuration → Maintenance → Work Orders**, add a template:

   | Field | Value |
   |---|---|
   | Title | `Machine 1 - Spindle service` |
   | Asset | `CoreForge\Philadelphia\Machining\Machine 1` |
   | Maintenance type | Preventive |
   | Work type | `Spindle Service` |
   | Priority | Medium |
   | Schedule type | Condition |

2. In the **Condition** section, choose `Run Hours` every `1` hrs. A real spindle service would be hundreds of hours; one hour lets you see it work during training.
3. Set **Last serviced on** to now and **Last value** to `0`.
4. Save and release the template.

:::

:::action[Watch it trigger]

1. Make sure Machine 1 is running in Production, as in [Starting Production](../../4-training-ops/01-base-configuration/4-starting-production.md).
2. After an hour of run time, check **Maintenance → Work Orders** for a new `Machine 1 - Spindle service` work order.
3. Reopen the template. Kanoa records when it last generated a work order and the run-hour value at the time, and counts the next hour from there.

:::

Choose **Counter** instead of Run Hours to trigger on an asset counter, such as every 50,000 parts on Machine 1's outfeed.

:::note
Conditions are checked periodically by [checkWorkOrderConditions](../../../systemFunctions/cmms/checkWorkOrderConditions.md), so a work order can appear shortly after the threshold rather than exactly on it.
:::
