| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Write single object | |||||||||||||||||||||||||
2 | 1. Install Node Bacnet-contrib-exteneded | |||||||||||||||||||||||||
3 | 2. create flow | |||||||||||||||||||||||||
4 | ||||||||||||||||||||||||||
5 | ||||||||||||||||||||||||||
6 | ||||||||||||||||||||||||||
7 | ||||||||||||||||||||||||||
8 | ||||||||||||||||||||||||||
9 | ||||||||||||||||||||||||||
10 | ||||||||||||||||||||||||||
11 | ||||||||||||||||||||||||||
12 | ||||||||||||||||||||||||||
13 | ||||||||||||||||||||||||||
14 | ||||||||||||||||||||||||||
15 | ||||||||||||||||||||||||||
16 | ||||||||||||||||||||||||||
17 | 3. Put the below in function block | |||||||||||||||||||||||||
18 | ||||||||||||||||||||||||||
19 | var value= msg.payload | |||||||||||||||||||||||||
20 | msg.deviceId = # ; | Replace # with the instance number of the bacnet device you want to write to | ||||||||||||||||||||||||
21 | msg.address = "#"; | Replace # with the IP Address of the Bacnet device | ||||||||||||||||||||||||
22 | msg.objectId = { type: #, instance: * }; | Replace # with object ID type number for tab below | Replace * object type instance number | (if you have 5 Binary Value objects they may be numbered 1-5 for example) | ||||||||||||||||||||||
23 | msg.propertyId = 85; | 85 is the property number for present value | ||||||||||||||||||||||||
24 | msg.values = [{ type: #, value: value }]; | Replace # with message value type number from tab below | ||||||||||||||||||||||||
25 | return msg; | |||||||||||||||||||||||||
26 | ||||||||||||||||||||||||||
27 | Read single Object | |||||||||||||||||||||||||
28 | ||||||||||||||||||||||||||
29 | 1. Create flow | |||||||||||||||||||||||||
30 | ||||||||||||||||||||||||||
31 | ||||||||||||||||||||||||||
32 | ||||||||||||||||||||||||||
33 | ||||||||||||||||||||||||||
34 | ||||||||||||||||||||||||||
35 | ||||||||||||||||||||||||||
36 | ||||||||||||||||||||||||||
37 | ||||||||||||||||||||||||||
38 | ||||||||||||||||||||||||||
39 | ||||||||||||||||||||||||||
40 | ||||||||||||||||||||||||||
41 | ||||||||||||||||||||||||||
42 | 2. Put the below in first function block | |||||||||||||||||||||||||
43 | ||||||||||||||||||||||||||
44 | msg.deviceId = #; | Replace # with the instance number of the bacnet device you want to read from | ||||||||||||||||||||||||
45 | msg.address = "#"; | Replace # with the IP Address of the Bacnet device | ||||||||||||||||||||||||
46 | msg.inputType = 5; | Replace # with object ID type number for tab below | ||||||||||||||||||||||||
47 | msg.bacnetID = 138; | Replace * object type instance number | (if you have 5 Binary Value objects they may be numbered 1-5 for example) | |||||||||||||||||||||||
48 | ||||||||||||||||||||||||||
49 | const bacnetProperties = [ | |||||||||||||||||||||||||
50 | { id: 77 }, // OBJECT_NAME | |||||||||||||||||||||||||
51 | { id: 79 }, // OBJECT_TYPE OR INPUT TYPE | |||||||||||||||||||||||||
52 | { id: 85 }, // PRESENT_VALUE | |||||||||||||||||||||||||
53 | ]; | |||||||||||||||||||||||||
54 | ||||||||||||||||||||||||||
55 | ||||||||||||||||||||||||||
56 | const requestArray = [ | |||||||||||||||||||||||||
57 | { objectId: { type: msg.inputType, instance: msg.bacnetID }, properties: bacnetProperties } | |||||||||||||||||||||||||
58 | ]; | |||||||||||||||||||||||||
59 | ||||||||||||||||||||||||||
60 | msg.requestArray = requestArray | |||||||||||||||||||||||||
61 | ||||||||||||||||||||||||||
62 | return msg; | |||||||||||||||||||||||||
63 | ||||||||||||||||||||||||||
64 | 3. Copy the below in to the "data transformation" function block (no changes needed) | |||||||||||||||||||||||||
65 | ||||||||||||||||||||||||||
66 | var object = msg.payload; | |||||||||||||||||||||||||
67 | ||||||||||||||||||||||||||
68 | var myArray = {}; | |||||||||||||||||||||||||
69 | ||||||||||||||||||||||||||
70 | myArray["BacnetID"] = msg.bacnetID; | |||||||||||||||||||||||||
71 | myArray["InputType"] = msg.inputType; | |||||||||||||||||||||||||
72 | ||||||||||||||||||||||||||
73 | ||||||||||||||||||||||||||
74 | for(var j = 0; j < object.values[0].values.length; j++){ | |||||||||||||||||||||||||
75 | ||||||||||||||||||||||||||
76 | ||||||||||||||||||||||||||
77 | ||||||||||||||||||||||||||
78 | var k1 = object.values[0].values[j].id.toString(); | |||||||||||||||||||||||||
79 | ||||||||||||||||||||||||||
80 | //str = str + k1 + " ----- "; | |||||||||||||||||||||||||
81 | ||||||||||||||||||||||||||
82 | var v1 = object.values[0].values[j].value[0].value; | |||||||||||||||||||||||||
83 | ||||||||||||||||||||||||||
84 | var k1str = ConvertPropertyIdWithString(k1); | |||||||||||||||||||||||||
85 | ||||||||||||||||||||||||||
86 | myArray[k1str] = v1; | |||||||||||||||||||||||||
87 | ||||||||||||||||||||||||||
88 | } | |||||||||||||||||||||||||
89 | ||||||||||||||||||||||||||
90 | ||||||||||||||||||||||||||
91 | //msg.payload = str; | |||||||||||||||||||||||||
92 | ||||||||||||||||||||||||||
93 | msg.payload = myArray; | |||||||||||||||||||||||||
94 | ||||||||||||||||||||||||||
95 | return msg; | |||||||||||||||||||||||||
96 | ||||||||||||||||||||||||||
97 | ||||||||||||||||||||||||||
98 | ||||||||||||||||||||||||||
99 | function ConvertPropertyIdWithString(id){ | |||||||||||||||||||||||||
100 |