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

# Automate content with weather-based smart rules

> Switch playlists automatically when the weather or temperature at a screen's location matches the conditions you define.

Smart rules let Piksel change what plays on a screen based on real-time weather data at that screen's location. When a rule's condition matches — for example, when it starts raining — Piksel switches the screen to a different playlist automatically. When the condition no longer matches, the screen returns to its previous content.

## How smart rules work

Piksel evaluates active smart rules on a schedule, approximately every five minutes. You can also trigger evaluation manually from the smart rules interface. During each evaluation, Piksel fetches current weather data for each screen that has coordinates set, checks all active rules for that screen in priority order, and applies the first rule whose condition matches.

When a rule is applied, it overrides both the schedule and the default playlist for that screen. When no rule matches, the screen falls back to its active schedule (if any), then to its default playlist.

**Resolution order:** Smart Rule → Schedule → Default playlist

<Warning>
  A screen must have **weather coordinates** (latitude and longitude) set in its settings for smart rules to evaluate. Without coordinates, Piksel cannot fetch weather data and rules will not trigger. See [Screens](/features/screens) to configure coordinates.
</Warning>

## Condition types

<Tabs>
  <Tab title="Weather">
    Match against the current weather condition at the screen's location. Set `condition_type` to `weather` and `condition_operator` to `equals`, then choose one of the supported condition values:

    | Value     | Description              |
    | --------- | ------------------------ |
    | `clear`   | Clear sky                |
    | `cloudy`  | Partly or fully overcast |
    | `fog`     | Foggy conditions         |
    | `drizzle` | Light drizzle            |
    | `rain`    | Rain                     |
    | `snow`    | Snow                     |
    | `storm`   | Thunderstorm             |

    **Example:** Show a hot-drinks promotion playlist whenever the condition is `rain`.
  </Tab>

  <Tab title="Temperature">
    Match against the current temperature (in Celsius) at the screen's location. Set `condition_type` to `temperature` and choose an operator:

    | Operator | Meaning                  |
    | -------- | ------------------------ |
    | `gt`     | Greater than             |
    | `lt`     | Less than                |
    | `gte`    | Greater than or equal to |
    | `lte`    | Less than or equal to    |

    Set `condition_value` to a numeric temperature in Celsius.

    **Example:** Show a cold-drinks promotion whenever the temperature is greater than (`gt`) `30`.
  </Tab>
</Tabs>

## Creating a smart rule

<Steps>
  <Step title="Open Smart Rules">
    Navigate to **Smart Rules** in the dashboard sidebar.
  </Step>

  <Step title="Click New rule">
    Select the screen the rule applies to and the playlist to switch to when the rule triggers.
  </Step>

  <Step title="Choose a condition type">
    Select **Weather** or **Temperature**.
  </Step>

  <Step title="Configure the condition">
    For weather rules, select the weather condition value (for example, `rain`).

    For temperature rules, select the operator and enter a numeric value in Celsius (for example, `gt` and `30`).
  </Step>

  <Step title="Set a priority">
    Enter a priority number. When multiple active rules match at the same time, the one with the highest priority takes effect. The default priority is `10`.
  </Step>

  <Step title="Save the rule">
    Click **Create**. The rule is active immediately and will be evaluated at the next weather check cycle.
  </Step>
</Steps>

## Priority between rules

If two or more active smart rules on the same screen match the current weather conditions simultaneously, Piksel applies the rule with the highest priority value. Lower-priority matching rules are ignored until the higher-priority rule clears.

## Enabling and disabling rules

Each smart rule has an **Active** toggle. Turn it off to pause a rule without deleting it. Inactive rules are not evaluated during weather checks.

## Manual evaluation

You can trigger an immediate evaluation of all your smart rules from the Smart Rules page without waiting for the next automatic cycle. This is useful for testing a new rule or confirming that a rule clears correctly when weather conditions change.

## How smart rules interact with schedules

Smart rules sit above schedules in the resolution order. When a smart rule is active on a screen, it takes over regardless of any matching schedule. When the rule condition clears, Piksel removes the override and the screen returns to evaluating its schedules normally, then falls back to the default playlist if no schedule matches.

<Tip>
  Use schedules for predictable, time-based programming and smart rules for reactive, condition-based overrides. Combining both gives you complete control over what plays when.
</Tip>
