-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathrpilocator-Node-RED-flow.json
164 lines (164 loc) · 5 KB
/
rpilocator-Node-RED-flow.json
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
[
{
"id": "dc6415197c0b21a2",
"type": "tab",
"label": "rpilocator Notification",
"disabled": false,
"info": "",
"env": []
},
{
"id": "a0de6294ee4fa94e",
"type": "inject",
"z": "dc6415197c0b21a2",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "65",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 120,
"wires": [
[
"50edf7c6cc0875d6"
]
]
},
{
"id": "50edf7c6cc0875d6",
"type": "http request",
"z": "dc6415197c0b21a2",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://rpilocator.com/feed/",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"credentials": {},
"x": 330,
"y": 120,
"wires": [
[
"5687411af5e76884"
]
]
},
{
"id": "5687411af5e76884",
"type": "xml",
"z": "dc6415197c0b21a2",
"name": "",
"property": "payload",
"attr": "",
"chr": "",
"x": 170,
"y": 220,
"wires": [
[
"19f3042306f91188"
]
]
},
{
"id": "e7ed6679b9745246",
"type": "debug",
"z": "dc6415197c0b21a2",
"name": "debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 650,
"y": 260,
"wires": []
},
{
"id": "19f3042306f91188",
"type": "function",
"z": "dc6415197c0b21a2",
"name": "Check new alerts",
"func": "var control = context.get('control');\n\nvar rss = msg.payload.rss;\n\nvar entries = rss.channel[0].item;\n\nvar MESSAGE_TITLE = 'xlocator Stock Alert'\n\nvar result = {};\n\nif(control===undefined){\n control = []\n \n if(entries !== undefined){\n for (const entry of entries) {\n control.push(entry.guid[0]._);\n }\n }\n\n}\n\nif (entries !== undefined) {\n for (const entry of entries) {\n if (!control.includes(entry.guid[0]._)){\n var guidEntry = (entry.guid[0]._);\n\n node.warn(entry);\n\n var message = { 'type': 'link', 'title': MESSAGE_TITLE, 'body': entry.title[0], 'url': entry.link[0] }\n\n node.warn(message);\n \n control.push(entry.guid[0]._);\n\n msg.payload = message;\n\n node.send(msg)\n }\n }\n}\n\ncontext.set('control', control)\n\nreturn;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 390,
"y": 220,
"wires": [
[
"e7ed6679b9745246",
"323569b71d2c70fe"
]
]
},
{
"id": "323569b71d2c70fe",
"type": "http request",
"z": "dc6415197c0b21a2",
"name": "Pushbullet",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://api.pushbullet.com/v2/pushes",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "application/json",
"valueValue": ""
},
{
"keyType": "other",
"keyValue": "Access-Token",
"valueType": "other",
"valueValue": "Enter Token Here"
}
],
"credentials": {},
"x": 530,
"y": 380,
"wires": [
[]
],
"info": "Send a Pushbullet notification to your device.\r\nMake sure to update the 'Access-Token' header\r\nbefore deploying the flow."
},
{
"id": "42a2db4e8dad266d",
"type": "comment",
"z": "dc6415197c0b21a2",
"name": "",
"info": "Check rpilocator RSS feed and send a notification\nto your device. Check [rpilocator.com](rpilocator.com) or \nthe [Gihut repo](https://github.com/camerahacks/rpilocator-rss-feed) for more info\n",
"x": 140,
"y": 40,
"wires": []
}
]