action.ts
15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
export default {
title: 'Action',
description: 'Perform special actions',
assignToCustomer: {
name: 'Assign to customer',
details:
"Finds target Customer by customer name pattern and then assign Originator Entity to this customer. Will create new Customer if it doesn't exists and 'Create new Customer if not exists' is set to true.",
description: 'Assign Message Originator Entity to Customer',
fields: {
customerNamePattern: 'Customer name pattern',
createCustomerIfNotExists: 'Create new customer if not exists',
customerCacheExpiration: 'Customers cache expiration time(sec)',
},
},
clearAlarm: {
name: 'Clear alarm',
details:
"Details - JS function that creates JSON object based on incoming message. This object will be added into Alarm.details field.\nNode output:\nIf alarm was not cleared, original message is returned. Otherwise new Message returned with type 'ALARM', Alarm object in 'msg' property and 'metadata' will contains 'isClearedAlarm' property. Message payload can be accessed via <code>msg</code> property. For example <code>'temperature = ' + msg.temperature ;</code>. Message metadata can be accessed via <code>metadata</code> property. For example <code>'name = ' + metadata.customerName;</code>.",
description: 'Clear Alarm',
fields: {
alarmType: 'Alarm type',
alarmDetailsBuildJs: 'Alarm details builder',
alarmTypeButtonName: 'Test detail function',
},
},
copyToView: {
name: 'Copy to view',
details:
'Copy attributes from asset/device to related entity view according to entity view configuration. \n Copy will be done only for attributes that are between start and end dates and according to attribute keys configuration. \nChanges message originator to related entity view and produces new messages according to count of updated entity views',
description:
'Copy attributes from asset/device to entity view and changes message originator to related entity view',
},
createAlarm: {
name: 'Create alarm',
details:
"Details - JS function that creates JSON object based on incoming message. This object will be added into Alarm.details field.\nNode output:\nIf alarm was not created, original message is returned. Otherwise new Message returned with type 'ALARM', Alarm object in 'msg' property and 'metadata' will contains one of those properties 'isNewAlarm/isExistingAlarm'. Message payload can be accessed via <code>msg</code> property. For example <code>'temperature = ' + msg.temperature ;</code>. Message metadata can be accessed via <code>metadata</code> property. For example <code>'name = ' + metadata.customerName;</code>.",
description: 'Create or Update Alarm',
fields: {
alarmDetailsBuildJs: 'Alarm details builder',
useMessageAlarmData: 'Use message alarm data',
overwriteAlarmDetails: 'Overwrite alarm details',
alarmType: 'Alarm type',
severity: 'Alarm severity pattern',
propagate: 'Propagate alarm to related entities',
relationTypes: 'Relation types to propagate',
propagateToOwner: 'Propagate alarm to entity owner (Customer or Tenant)',
propagateToTenant: 'Propagate alarm to Tenant',
dynamicSeverity: 'Use alarm severity pattern',
scriptButtonName: 'Test detail function',
},
},
createRelation: {
name: 'Create relation',
details:
'If the relation already exists or successfully created - Message send via <b>Success</b> chain, otherwise <b>Failure</b> chain will be used.',
description:
"Finds target Entity by entity name pattern and (entity type pattern for Asset, Device) and then create a relation to Originator Entity by type and direction. If Selected entity type: Asset, Device or Customer will create new Entity if it doesn't exist and selected checkbox 'Create new entity if not exists'.<br> In case that relation from the message originator to the selected entity not exist and If selected checkbox 'Remove current relations', before creating the new relation all existed relations to message originator by type and direction will be removed.<br> If relation from the message originator to the selected entity created and If selected checkbox 'Change originator to related entity', outbound message will be processed as a message from this entity.",
fields: {
direction: 'Direction',
entityType: 'Type',
entityNamePattern: 'Name pattern',
entityTypePattern: 'Type pattern',
relationType: 'Relation type pattern',
createEntityIfNotExists: 'Create new entity if not exists',
removeCurrentRelations: 'Remove current relations',
changeOriginatorToRelatedEntity: 'Change originator to related entity',
entityCacheExpiration: 'Entities cache expiration time(sec)',
},
},
deleteRelation: {
name: 'Delete relation',
details:
'If the relation(s) successfully deleted - Message send via <b>Success</b> chain, otherwise <b>Failure</b> chain will be used.',
description:
"Finds target Entity by entity name pattern and then delete a relation to Originator Entity by type and direction if 'Delete single entity' is set to true, otherwise rule node will delete all relations to the originator of the message by type and direction.",
fields: {
deleteForSingleEntity: 'Delete relation to specific entity',
direction: 'Direction',
entityType: 'Type',
entityNamePattern: 'Name pattern',
relationType: 'Relation type pattern',
entityCacheExpiration: 'Entities cache expiration time(sec)',
},
},
delay: {
name: 'Delay (deprecated)',
details:
'Delays messages for a configurable period. Please note, this node acknowledges the message from the current queue (message will be removed from queue). Deprecated because the acknowledged message still stays in memory (to be delayed) and this does not guarantee that message will be processed even if the "retry failures and timeouts" processing strategy will be chosen.',
description: 'Delays incoming message (deprecated)',
},
deviceProfile: {
name: 'Device profile',
details:
"Create and clear alarms based on alarm rules defined in device profile. The output relation type is either 'Alarm Created', 'Alarm Updated', 'Alarm Severity Updated' and 'Alarm Cleared' or simply 'Success' if no alarms were affected.",
description: 'Process device messages based on device profile settings',
fields: {
persistAlarmRulesState: 'Persist state of alarm rules',
fetchAlarmRulesStateOnStart: 'Fetch state of alarm rules',
},
},
generator: {
name: 'Generator',
details:
'Generates messages with configurable period. Javascript function used for message generation.',
description: 'Periodically generates messages',
fields: {
msgCount: 'Message count(0 - unlimited)',
periodInSeconds: 'Period in seconds',
jsScript: 'Generate',
originatorType: 'Type',
jsScriptButtonName: 'Test generator function',
},
},
gpsGeofencingEvents: {
name: 'Gps geofencing events',
details:
'Extracts latitude and longitude parameters from incoming message and returns different events based on configuration parameters',
description: 'Produces incoming messages using GPS based geofencing',
fields: {
latitudeKeyName: 'Latitude key name',
longitudeKeyName: 'longitude key name',
perimeterType: 'Perimeter type',
fetchPerimeterInfoFromMessageMetadata: 'Fetch perimeter information from message metadata',
perimeterKeyName: 'Perimeter key name',
centerLatitude: 'Center Latitude',
centerLongitude: 'Center Longitude',
range: 'Range',
rangeUnit: 'Range units',
polygonsDefinition: 'Polygon definition',
minInsideDuration: 'Minimal inside duration',
minInsideDurationTimeUnit: 'Minimal inside duration time unit',
minOutsideDuration: 'Minimal outside duration',
minOutsideDurationTimeUnit: 'Minimal outside duration time unit',
},
},
log: {
name: 'Log',
details:
"Transform incoming Message with configured JS function to String and log final value into Thingsboard log file. Message payload can be accessed via <code>msg</code> property. For example <code>'temperature = ' + msg.temperature ;</code>. Message metadata can be accessed via <code>metadata</code> property. For example <code>'name = ' + metadata.customerName;</code>.",
description: 'Log incoming messages using JS script for transformation Message into String',
fields: {
jsScript: 'To string',
jsScriptButtonName: 'Test to string function',
},
},
messageCount: {
name: 'Message count',
details:
'Count incoming messages for specified interval and produces POST_TELEMETRY_REQUEST msg with messages count',
description: 'Count incoming messages',
fields: {
interval: 'Interval in seconds',
telemetryPrefix: 'Output timeseries key prefix',
},
},
pushToEdge: {
name: 'Push to edge',
details:
"Push messages from cloud to edge. Message originator must be assigned to particular edge or message originator is <b>EDGE</b> entity itself. This node used only on cloud instances to push messages from cloud to edge. Once message arrived into this node it’s going to be converted into edge event and saved to the database. Node doesn't push messages directly to edge, but stores event(s) in the edge queue. <br>Supports next originator types:<br><code>DEVICE</code><br><code>ASSET</code><br><code>ENTITY_VIEW</code><br><code>DASHBOARD</code><br><code>TENANT</code><br><code>CUSTOMER</code><br><code>EDGE</code><br><br>As well node supports next message types:<br><code>POST_TELEMETRY_REQUEST</code><br><code>POST_ATTRIBUTES_REQUEST</code><br><code>ATTRIBUTES_UPDATED</code><br><code>ATTRIBUTES_DELETED</code><br><code>ALARM</code><br><br>Message will be routed via <b>Failure</b> route if node was not able to save edge event to database or unsupported originator type/message type arrived. In case successful storage edge event to database message will be routed via <b>Success</b> route.",
description: 'Push messages from cloud to edge',
fields: {
scope: 'Device Attribute Range',
},
},
rpcCallReply: {
name: 'Rpc call reply',
details: 'Expects messages with any message type. Will forward message body to the device.',
description: 'Sends reply to RPC call from device',
fields: {
requestIdMetaDataAttribute: 'Request Id Metadata attribute name',
},
},
rpcCallRequest: {
name: 'Rpc call request',
details:
'Expects messages with "method" and "params". Will forward response from device to next nodes.If the RPC call request is originated by REST API call from user, will forward the response to user immediately.',
description: 'Sends RPC call to device',
fields: {
timeoutInSeconds: 'Timeout in seconds',
},
},
saveAttributes: {
name: 'Save attributes',
details:
"Saves entity attributes based on configurable scope parameter. Expects messages with 'POST_ATTRIBUTES_REQUEST' message type",
description: 'Saves attributes data',
fields: {
notifyDevice: 'Notify Device',
scope: 'Device Attribute Range',
},
},
saveEvent: {
name: 'Save event',
details: "Saves entity event . Expects messages with 'POST_EVENT_REQUEST' message type",
description: 'Saves device event data',
fields: {
configuration: 'configuration',
configurationDesc:
"Define the configuration instructions' tkMsgEventNodeConfiguration is unavailable.",
},
},
saveTimeseries: {
name: 'Save timeseries',
details:
"Saves timeseries telemetry data based on configurable TTL parameter. Expects messages with 'POST_TELEMETRY_REQUEST' message type. Timestamp in milliseconds will be taken from metadata.ts, otherwise 'now' message timestamp will be applied. Allows stopping updating values for incoming keys in the latest ts_kv table if 'skipLatestPersistence' is set to true.\n <br/>Enable 'useServerTs' param to use the timestamp of the message processing instead of the timestamp from the message. Useful for all sorts of sequential processing if you merge messages from multiple sources (devices, assets, etc).\n<br/>In the case of sequential processing, the platform guarantees that the messages are processed in the order of their submission to the queue. However, the timestamp of the messages originated by multiple devices/servers may be unsynchronized long before they are pushed to the queue. The DB layer has certain optimizations to ignore the updates of the \"attributes\" and \"latest values\" tables if the new record has a timestamp that is older than the previous record. So, to make sure that all the messages will be processed correctly, one should enable this parameter for sequential message processing scenarios.",
description: 'Saves timeseries data',
fields: {
defaultTTL: 'Default TTL in seconds',
skipLatestPersistence: 'Skit latest persistence',
useServerTs: 'Use server ts',
useServerTsDesc:
'Enable this setting to use the timestamp of the message processing, rather than the timestamp in the message.',
},
},
saveToCustomTable: {
name: 'Save to custom table',
details:
'Administrator should set the custom table name without prefix: <b>cs_tb_</b>. <br>Administrator can configure the mapping between the Message field names and Table columns name.<br><b>Note:</b>If the mapping key is <b>$entity_id</b>, that is identified by the Message Originator, then to the appropriate column name(mapping value) will be write the message originator id.<br><br>If specified message field does not exist or is not a JSON Primitive, the outbound message will be routed via <b>failure</b> chain, otherwise, the message will be routed via <b>success</b> chain.',
description:
'Node stores data from incoming Message payload to the Cassandra database into the predefined custom table that should have <b>cs_tb_</b> prefix, to avoid the data insertion to the common TB tables.<br><b>Note:</b> rule node can be used only for Cassandra DB.',
fields: {
fieldsMapping: 'Fields mapping',
tableName: 'Custom table name',
filesMappingValidateMsg: 'At least one field mapping should be specified.',
messageField: 'Message field',
columnName: 'Table column name',
},
},
synchronizationEnd: {
name: 'Synchronization end',
details: '',
description: 'This Node is now deprecated. Use "Checkpoint" instead.',
},
synchronizationStart: {
name: 'Synchronization start',
details:
'This node should be used together with "synchronization end" node. \n This node will put messages into queue based on message originator id. \nSubsequent messages will not be processed until the previous message processing is completed or timeout event occurs.\nSize of the queue per originator and timeout values are configurable on a system level',
description: 'This Node is now deprecated. Use "Checkpoint" instead.',
},
delayDeprecated: {
fields: {
useMetadataPeriodInSecondsPatterns: 'Use period in seconds pattern',
periodInSeconds: 'Period in seconds',
periodInSecondsPattern: 'Period in seconds pattern',
maxPendingMsgs: 'Maximum pending messages',
useMetadataPeriodInSecondsPatternsDesc:
'If selected, the rule node uses the message metadata or the interval pattern in seconds in the data.',
},
},
unassignFromCustomer: {
name: 'Unassign from customer',
details:
'Finds target Entity Customer by Customer name pattern and then unassign Originator Entity from this customer.',
description: 'Unassign Message Originator Entity from Customer',
fields: {
customerNamePattern: 'Customer name pattern',
customerCacheExpiration: 'Customer cache expiration time(sec)',
},
},
};