New: the AI firewall watches every module and explains each incident in plain words. See how it works

Alarm, command and notify blocks

Reference of Raise alarm, Clear alarm, Acknowledge alarm, Send command, Answer device request and Notify, including who a notification reaches on which channel.

These blocks act on people and devices: they open and close alarms, send commands, answer a device’s own requests and send notifications. The alarm and command blocks need a message whose originator is a device; Notify works on any message.

Raise alarm

Opens an alarm on the message’s device, or updates the open one of the same type: one open alarm per device and type.

SettingMeaningDefaultValues
alarmThe alarm typerequireda template, e.g. tank.{{ msg.metadata.topic }}.low; letters, digits, _ . : -, at most 128 after rendering
severitySeveritywarningcritical, major, minor, warning, info
textTitlethe typea template, at most 256 characters
valueKept in the alarm’s detailsmsg.payloada path
notify_toWho is toldnobodyuser ids, e-mail addresses, the roles OWNER, ADMIN, USER
notify_channelsChannelseach person’s choicechannel ids such as inapp, mail
notify_min_severityTell only from this severityinfoa severity
notify_repeat_secRemind while open and not acknowledgedno reminder0, or 60 seconds and more

out: the alarm (msgType alarm, the alarm in msg.payload). Errors: not_a_device, bad_alarm_id. Notifications follow the same lifecycle as alarm rules: throttling, a digest in an alarm storm, critical alarms bypass personal preferences unless your organisation turned that off. An escalation notifies again; a re-raise at the same severity does not. A late message changes no alarm. See Alarm notifications in depth.

Clear alarm

Resolves the open alarm of a type on the message’s device.

SettingMeaningValues
alarmThe alarm typerequired, a template

out: the cleared alarm, or the message unchanged when none was open. Whoever was told about the alarm is told it was resolved.

Acknowledge alarm

Acknowledges the device’s open alarms: they stay open, reminders stop.

SettingMeaningDefaultValues
alarmWhich alarmsevery open alarm*, a type, or a prefix ending in *
min_severityOnly from this severityinfoa severity
noteA note on each alarm’s timelinenoneat most 256 characters

All three alarm blocks produce alarms exactly like alarm rules do. An alarm change they make is heard by Device message triggers listening to alarm; a flow that raises an alarm and also listens to alarms may start itself again, and the deploy warns “May start its own flow again”. See Working with alarms.

Send command

Sends a command from the device profile’s command list to the message’s device. Nothing waits: the message goes on with the request it made; the device’s answer arrives later.

SettingMeaningDefaultValues
commandA command of the profile’s command listrequired (or a raw method)picked from your profiles’ commands
paramsThe command’s parametersnonean object such as {"on": true}, or a path such as msg.payload
methodA raw method outside the command listemptynamespace.verb, at most 64 characters

out: the message with msg.metadata.rpcId (the request, also on the device’s Commands tab) and msg.metadata.rpcStatus (QUEUED, or FAILED when the command could not wait and the device was offline). Errors (no request was made):

CodeMeaning
not_a_device, device_not_foundNot one of your devices
unknown_commandThe device’s profile has no such command
bad_paramsThe parameters do not match the command (msg.error.param names one)
method_refusedA factory reset, pairing or forgetting the network is never sent from the cloud
limitToo many commands to this device in the last minute (default 30 from flows)
device_not_active, rpc_not_supported_by_profile, payload_too_largeAs the console would say
  • The command is looked up in the profile of each message’s device: a flow serving several profiles sends only to those whose profile has the command.
  • The request is made as the flow and appears in the device’s command history like one from the console. A high-impact command needs no confirmation when it runs: it was confirmed at deploy.
  • Deploying needs the send permission of the command’s level in every profile that has it, Deploy flows with control-level nodes for a high-impact command, and the raw-RPC permission for a raw method.
  • A replayed or redelivered message finds the request it already made and sends nothing again. A late message sends no command.
  • Each request ends with one rpc_response message (SUCCESSFUL, FAILED, TIMEOUT, EXPIRED, CANCELLED) with msg.metadata.rpcStatus, rpcId and requestedBy. It is a device message, so it reaches the device’s root flow; route it from there.

Commands to devices behind a gateway are in development. See Sending commands to devices.

Answer device request

Answers a request the device sent to the platform (an rpc_request message: the device calls a method on the cloud). The built-in methods getCurrentTime and getSessionLimits are answered before a flow sees anything.

SettingMeaningDefaultValues
resultWhat the method returnsmsg.payloadany value; sent as {"ok": true, "result": …}
errorRefuse insteadnoneunsupported_method, bad_params, busy, timeout, expired, forbidden, payload_too_large, internal; sent as {"ok": false, "error": …}
messageText sent with a refusalemptyat most 256 characters, templates allowed

The first answer wins. When no flow answers within 5 seconds, the platform answers unsupported_method. Errors: rpc_request_closed, not_an_rpc_request, payload_too_large, invalid_value. An MQTT device gets the answer on v1/rpc/up/res/{id}, an HTTP device on its waiting request. Put this block on the rpc_request branch of the root flow (the default root only logs these requests).

Notify

Sends a notification and passes the message on.

SettingMeaningDefaultValues
RecipientsRows of a Kind and a valuerequiredat most 20 rows; 20 recipients after expansion
Repeat reasonWhat makes two notifications “the same” for the cooldownthe words of the notificationtemplate, 200 characters
ChannelsRestrict to these channelseach recipient’s preferenceschannel ids such as inapp, mail, sms, push
Urgencycritical skips personal preferences unless your organisation turned that offnormalnormal, critical
Title, TextThe messagetemplates, 200 and 4,000 characters
Text formattext, or html for mailtexttext, html
Mail subject, Reply toMail optionsthe title, nonetemplates
Copy, Hidden copyMore mail recipients; each gets their own mailnonetemplates
Mail attachmentsFiles for the mailnone10 files, 1 MiB together

Who is reached, on which channel

KindValueReaches
userA member’s user idThat member, in the app, by push and in linked chat apps
roleOWNER, ADMIN or USEREvery active member with that role, as above
custom_roleA custom role keyIts members, as above
teamA team idIts members, as above
originator_ownerEmptyThe owners of the message’s originator, where a module declares them, as above
addressOne or more e-mail addresses, comma-separatedE-mail
phoneOne or more numbers in international form, comma-separatedSMS

Members are passed by their user id only. E-mail and SMS reach only the address and phone rows. A member listed as a user, or reached through a role, custom role or team, gets the notification in the app, by push and in linked chat apps according to their preferences, but not by e-mail or SMS, even when they have an e-mail address. To mail people, add their addresses in an address row.

A role or team with more than 20 active members is refused (too_many_recipients) rather than half-told.

Cooldown, quotas and late messages

  • A person gets a notification of the same reason from the same flow once per 10 minutes (your plan may set another, at least 1 minute). Set Repeat reason when the text changes with every reading, for example level of {{ msg.metadata.deviceName }}. The next notification after the cooldown ends with “(+n)”.
  • Before sending, the block checks the monthly mail and SMS quotas; a channel out of quota is left out (msg.metadata.notify.quota). Only when every channel is out does it fail with limit.
  • A late message notifies nobody.

out carries msg.metadata.notify: recipients, delivered, failed, suppressed, invalid, quota, held. Errors: no_recipients, too_many_recipients, members_unavailable, invalid_attachment, notify_failed, node_not_ready, circuit_open, limit.

See Notifications from rules and flows for templates, HTML mail and attachments.