Filter expressions
A filter decides which incoming messages a rule matches. It looks at the content of what arrived: its text, source, level, link, and so on. A rule with no filter matches everything from its app and channel.
Filters are about content. To pause or fire rules based on the phone's state (time, Wi-Fi, battery), use conditions instead.
Building a filter
The filter builder in the rule editor is a tree of groups and filters.
- Each group is either All (every item in it must match) or Any (at least one must match). Tap the toggle at the top of a group to switch.
- The add row at the bottom of each group has a button for each available field, a Group button to nest another group, and, for some rules, level buttons.
- Groups can nest as deep as you need, and every group has a TRUE/FALSE switch. FALSE reverses the whole group.
- Drag the handle to reorder filters and groups within their group.
Each filter row reads as a sentence: the field, a comparison, and a value, for example Message contains disk full. Tap any part of the row to open the filter editor, which has a Comparison dropdown and a Value. To change a filter's field, delete it with ✕ and add a different one.
Copy and Paste below the tree copy a whole filter between rules of the same kind (Alert and Nudge rules share one clipboard, Notify and Silence rules another).
Comparisons
All comparisons ignore upper and lower case.
| Comparison | Matches when |
|---|---|
| contains / does not contain | The field includes the value anywhere |
| equals / does not equal | The field is exactly the value |
| starts with / does not start with | The field begins with the value |
| exists / does not exist | The named field is present on the item (Field filters only; no value needed) |
| is / is not | The ping is the one picked from the list (Ping filters only) |
Fields
| Field | Contains |
|---|---|
| Message | The main text. For a notification from another app, its title and text together. For a feed item, its title and content. |
| Header | The title: a notification's title or a feed item's title. For server messages this is the message text which is the same as the Message field. |
| Detail | The body: a notification's expanded text, or a feed item's content. Empty for server messages. |
| Source | The source label of a server message or feed item |
| Link | A feed item's link, followed by any other links in its content, separated by spaces |
| Field | Named values some feeds attach to items (see below) |
| Ping | The code of a ping from a server or feed (see below) |
| Nudged by | The name of the Notify rule that sent a self-nudge |
| Request | Matches only requests from a server asking for your approval |
Level isn't a field you type. Instead, the level buttons (Debug, Info, Important, Warning, Error) add a filter for that level, with a TRUE/FALSE switch.
Which fields each rule gets
| Rule | Fields |
|---|---|
| Notify or Silence | Message, Header, Detail, Source, Field, Link, plus level buttons |
| Alert with no channel, or for another app | Message, Header, Detail, Source, Field, Link |
| Alert for a LemmeKnow channel | Ping, Message, Header, Detail, Source, Field, Link |
| Nudge | Ping, Source, Message |
| Self-Nudge mode (Alert or Nudge) | Nudged by, Message, Header, Detail, Source, Field, Link, plus level buttons |
Request is added for LemmeKnow rules (other than Nudge) scoped to Any Server or to a specific server. Approvals are covered in Approvals.
If you change a rule's channel or mode so that some of its filters don't apply, saving asks you to remove them: Remove fields not valid for this rule type.
The Field filter
Some feeds, such as feeds from a LemmeSee hub, attach named values to each item, like status or size. A Field filter has a Name as well as a value:
- equals with Name
statusand Valueokmatches an item whosestatusvalue isok. - exists with Name
statusmatches any item that has astatusvalue at all. - contains and starts with compare against the item's named values written as
name:value.
Pings
Servers and feeds can send pings, short coded events that Nudge and Alert rules respond to. A server's own pings need labels from a LemmeSee hub: LemmeKnow acts only on codes the hub has labelled. When you add a Ping filter on a rule scoped to a server, the value becomes a list of that server's pings by name, such as [disk-high], and the comparison is is or is not. If the hub later changes its labels and a saved ping doesn't match any of them, the rule shows a warning. See Pings for sending pings and ping_messages for the hub's labels.
LemmeKnow also sends built-in pings of its own. Their codes are zero or negative, and every such code is reserved for them: the app ignores a server's pings with a code of zero or less.
| Code | Name | Sent when |
|---|---|---|
| 0 | Server online | A server comes back after being offline |
| -1 | Server offline | A server stops sending heartbeats |
| -2 | Server offline (sustained) | A server stays offline for the minutes set in its settings |
| -3 | Server degraded (sustained) | A server stays in a warning state for the minutes set in its settings |
| -4 | State entered alarm | One of the hub's states goes into alarm |
| -5 | Action requested | A hub sends a request for your approval |
| -6 | Feed options | A feed item arrives with buttons you can press |
For rules scoped to a feed, the list offers Action requested and Feed options.
Tokens in filter values
A filter value, and a Field filter's name, can include tokens such as {{item.source}} or {{now.weekday}}. They're filled in each time a message is checked, before comparing. Secrets can't be used in filters.
Script mode
Notify rules with Premium can use Script mode instead of the builder: a JavaScript snippet that sets result to true when the rule should match. See Rule modes in Notification rules.