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 | {
"id": "4",
"name": "Email me if it's going to rain",
"nodes": [
{
"name": "Start",
"type": "WF²-nodes-base.start",
"position": [
360,
300
],
"parameters": {},
"typeVersion": 1
},
{
"name": "OpenWeatherMap",
"type": "WF²-nodes-base.openWeatherMap",
"position": [
530,
300
],
"parameters": {
"zipCode": "90210",
"operation": "5DayForecast",
"locationSelection": "zipCode"
},
"credentials": {
"openWeatherMapApi": "OpenWeatherMap API Key"
},
"typeVersion": 1
},
{
"name": "IF",
"type": "WF²-nodes-base.if",
"position": [
840,
300
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "=rain",
"operation": "contains"
},
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "snow",
"operation": "contains"
},
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "sleet",
"operation": "contains"
},
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "hail",
"operation": "contains"
},
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "storm",
"operation": "contains"
},
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "drizzle",
"operation": "contains"
},
{
"value1": "={{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}},{{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"value2": "downpour",
"operation": "contains"
}
]
},
"combineOperation": "any"
},
"typeVersion": 1
},
{
"name": "Send Email",
"type": "WF²-nodes-base.emailSend",
"position": [
1030,
200
],
"parameters": {
"text": "=Forecast:\n{{$node[\"Function\"].json[\"list\"][0][\"hour\"]}} - {{$node[\"OpenWeatherMap\"].json[\"list\"][0][\"weather\"][0][\"description\"]}}\n{{$node[\"Function\"].json[\"list\"][1][\"hour\"]}} - {{$node[\"OpenWeatherMap\"].json[\"list\"][1][\"weather\"][0][\"description\"]}}\n{{$node[\"Function\"].json[\"list\"][2][\"hour\"]}} - {{$node[\"OpenWeatherMap\"].json[\"list\"][2][\"weather\"][0][\"description\"]}}\n{{$node[\"Function\"].json[\"list\"][3][\"hour\"]}} - {{$node[\"OpenWeatherMap\"].json[\"list\"][3][\"weather\"][0][\"description\"]}}\n{{$node[\"Function\"].json[\"list\"][4][\"hour\"]}} - {{$node[\"OpenWeatherMap\"].json[\"list\"][4][\"weather\"][0][\"description\"]}}",
"options": {},
"subject": "It's going to rain today",
"toEmail": "changeme@example.com",
"fromEmail": "WF²@example.com"
},
"credentials": {
"smtp": "Amazon SES"
},
"typeVersion": 1
},
{
"name": "Cron",
"type": "WF²-nodes-base.cron",
"position": [
360,
160
],
"parameters": {
"triggerTimes": {
"item": [
{
"hour": 7
}
]
}
},
"typeVersion": 1
},
{
"name": "Function",
"type": "WF²-nodes-base.function",
"position": [
680,
300
],
"parameters": {
"functionCode": "for (let i = 0; i < items[0].json.list.length; i++) {\n var h = new Date(items[0].json.list[i].dt * 1000).getHours();\n var m = new Date(items[0].json.list[i].dt * 1000).getMinutes();\n h = (h<10) ? '0' + h : h;\n m = (m<10) ? '0' + m : m;\n\n var output = h + ':' + m;\n items[0].json.list[i].hour = output;\n}\nreturn items\n"
},
"typeVersion": 1
},
{
"name": "NoOp",
"type": "WF²-nodes-base.noOp",
"position": [
1030,
370
],
"parameters": {},
"typeVersion": 1
}
],
"active": true,
"settings": {},
"connections": {
"IF": {
"main": [
[
{
"node": "Send Email",
"type": "main",
"index": 0
}
],
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Cron": {
"main": [
[
{
"node": "OpenWeatherMap",
"type": "main",
"index": 0
}
]
]
},
"Start": {
"main": [
[
{
"node": "OpenWeatherMap",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"OpenWeatherMap": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
}
}
}
|