Skip to content

Rules Config

Rules allow the device to execute a list of actions when a defined event occurs. Each rule type contains an al array of alert/rule objects, each with a list of actions to perform when the condition becomes active and, optionally, when it clears.

Key path: devcfg.rules

{
"devcfg": {
"rules": {
"onButton": {
"al": [],
},
"onNet": {
"al": [],
},
"onOverLimit": {
"al": [],
},
"onUnderLimit": {
"al": [],
},
"onEquals": {
"al": [],
},
"onIdSeen": {
"al": [],
},
"onIdMissing": {
"al": [],
},
},
},
}

All actions in a rule are the same as those documented in App Actions. Additionally, in rule context, updateLocal, updateRemote, and updateOutput use a colon‑separated path format (see below).

Triggers actions on physical button events.

Configuration variables

  • al (Required, array of objects): Each object defines:
  • id (string): label for logging.
  • button (integer): button ID.
  • is (string): event – press, release, click, dblclick, or longpress.
  • do (array of actions): actions to run when the event occurs.
{
"devcfg": {
"rules": {
"onButton": {
"al": [
{
"id": "dstart",
"button": 3,
"is": "release",
"do": [
{
"a": "show",
"p": "app.home.duress_flag",
},
],
},
],
},
},
},
}

Triggers actions when a network changes state.

Configuration variables

  • al (array of objects): Each object defines:
  • id (string): label.
  • net (string): network configuration name.
  • is (string): state – active, inactive, connected, disconnected, connecting, failed.
  • do (array of actions): actions to run.
{
"devcfg": {
"rules": {
"onNet": {
"al": [
{
"id": "wifi_lost",
"net": "k1",
"is": "disconnected",
"do": [
{
"a": "msg",
"p": "WiFi lost",
},
],
},
],
},
},
},
}

Triggers when a device data value exceeds a limit.

Configuration variables

  • al (array of objects): Each object defines:
  • id (string): label.
  • dname (string): device data path (e.g., "power.gauge").
  • limit (number): threshold.
  • active (array of actions): run when value goes above limit.
  • clear (array of actions): run when value falls back below limit.
{
"devcfg": {
"rules": {
"onOverLimit": {
"al": [
{
"id": "high_temp",
"dname": "temp.degC",
"limit": 35,
"active": [
{
"a": "beep",
"p": "AT1",
},
],
"clear": [],
},
],
},
},
},
}

Like onOverLimit, but triggers when the value drops below the limit. Same structure.

Triggers when a device data value equals a specific string or number. Uses "equals" instead of "limit".

Triggers when a BLE or WiFi ID is detected.

Configuration variables

  • al (array of objects): Each object defines:
  • id (string): label.
  • type (string): majmin, bmac, ssid, or apmac.
  • onSeeing (array of strings): list of IDs to watch for.
  • active (array of actions): run when seen.
  • clear (array of actions): run when no longer seen.

Like onIdSeen, but triggers when the ID is absent. Uses "onMissing" instead of "onSeeing".

The actions updateLocal, updateRemote, and updateOutput use a path:value format in the p parameter (no widget associated).

{ "a": "updateOutput", "p": "devcfg.uiperi.show:true" }
{ "a": "updateLocal", "p": "app.mydv.mywidget:1" }
{ "a": "updateRemote", "p": "app.mydv.mywidget" }