-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCometSystem.json
More file actions
98 lines (98 loc) · 2.61 KB
/
CometSystem.json
File metadata and controls
98 lines (98 loc) · 2.61 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
[
{
"id": "f3905a28.4a0e2",
"type": "tab",
"label": "test papa"
},
{
"id": "d2a62efa.bf739",
"type": "xml",
"z": "f3905a28.4a0e2",
"name": "",
"attr": "",
"chr": "",
"x": 630,
"y": 120,
"wires": [
[
"823637fc.d90ac8"
]
]
},
{
"id": "55c10ecc.79828",
"type": "http request",
"z": "f3905a28.4a0e2",
"name": "",
"method": "GET",
"ret": "txt",
"url": "http://10.0.1.10/aaa.xml",
"tls": "",
"x": 270,
"y": 120,
"wires": [
[
"108d5001.e40c6"
]
]
},
{
"id": "acf61240.c99fe",
"type": "comment",
"z": "f3905a28.4a0e2",
"name": "test CometSystem",
"info": "",
"x": 160,
"y": 60,
"wires": []
},
{
"id": "f279df99.21da2",
"type": "inject",
"z": "f3905a28.4a0e2",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 100,
"y": 120,
"wires": [
[
"55c10ecc.79828"
]
]
},
{
"id": "823637fc.d90ac8",
"type": "function",
"z": "f3905a28.4a0e2",
"name": "Decode and HTTP post",
"func": "// Content Type for post form-data\nmsg.headers = {'content-type':'application/x-www-form-urlencoded'};\n\n// GET TIME\nconst date = new Date();\nconst timeStamp = date.getTime();\n\n// Parse XML to get infos\ngetInfo = msg.payload[\"soap:Envelope\"][\"soap:Body\"][0][\"InsertTx5xxCO2Sample\"][0];\n\nvar id = getInfo[\"passKey\"][0] ;\nvar temp = getInfo[\"temp\"][0];\nvar hum = getInfo[\"relHum\"][0];\nvar co2 = getInfo[\"co2\"][0];\n\nmsg.payload = \"__device=\"+id+\"&__time=\"+timeStamp;\nmsg.payload += \"&temp=\"+temp+\"&hum=\"+hum+\"&co2=\"+co2;\n\ndelete msg.statusCode;\ndelete msg.responseUrl;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 810,
"y": 120,
"wires": [
[]
]
},
{
"id": "108d5001.e40c6",
"type": "function",
"z": "f3905a28.4a0e2",
"name": "keep only XML",
"func": "var str = msg.payload\nmsg.payload = str.substring(str.indexOf(\"<?xml\"));\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 460,
"y": 120,
"wires": [
[
"d2a62efa.bf739"
]
]
}
]