@flecoufle/node-red-linky 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/Examples.json +183 -0
- package/linky/linky.html +2 -2
- package/linky/linky.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
[{
|
|
2
|
+
"id": "367182d9cecf647a",
|
|
3
|
+
"type": "inject",
|
|
4
|
+
"z": "cd10dd842a97a44c",
|
|
5
|
+
"name": "daily_consumption",
|
|
6
|
+
"props": [{
|
|
7
|
+
"p": "payload"
|
|
8
|
+
}],
|
|
9
|
+
"repeat": "86400",
|
|
10
|
+
"crontab": "",
|
|
11
|
+
"once": false,
|
|
12
|
+
"onceDelay": 0.1,
|
|
13
|
+
"topic": "",
|
|
14
|
+
"payload": "{\"type\":\"daily_consumption\",\"start\":\"\",\"end\":\"\"}",
|
|
15
|
+
"payloadType": "json",
|
|
16
|
+
"x": 140,
|
|
17
|
+
"y": 40,
|
|
18
|
+
"wires": [
|
|
19
|
+
["7769e3ca14319a80"]
|
|
20
|
+
]
|
|
21
|
+
}, {
|
|
22
|
+
"id": "ab4116184bd72d25",
|
|
23
|
+
"type": "inject",
|
|
24
|
+
"z": "cd10dd842a97a44c",
|
|
25
|
+
"name": "consumption_load_curve",
|
|
26
|
+
"props": [{
|
|
27
|
+
"p": "payload"
|
|
28
|
+
}],
|
|
29
|
+
"repeat": "86400",
|
|
30
|
+
"crontab": "",
|
|
31
|
+
"once": false,
|
|
32
|
+
"onceDelay": 0.1,
|
|
33
|
+
"topic": "",
|
|
34
|
+
"payload": "{\"type\":\"consumption_load_curve\",\"start\":\"\",\"end\":\"\"}",
|
|
35
|
+
"payloadType": "json",
|
|
36
|
+
"x": 160,
|
|
37
|
+
"y": 80,
|
|
38
|
+
"wires": [
|
|
39
|
+
["7769e3ca14319a80"]
|
|
40
|
+
]
|
|
41
|
+
}, {
|
|
42
|
+
"id": "5a15b8c4c5d6e307",
|
|
43
|
+
"type": "linky-api",
|
|
44
|
+
"z": "cd10dd842a97a44c",
|
|
45
|
+
"name": "",
|
|
46
|
+
"prm": "",
|
|
47
|
+
"token": "",
|
|
48
|
+
"x": 550,
|
|
49
|
+
"y": 100,
|
|
50
|
+
"wires": [
|
|
51
|
+
["ccc3a7921bb1af33"]
|
|
52
|
+
]
|
|
53
|
+
}, {
|
|
54
|
+
"id": "7769e3ca14319a80",
|
|
55
|
+
"type": "function",
|
|
56
|
+
"z": "cd10dd842a97a44c",
|
|
57
|
+
"name": "day before",
|
|
58
|
+
"func": "var date = new Date();\n// today\nconst end = date.toISOString().substring(0, 10);\n// yesterday\ndate.setDate(date.getDate() - 1);\nconst start = date.toISOString().substring(0, 10);\nvar _p = msg.payload;\n_p.start = start;\n_p.end = end;\nreturn { \"payload\" : _p};",
|
|
59
|
+
"outputs": 1,
|
|
60
|
+
"noerr": 0,
|
|
61
|
+
"initialize": "",
|
|
62
|
+
"finalize": "",
|
|
63
|
+
"libs": [],
|
|
64
|
+
"x": 410,
|
|
65
|
+
"y": 100,
|
|
66
|
+
"wires": [
|
|
67
|
+
["5a15b8c4c5d6e307"]
|
|
68
|
+
]
|
|
69
|
+
}, {
|
|
70
|
+
"id": "6e10f26c3e172266",
|
|
71
|
+
"type": "debug",
|
|
72
|
+
"z": "cd10dd842a97a44c",
|
|
73
|
+
"name": "results",
|
|
74
|
+
"active": true,
|
|
75
|
+
"tosidebar": true,
|
|
76
|
+
"console": false,
|
|
77
|
+
"tostatus": false,
|
|
78
|
+
"complete": "payload",
|
|
79
|
+
"targetType": "msg",
|
|
80
|
+
"statusVal": "",
|
|
81
|
+
"statusType": "auto",
|
|
82
|
+
"x": 730,
|
|
83
|
+
"y": 160,
|
|
84
|
+
"wires": []
|
|
85
|
+
}, {
|
|
86
|
+
"id": "ccc3a7921bb1af33",
|
|
87
|
+
"type": "change",
|
|
88
|
+
"z": "cd10dd842a97a44c",
|
|
89
|
+
"name": "",
|
|
90
|
+
"rules": [{
|
|
91
|
+
"t": "set",
|
|
92
|
+
"p": "payload",
|
|
93
|
+
"pt": "msg",
|
|
94
|
+
"to": "payload.interval_reading",
|
|
95
|
+
"tot": "msg"
|
|
96
|
+
}],
|
|
97
|
+
"action": "",
|
|
98
|
+
"property": "",
|
|
99
|
+
"from": "",
|
|
100
|
+
"to": "",
|
|
101
|
+
"reg": false,
|
|
102
|
+
"x": 700,
|
|
103
|
+
"y": 100,
|
|
104
|
+
"wires": [
|
|
105
|
+
["49a7987a56abd63c"]
|
|
106
|
+
]
|
|
107
|
+
}, {
|
|
108
|
+
"id": "49a7987a56abd63c",
|
|
109
|
+
"type": "split",
|
|
110
|
+
"z": "cd10dd842a97a44c",
|
|
111
|
+
"name": "",
|
|
112
|
+
"splt": "\\n",
|
|
113
|
+
"spltType": "str",
|
|
114
|
+
"arraySplt": 1,
|
|
115
|
+
"arraySpltType": "len",
|
|
116
|
+
"stream": false,
|
|
117
|
+
"addname": "",
|
|
118
|
+
"x": 610,
|
|
119
|
+
"y": 160,
|
|
120
|
+
"wires": [
|
|
121
|
+
["6e10f26c3e172266"]
|
|
122
|
+
]
|
|
123
|
+
}, {
|
|
124
|
+
"id": "c688ce4b945b7b32",
|
|
125
|
+
"type": "inject",
|
|
126
|
+
"z": "cd10dd842a97a44c",
|
|
127
|
+
"name": "consumption_max_power",
|
|
128
|
+
"props": [{
|
|
129
|
+
"p": "payload"
|
|
130
|
+
}],
|
|
131
|
+
"repeat": "86400",
|
|
132
|
+
"crontab": "",
|
|
133
|
+
"once": false,
|
|
134
|
+
"onceDelay": 0.1,
|
|
135
|
+
"topic": "",
|
|
136
|
+
"payload": "{\"type\":\"consumption_max_power\",\"start\":\"\",\"end\":\"\"}",
|
|
137
|
+
"payloadType": "json",
|
|
138
|
+
"x": 160,
|
|
139
|
+
"y": 120,
|
|
140
|
+
"wires": [
|
|
141
|
+
["7769e3ca14319a80"]
|
|
142
|
+
]
|
|
143
|
+
}, {
|
|
144
|
+
"id": "f4a2f5074f259628",
|
|
145
|
+
"type": "inject",
|
|
146
|
+
"z": "cd10dd842a97a44c",
|
|
147
|
+
"name": "daily_production",
|
|
148
|
+
"props": [{
|
|
149
|
+
"p": "payload"
|
|
150
|
+
}],
|
|
151
|
+
"repeat": "86400",
|
|
152
|
+
"crontab": "",
|
|
153
|
+
"once": false,
|
|
154
|
+
"onceDelay": 0.1,
|
|
155
|
+
"topic": "",
|
|
156
|
+
"payload": "{\"type\":\"daily_production\",\"start\":\"\",\"end\":\"\"}",
|
|
157
|
+
"payloadType": "json",
|
|
158
|
+
"x": 130,
|
|
159
|
+
"y": 180,
|
|
160
|
+
"wires": [
|
|
161
|
+
["7769e3ca14319a80"]
|
|
162
|
+
]
|
|
163
|
+
}, {
|
|
164
|
+
"id": "bf71579a77b94f59",
|
|
165
|
+
"type": "inject",
|
|
166
|
+
"z": "cd10dd842a97a44c",
|
|
167
|
+
"name": "production_load_curve",
|
|
168
|
+
"props": [{
|
|
169
|
+
"p": "payload"
|
|
170
|
+
}],
|
|
171
|
+
"repeat": "86400",
|
|
172
|
+
"crontab": "",
|
|
173
|
+
"once": false,
|
|
174
|
+
"onceDelay": 0.1,
|
|
175
|
+
"topic": "",
|
|
176
|
+
"payload": "{\"type\":\"production_load_curve\",\"start\":\"\",\"end\":\"\"}",
|
|
177
|
+
"payloadType": "json",
|
|
178
|
+
"x": 150,
|
|
179
|
+
"y": 220,
|
|
180
|
+
"wires": [
|
|
181
|
+
["7769e3ca14319a80"]
|
|
182
|
+
]
|
|
183
|
+
}]
|
package/linky/linky.html
CHANGED
|
@@ -99,8 +99,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
99
99
|
<p>
|
|
100
100
|
All parameters:<br/>
|
|
101
101
|
<pre><code>"type": see <code>available types</code> below
|
|
102
|
-
"token": token set in payload or in node
|
|
103
|
-
"prm": PRM set in payload or in node
|
|
102
|
+
"token": token set in payload or in node property
|
|
103
|
+
"prm": PRM set in payload or in node property
|
|
104
104
|
"start": start date in RFC 3339 format ("YYYY-MM-DD")
|
|
105
105
|
"end": end date in RFC 3339 format ("YYYY-MM-DD")
|
|
106
106
|
"options_retry_limit": got option in ms(default 2)
|
package/linky/linky.js
CHANGED
|
@@ -120,13 +120,13 @@ module.exports = function (RED) {
|
|
|
120
120
|
if (err instanceof got.HTTPError) {
|
|
121
121
|
node.warn(request);
|
|
122
122
|
if (err.response.statusCode == '400') {
|
|
123
|
-
node.error('Bad request: Check token and PRM');
|
|
123
|
+
node.error('Bad request: Check token and PRM or dates format');
|
|
124
124
|
} else if (err.response.statusCode == '401') {
|
|
125
125
|
node.error('Unauthorized: Check token and PRM');
|
|
126
126
|
} else if (err.response.statusCode == '403') {
|
|
127
127
|
node.error('Forbidden: Check token and PRM');
|
|
128
128
|
} else if (err.response.statusCode == '404') {
|
|
129
|
-
node.error('Not found: Check token and PRM');
|
|
129
|
+
node.error('Not found: Check token and PRM or dates values');
|
|
130
130
|
}
|
|
131
131
|
} else if (err instanceof got.TimeoutError) {
|
|
132
132
|
node.warn('TimeoutError: adjust payload.options_timeout_*');
|