|  Both sides previous revision Previous revision Next revision |  Previous revision | 
| ezeio2:userinterface:manage:messagetemplates [2021-09-24 21:56]  – ↷ Page moved from ezeio2:mange:messagetemplates to ezeio2:userinterface:manage:messagetemplates andreh | ezeio2:userinterface:manage:messagetemplates [2025-06-30 22:27] (current)  – [Message Templates Tags]  andreh | 
|---|
| ==== Message Templates Tags ==== | ==== Message Templates ==== | 
| {{indexmenu_n>745}} | {{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: | 
|   | <code> | 
|   | [ACTIONMESSAGE] | 
|   | Message generated [ISODATE] [ISOTIME] | 
|   | </code> | 
|   |  | 
|   | The default template for SMS messages looks like this: | 
|   | <code> | 
|   | [ACTIONMESSAGE] @ [ISOTIME] | 
|   | </code> | 
|   |  | 
|   | 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: | 
|   | <code> | 
|   | It is [FV<TEMPERATURE>] [FU<TEMPERATURE>] now! | 
|   | </code> | 
|   |  | 
|   | When this is sent as an email using the default template, the result will be something like: | 
|   | <code> | 
|   | It is 25.6 °C now! | 
|   | Message generated 2022-12-31 15:00:02 | 
|   | </code> | 
|   |  | 
|   | The templates for each destination can be changed directly under Destination List settings. | 
|   |  | 
|   | ==== Message Templates Tags ==== | 
 |  | 
| The following tags are available in message templates: | The following tags are available in message templates: | 
| | ''[ISOTIME]'' | Time when message was triggered, in controller time zone, ISO format | //23:59:59// | | | ''[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// | | | ''[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// | | | ''[WEEKDAY]'' | Weekday when message was triggered, in controller time zone | //Mon// .. //Sun// | | 
| | ''[MONTH]'' | Month when message was triggered, in controller time zone | //Jan// .. //Dec// | | | ''[MONTH]'' | Month when message was triggered, in controller time zone | //Jan// .. //Dec// | | 
| | ''[EZEID]'' | ezeio serial number | //ABC-987// | | | ''[EZEID]'' | ezeio serial number | //ABC-987// | | 
| | ''[EZENAME]'' | ezeio name | From Configure->System->Name | | | ''[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 | From Configure->System->Note | | 
| | ''[TYPE]'' | Message type | //ALARM, REALARM, RESTORE, INFO// | | | ''[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// | | | ''[SOURCE]'' | Message source | //SEND, LOG, SCRIPT// | | 
| | ''[GROUPNAME]'' | Name of the group where the ezeio is assigned | From Group Settings->Group Name | | | ''[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]'' | 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]'' | 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// | | | ''[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=... | | | ''[GPSLINK]'' | GPS coordinates Google maps link | https://maps.google.com/maps?q=... | | 
| | ''[GPSSIGNAL]'' | Signal quality of the GPS receiver | //14// | | | ''[GPSSIGNAL]'' | Signal quality of the GPS receiver | //14// | | 
| | ''[RSSI]'' | Cellular signal RSSI | //0// (no signal) .. //31// (full signal) | | | ''[RSSI]'' | Cellular signal RSSI | //0// (no signal) .. //31// (full signal) | | 
| | ''[P#]'' | Message (#=1-4) parameters (see script command "Event") | | | | ''[CSV]'' | Attach a CSV file with all field statuses (applies only to email destinations) |  |  | 
|   | | ''[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// | | | ''[FV#]'' | Field value, #=1-90 formatted | //318.2// | | 
| | ''[FR#]'' | Field value, #=1-90 unformatted | //318.2// | | | ''[FR#]'' | Field value, #=1-90 unformatted | //318.2// | | 
| | ''[FU#]'' | Field unit, #=1-90 | //psi// | | | ''[FU#]'' | Field unit, #=1-90 | //psi// | | 
| | ''[FN#]'' | Field name, #=1-90 | //Pressure// | | | ''[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// | | | ''[F#]'' | Field status, #=1-90, as "Field name: Value Unit", same as [FN#]: [FV#] [FU#] | //Pressure: 318.2 psi// | | 
|   | | ''[FL<//AssetTag//>]'' | Field list by asset tag. Lists all fields having the given asset tag, as "Field name: Value Unit" | //Pressure: 318.2 psi//, multiple lines | | 
| | ''<//AssetTag//>'' | Can be used in place of the Field number, Example: [FV<outsidetemp>] | | | ''<//AssetTag//>'' | Can be used in place of the Field number, Example: [FV<outsidetemp>] | | 
| | ''<//AssetTag//:SUM>'' | Works with FV and FR. Returns the sum of all field values with the given AssetTag, Example: [FV<outsidetemp:SUM>] | //172.2// | | | ''<//AssetTag//:SUM>'' | Works with FV and FR. Returns the sum of all field values with the given AssetTag, Example: [FV<outsidetemp:SUM>] | //172.2// | | 
| | ''[DESTINATION]'' | The address of the destination (from Destination->Address) | | | | ''[DESTINATION]'' | The address of the destination (from Destination->Address) | | | 
| | ''[DESTINATIONTOKEN]'' | The token of the destination (from Destination->Token) | | | | ''[DESTINATIONTOKEN]'' | The token of the destination (from Destination->Token) | | | 
|   | | ''[DVC#NAME]'' | Device name, #=1-40 | Name from Configure->Devices->Device->Name | | 
| | ''[DVC#COMMSTAT]'' | Device communication status, #=1-40 | //n/a, ERROR, WARNING, WARNING2, WARNING3, OK, OK2, OK3// | | | ''[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#OPSTAT]'' | Device operational status, #=1-40 | //n/a, ERROR, WARNING, OK// | | 
| | ''[DVCWARNINGS]'' | List all device warnings and errors (if any) | //#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// | | | ''[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: | 
|   |  | 
|   | <code> | 
|   | Fieldname,Value,Unit | 
|   | [FORTAG MYTAG \n][FN],[FV],[FU][FORTAG] | 
|   | </code> | 
|   |  | 
|   | 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: | 
|   |  | 
|   | <code> | 
|   | Fieldname,Value,Unit | 
|   | Temperature,53.2,C | 
|   | Pressure,12.1,psi | 
|   | </code> | 
|   |  | 
|   | 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] |  | 
|   |  |