> ## Documentation Index
> Fetch the complete documentation index at: https://docs.farmtrace.co.za/llms.txt
> Use this file to discover all available pages before exploring further.

# Settings and workflows

> Use device settings, rules, and workflows to turn hardware capabilities into repeatable work.

Device Kit can expose more than one-off commands. A profile can define settings for a device, rules that react to values or events, and workflows that coordinate several operations.

## Settings

Settings give a device a usable operating context. A setting can have a default and constraints that keep values inside the range the device supports. Settings may be used when an operation is invoked or when a rule evaluates a condition.

When a setting changes, verify the value on the device or in the next read that depends on it. A locally stored setting is not proof that the hardware accepted it.

## Rules

Rules evaluate conditions using available settings, telemetry, connection or change context, and application-provided values. A matching rule can:

* invoke a component operation;
* set a device setting;
* save a read result for a later record;
* show an informational, warning, or error alert;
* delay or sequence further actions; or
* start a named workflow.

## Workflows

Workflows are explicit multi-step sequences. Common steps include ensuring a connection, invoking an operation, polling for a result, writing a payload in chunks, and handling completion or failure.

The workflow proceeds in order unless a step explicitly declares concurrent work. Each step should have a clear success signal and a bounded failure path so a field user is not left guessing what happened.

<Warning>
  Treat device credentials, encryption secrets, and write operations as sensitive. Keep them in approved private configuration and test changes on known hardware before enabling them for field teams.
</Warning>

## A practical design pattern

<Steps>
  <Step title="Read the current state">
    Start with a safe read so the workflow has an observable baseline.
  </Step>

  <Step title="Apply the smallest change">
    Set one setting or invoke one operation with a known payload.
  </Step>

  <Step title="Poll or observe">
    Wait for the expected response, notification, or status transition.
  </Step>

  <Step title="Save or alert">
    Store a result when it is part of field work, or show a clear alert when the workflow cannot complete.
  </Step>
</Steps>
