==== Message Templates ==== {{indexmenu_n>745}} Message templates controls the content of messages sent as Alarms/Restores or periodic exports. A template can include static text as well as dynamic data using the 'tags' defined below. Every //destination type// (email, SMS etc..) comes with a default message template. For example, the default template for emails looks like this: [ACTIONMESSAGE] Message generated [ISODATE] [ISOTIME] The default template for SMS messages looks like this: [ACTIONMESSAGE] @ [ISOTIME] Because SMS messages are typically limited in size, the default template contains less text and no additional line breaks. When an alarm is generated, and the action is to send a message, the system will fetch the "Message" of the alarm action, and insert this in place of the [ACTIONMESSAGE] tag in the default template. Any tags in the Action Message are also substituted. For example, the alarm's action message may look like this: It is [FV] [FU] now! When this is sent as an email using the default template, the result will be something like: It is 25.6 °C now! Message generated 2022-12-31 15:00:02 The templates for each destination can be changed directly under Destination List settings. ==== Message Templates Tags ==== The following tags are available in message templates: ^ Tag ^ Purpose ^ Example ^ | ''[MESSAGEID]'' | A unique message id | //ABC123-2-14-7474// | | ''[ZULUTIME]'' | Zulu/UTC time when message was triggered | //2019-12-31T23:59:52Z// | | ''[ISODATE]'' | Date when message was triggered, in controller time zone, ISO format | //2019-12-31// | | ''[USDATE]'' | Date when message was triggered, in controller time zone, US format | //12/31/19// | | ''[ISOTIME]'' | Time when message was triggered, in controller time zone, ISO format | //23:59:59// | | ''[USTIME]'' | Time when message was triggered, in controller time zone, US format | //11:59:59 PM// | | ''[UNIXTIME]'' | Time when message was triggered, UTC, as seconds since 1970-01-01 | //1676675802// | | ''[UNIXTIMEMS]'' | Time when message was triggered, UTC, as milliseconds since 1970-01-01 | //1676675802000// | | ''[WEEKDAY]'' | Weekday when message was triggered, in controller time zone | //Mon// .. //Sun// | | ''[MONTH]'' | Month when message was triggered, in controller time zone | //Jan// .. //Dec// | | ''[DAY]'' | Day when message was triggered, in controller time zone | //31// | | ''[EZEID]'' | ezeio serial number | //ABC-987// | | ''[EZENAME]'' | ezeio name | From Configure->System->Name | | ''[EZENAME#]'' | ezeio partial name, #=1-5 | From Configure->System->Name, split by comma, semicolon or pipe | | ''[EZENOTE]'' | ezeio note | From Configure->System->Note | | ''[EZENOTE#]'' | ezeio note line, #=1-5 | From Configure->System->Note, split by line | | ''[TYPE]'' | Message type | //ALARM, REALARM, RESTORE, INFO, EXPORT// | | ''[SOURCE]'' | Message source | //SEND, LOG, SCRIPT// | | ''[GROUPNAME]'' | Name of the group where the ezeio is assigned | From Group Settings->Group Name | | ''[GROUPNAME#]'' | Partial name of the group, #=1-5 | From Group Settings->Group Name, split by comma, semicolon or pipe | | ''[SOURCENAME]'' | Name of the source alarm | From Configure->Alarms->Name | | ''[SOURCENAME#]'' | Partial name of the source alarm, #=1-5 | From Configure->Alarms->Name, split by comma, semicolon or pipe | | ''[ACTIONNAME]'' | Name of the action source action | From Configure->Alarms->Alarm action->Name | | ''[ACTIONNAME#]'' | Partial name of the action source action, #=1-5 | From Configure->Alarms->Alarm action->Name, split by comma, semicolon or pipe | | ''[GPS]'' | GPS coordinates (if available) | //Lat:38.671447, Lng-121.152385:, Ele:105.2// | | ''[GPSLINK]'' | GPS coordinates Google maps link | https://maps.google.com/maps?q=... | | ''[GPSSIGNAL]'' | Signal quality of the GPS receiver | //14// | | ''[RSSI]'' | Cellular signal RSSI | //0// (no signal) .. //31// (full signal) | | ''[P#]'' | Message (#=1-4) parameters as integers (see script command "Event") | | | ''[PD#]'' | Message (#=1-4) parameters as floats (see script command "Event") | | | ''[FV#]'' | Field value, #=1-90 formatted | //318.2// | | ''[FR#]'' | Field value, #=1-90 unformatted | //318.2// | | ''[FU#]'' | Field unit, #=1-90 | //psi// | | ''[FN#]'' | Field name, #=1-90 | //Pressure// | | ''[FT#]'' | Field asset tag (first only), #=1-90 | //PRESSURE// | | ''[F#]'' | Field status, #=1-90, as "Field name: Value Unit", same as [FN#]: [FV#] [FU#] | //Pressure: 318.2 psi// | | '''' | Can be used in place of the Field number, Example: [FV] | | '''' | Works with FV and FR. Returns the sum of all field values with the given AssetTag, Example: [FV] | //172.2// | | '''' | Works with FV and FR. Returns the highest value of all field values with the given AssetTag, Example: [FV] | //45.6// | | '''' | Works with FV and FR. Returns the lowest value of all field values with the given AssetTag, Example: [FV] | //38.2// | | '''' | Works with FV and FR. Returns the mean (average) value of all field values with the given AssetTag, Example: [FV] | //43.02// | | '''' | Works with FV and FR. Returns the binary OR value of all field values with the given AssetTag, Example: [FV] | //47// | | '''' | Works with FV and FR. Returns all field values with the given AssetTag separated by comma, Example: [FV] | //38.2, 44.1, 44.3, 45.6// | | ''[TEXT]'' | Event text (see script command "Event") | | | ''[ACTIONMESSAGE]'' | The message/template from the action (typically used in the destination list) | | | ''[RECIPIENT]'' | The name of the destination (recipient) for this message (from Destination->Name) | | | ''[DESTINATION]'' | The address of the destination (from Destination->Address) | | | ''[DESTINATIONTOKEN]'' | The token of the destination (from Destination->Token) | | | ''[DVC#COMMSTAT]'' | Device communication status, #=1-40 | //n/a, ERROR, WARNING, WARNING2, WARNING3, OK, OK2, OK3// | | ''[DVC#OPSTAT]'' | Device operational status, #=1-40 | //n/a, ERROR, WARNING, OK// | | ''[DVC#APPSTAT]'' | Device application status, #=1-40 | //n/a, ERROR, WARNING, OK, OK2, OK3, OK4, OK5// | | ''[DVC#STATUS]'' | Device overall status, #=1-40 | //OK// or if there's an issue //COMM:ERROR// | | ''[DVCSTATUS]'' | List all devices overall status | //#1 Pressure sensor: OK// \\ //#2 Energy meter: OP WARNING// \\ #3 //Geiger counter: APP ERROR// | | ''[DVCWARNINGS]'' | List all device warnings and errors (if any) | //#2 Energy meter: OP WARNING// \\ //#3 Geiger counter: APP ERROR// | | ''[DVCERRORS]'' | List all device errors (if any) | //#3 Geiger counter: APP ERROR// | === Template automation === It is also possible to create simple loops to search for field asset tags using the special ''[FORTAG tag delimiter]...[FORTAG]'' syntax. This is best explained with an example of template code: Fieldname,Value,Unit [FORTAG MYTAG \n][FN],[FV],[FU][FORTAG] The [FORTAG MYTAG \n] construct will iterate over all fields, selecting those that match the asset tag "MYTAG". For each matched field, Field name (''[FN]''), Field value (''[FV]'') and Field unit (''[FU]'') is added, followed by the delimiter ''\n'' (new line). Note that no field number is necessary for the Fx-tags, as the field number is automatic from the tag-search loop. The output of the above will be in CSV format, thus something like this: Fieldname,Value,Unit Temperature,53.2,C Pressure,12.1,psi Within a FORTAG loop, the following tags are valid: | ''[FV]'' | Field value formatted | //318.2// | | ''[FR]'' | Field value unformatted | //318.2// | | ''[FU]'' | Field unit | //psi// | | ''[FN]'' | Field name | //Pressure// | | ''[FT]'' | Field asset tag (first only) | //PRESSURE// | | ''[F]'' | Field status, as "Field name: Value Unit", shorthand for [FN]: [FV] [FU] |