index.ts
1.82 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
import { EnrichmentCategoryComponentEnum } from '../../../enum/category';
import { useCreateNodeKey } from '../../../hook/useCreateNodeKey';
import type { NodeItemConfigType } from '../../../types/node';
import { RuleNodeTypeEnum } from '../../index.type';
const keys = useCreateNodeKey(EnrichmentCategoryComponentEnum.CALCULATE_DELTA);
export interface CalculateDeltaDataType {
someConfiguration?: Recordable;
}
export const CalculateDeltaConfig: NodeItemConfigType = {
...keys,
clazz: 'org.thingsboard.rule.engine.metadata.CalculateDeltaNode',
categoryType: RuleNodeTypeEnum.ENRICHMENT,
name: 'calculate delta',
configurationDescriptor: {
nodeDefinition: {
details:
"Calculates delta and period based on the previous time-series reading and current data. Delta calculation is done in scope of the message originator, e.g. device, asset or customer. If there is input key, the output relation will be 'Success' unless delta is negative and corresponding configuration parameter is set. If there is no input value key in the incoming message, the output relation will be 'Other'.",
description:
"Calculates and adds 'delta' value into message based on the incoming and previous value",
inEnabled: true,
outEnabled: true,
relationTypes: ['Success', 'Failure', 'Other'],
customRelations: false,
ruleChainNode: false,
defaultConfiguration: {
inputValueKey: 'pulseCounter',
outputValueKey: 'delta',
useCache: true,
addPeriodBetweenMsgs: false,
periodValueKey: 'periodInMs',
round: null,
tellFailureIfDeltaIsNegative: true,
},
uiResources: ['static/rulenode/rulenode-core-config.js'],
configDirective: 'tbEnrichmentNodeCalculateDeltaConfig',
icon: '',
iconUrl: '',
docUrl: '',
},
},
};