iobroker.parcel 0.0.21 → 0.0.25

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.
Files changed (4) hide show
  1. package/README.md +3 -0
  2. package/io-package.json +292 -281
  3. package/main.js +88 -22
  4. package/package.json +77 -77
package/README.md CHANGED
@@ -63,6 +63,9 @@ Den Datenpunkt parcel.0.dhl.briefe....image ein "String img src" element als Obj
63
63
 
64
64
  ## Changelog
65
65
 
66
+ ### 0.0.25
67
+
68
+ - Fix amazon UI parsing
66
69
  ### 0.0.19
67
70
 
68
71
  - Fix GLS Parcel
package/io-package.json CHANGED
@@ -1,287 +1,298 @@
1
1
  {
2
- "common": {
3
- "name": "parcel",
4
- "version": "0.0.21",
5
- "news": {
6
- "0.0.21": {
7
- "en": "Fix Brief images and pushover user"
8
- },
9
- "0.0.20": {
10
- "en": "Fix GLS Parcel"
11
- },
12
- "0.0.18": {
13
- "en": "Fix UPS/GLS login"
14
- },
15
- "0.0.15": {
16
- "en": "Fix DPD states and remove canvas dependency"
17
- },
18
- "0.0.13": {
19
- "en": "Fix Amazon delivery state, add telegram user"
20
- },
21
- "0.0.12": {
22
- "en": "Add delivery status"
23
- },
24
- "0.0.11": {
25
- "en": "Briefankündigung wird gestoppt, falls sie nicht funktioniert"
26
- },
27
- "0.0.10": {
28
- "en": "in Zustellung DP, DPD Bugfix, detailierte DPs für Amazon, Option für keine Benachrichtigung bei Adapterstart"
29
- },
30
- "0.0.8": {
31
- "en": "Hermes hinzugefügt"
32
- },
33
- "0.0.7": {
34
- "en": "Datenpunkt für in Zustellung hinzugefügt, Fix für wiederholende Benachrichtigungen"
35
- },
36
- "0.0.6": {
37
- "en": "initial release",
38
- "de": "Erstveröffentlichung",
39
- "ru": "Начальная версия",
40
- "pt": "lançamento inicial",
41
- "nl": "Eerste uitgave",
42
- "fr": "Première version",
43
- "it": "Versione iniziale",
44
- "es": "Versión inicial",
45
- "pl": "Pierwsze wydanie",
46
- "zh-cn": "首次出版"
47
- }
2
+ "common": {
3
+ "name": "parcel",
4
+ "version": "0.0.25",
5
+ "news": {
6
+ "0.0.25": {
7
+ "en": "Fix new Amazon UI parsing",
8
+ "de": "Neues Amazon UI parsing gefixt"
9
+ },
10
+ "0.0.23": {
11
+ "en": "Disable Pictures of Briefankündigung",
12
+ "de": "Bilder der Briefankündigung deaktiviert"
13
+ },
14
+ "0.0.22": {
15
+ "en": "Fix Amazon Login"
16
+ },
17
+ "0.0.21": {
18
+ "en": "Fix Brief images and pushover user"
19
+ },
20
+ "0.0.20": {
21
+ "en": "Fix GLS Parcel"
22
+ },
23
+ "0.0.18": {
24
+ "en": "Fix UPS/GLS login"
25
+ },
26
+ "0.0.15": {
27
+ "en": "Fix DPD states and remove canvas dependency"
28
+ },
29
+ "0.0.13": {
30
+ "en": "Fix Amazon delivery state, add telegram user"
31
+ },
32
+ "0.0.12": {
33
+ "en": "Add delivery status"
34
+ },
35
+ "0.0.11": {
36
+ "en": "Briefankündigung wird gestoppt, falls sie nicht funktioniert"
37
+ },
38
+ "0.0.10": {
39
+ "en": "in Zustellung DP, DPD Bugfix, detailierte DPs für Amazon, Option für keine Benachrichtigung bei Adapterstart"
40
+ },
41
+ "0.0.8": {
42
+ "en": "Hermes hinzugefügt"
43
+ },
44
+ "0.0.7": {
45
+ "en": "Datenpunkt für in Zustellung hinzugefügt, Fix für wiederholende Benachrichtigungen"
46
+ },
47
+ "0.0.6": {
48
+ "en": "initial release",
49
+ "de": "Erstveröffentlichung",
50
+ "ru": "Начальная версия",
51
+ "pt": "lançamento inicial",
52
+ "nl": "Eerste uitgave",
53
+ "fr": "Première version",
54
+ "it": "Versione iniziale",
55
+ "es": "Versión inicial",
56
+ "pl": "Pierwsze wydanie",
57
+ "zh-cn": "首次出版"
58
+ }
59
+ },
60
+ "title": "Parcel tracking",
61
+ "titleLang": {
62
+ "en": "Parcel tracking",
63
+ "de": "Paket Sendungsverfolgung",
64
+ "ru": "Отслеживание посылок",
65
+ "pt": "Rastreamento de encomendas",
66
+ "nl": "Pakket volgen",
67
+ "fr": "Suivi colis",
68
+ "it": "Tracciamento del pacco",
69
+ "es": "Seguimiento de paquetes",
70
+ "pl": "Śledzenie przesyłek",
71
+ "zh-cn": "包裹追踪"
72
+ },
73
+ "desc": {
74
+ "en": "Parcel tracking",
75
+ "de": "Paket Sendungsverfolgung",
76
+ "ru": "Отслеживание посылок",
77
+ "pt": "Rastreamento de encomendas",
78
+ "nl": "Pakket volgen",
79
+ "fr": "Suivi colis",
80
+ "it": "Tracciamento del pacco",
81
+ "es": "Seguimiento de paquetes",
82
+ "pl": "Śledzenie przesyłek",
83
+ "zh-cn": "包裹追踪"
84
+ },
85
+ "authors": ["TA2k <tombox2020@gmail.com>"],
86
+ "keywords": [
87
+ "parcel",
88
+ "tracking",
89
+ "paketverfolgung",
90
+ "sendungsverfolgung",
91
+ "dhl",
92
+ "gls",
93
+ "ups",
94
+ "hermes",
95
+ "paket",
96
+ "17Track",
97
+ "Amazon",
98
+ "dpd",
99
+ "briefe"
100
+ ],
101
+ "license": "MIT",
102
+ "platform": "Javascript/Node.js",
103
+ "main": "main.js",
104
+ "icon": "parcel.png",
105
+ "enabled": true,
106
+ "extIcon": "https://raw.githubusercontent.com/TA2k/ioBroker.parcel/master/admin/parcel.png",
107
+ "readme": "https://github.com/TA2k/ioBroker.parcel/blob/master/README.md",
108
+ "loglevel": "info",
109
+ "mode": "daemon",
110
+ "type": "misc-data",
111
+ "compact": true,
112
+ "connectionType": "cloud",
113
+ "dataSource": "poll",
114
+ "materialize": true,
115
+ "plugins": {
116
+ "sentry": {
117
+ "dsn": "https://6296452769de44959c1809642564a7e3@sentry.iobroker.net/171"
118
+ }
119
+ },
120
+ "dependencies": [
121
+ {
122
+ "js-controller": ">=3.2.0"
123
+ }
124
+ ],
125
+ "globalDependencies": [
126
+ {
127
+ "admin": ">=4.0.9"
128
+ }
129
+ ]
48
130
  },
49
- "title": "Parcel tracking",
50
- "titleLang": {
51
- "en": "Parcel tracking",
52
- "de": "Paket Sendungsverfolgung",
53
- "ru": "Отслеживание посылок",
54
- "pt": "Rastreamento de encomendas",
55
- "nl": "Pakket volgen",
56
- "fr": "Suivi colis",
57
- "it": "Tracciamento del pacco",
58
- "es": "Seguimiento de paquetes",
59
- "pl": "Śledzenie przesyłek",
60
- "zh-cn": "包裹追踪"
61
- },
62
- "desc": {
63
- "en": "Parcel tracking",
64
- "de": "Paket Sendungsverfolgung",
65
- "ru": "Отслеживание посылок",
66
- "pt": "Rastreamento de encomendas",
67
- "nl": "Pakket volgen",
68
- "fr": "Suivi colis",
69
- "it": "Tracciamento del pacco",
70
- "es": "Seguimiento de paquetes",
71
- "pl": "Śledzenie przesyłek",
72
- "zh-cn": "包裹追踪"
73
- },
74
- "authors": ["TA2k <tombox2020@gmail.com>"],
75
- "keywords": [
76
- "parcel",
77
- "tracking",
78
- "paketverfolgung",
79
- "sendungsverfolgung",
80
- "dhl",
81
- "gls",
82
- "ups",
83
- "hermes",
84
- "paket",
85
- "17Track",
86
- "Amazon",
87
- "dpd",
88
- "briefe"
131
+ "encryptedNative": [
132
+ "dhlpassword",
133
+ "amzpassword",
134
+ "dpdpassword",
135
+ "t17password",
136
+ "upspassword",
137
+ "hermespassword",
138
+ "postchpassword",
139
+ "postatpassword",
140
+ "glspassword"
89
141
  ],
90
- "license": "MIT",
91
- "platform": "Javascript/Node.js",
92
- "main": "main.js",
93
- "icon": "parcel.png",
94
- "enabled": true,
95
- "extIcon": "https://raw.githubusercontent.com/TA2k/ioBroker.parcel/master/admin/parcel.png",
96
- "readme": "https://github.com/TA2k/ioBroker.parcel/blob/master/README.md",
97
- "loglevel": "info",
98
- "mode": "daemon",
99
- "type": "misc-data",
100
- "compact": true,
101
- "connectionType": "cloud",
102
- "dataSource": "poll",
103
- "materialize": true,
104
- "plugins": {
105
- "sentry": {
106
- "dsn": "https://6296452769de44959c1809642564a7e3@sentry.iobroker.net/171"
107
- }
108
- },
109
- "dependencies": [
110
- {
111
- "js-controller": ">=3.2.0"
112
- }
142
+ "protectedNative": [
143
+ "dhlpassword",
144
+ "amzpassword",
145
+ "dpdpassword",
146
+ "t17password",
147
+ "upspassword",
148
+ "hermespassword",
149
+ "postchpassword",
150
+ "postatpassword",
151
+ "glspassword"
113
152
  ],
114
- "globalDependencies": [
115
- {
116
- "admin": ">=4.0.9"
117
- }
118
- ]
119
- },
120
- "encryptedNative": [
121
- "dhlpassword",
122
- "amzpassword",
123
- "dpdpassword",
124
- "t17password",
125
- "upspassword",
126
- "hermespassword",
127
- "postchpassword",
128
- "postatpassword",
129
- "glspassword"
130
- ],
131
- "protectedNative": [
132
- "dhlpassword",
133
- "amzpassword",
134
- "dpdpassword",
135
- "t17password",
136
- "upspassword",
137
- "hermespassword",
138
- "postchpassword",
139
- "postatpassword",
140
- "glspassword"
141
- ],
142
- "native": {
143
- "amzusername": "",
144
- "amzpassword": "",
145
- "glsusername": "",
146
- "glspassword": "",
147
- "upsusername": "",
148
- "upspassword": "",
149
- "hermespassword": "",
150
- "hermesusername": "",
151
- "postchusername": "",
152
- "postchpassword": "",
153
- "postatusername": "",
154
- "postatpassword": "",
155
- "amzotp": "",
156
- "t17username": "",
157
- "t17password": "",
158
- "dpdusername": "",
159
- "dpdpassword": "",
160
- "dhlusername": "",
161
- "dhlpassword": "",
162
- "dhlMfa": "",
163
- "17trackKey": "",
164
- "sendToActive": false,
165
- "noFirstStartSend": false,
166
- "sendToInstance": "telegram.0",
167
- "sendToUser": "",
168
- "interval": 10
169
- },
170
- "objects": [],
171
- "instanceObjects": [
172
- {
173
- "_id": "info",
174
- "type": "channel",
175
- "common": {
176
- "name": "Information"
177
- },
178
- "native": {}
179
- },
180
- {
181
- "_id": "allProviderJson",
182
- "type": "state",
183
- "common": {
184
- "role": "json",
185
- "name": "Tracking List of all Providers",
186
- "type": "string",
187
- "read": true,
188
- "write": false
189
- },
190
- "native": {}
191
- },
192
- {
193
- "_id": "allProviderObjects",
194
- "type": "state",
195
- "common": {
196
- "role": "json",
197
- "name": "Tracking Dictionary of all Providers",
198
- "type": "string",
199
- "read": true,
200
- "write": false
201
- },
202
- "native": {}
203
- },
204
- {
205
- "_id": "inDelivery",
206
- "type": "state",
207
- "common": {
208
- "role": "json",
209
- "name": "Today in delivery/Heute in Zustellung",
210
- "type": "string",
211
- "read": true,
212
- "write": false
213
- },
214
- "native": {}
153
+ "native": {
154
+ "amzusername": "",
155
+ "amzpassword": "",
156
+ "glsusername": "",
157
+ "glspassword": "",
158
+ "upsusername": "",
159
+ "upspassword": "",
160
+ "hermespassword": "",
161
+ "hermesusername": "",
162
+ "postchusername": "",
163
+ "postchpassword": "",
164
+ "postatusername": "",
165
+ "postatpassword": "",
166
+ "amzotp": "",
167
+ "t17username": "",
168
+ "t17password": "",
169
+ "dpdusername": "",
170
+ "dpdpassword": "",
171
+ "dhlusername": "",
172
+ "dhlpassword": "",
173
+ "dhlMfa": "",
174
+ "17trackKey": "",
175
+ "sendToActive": false,
176
+ "noFirstStartSend": false,
177
+ "sendToInstance": "telegram.0",
178
+ "sendToUser": "",
179
+ "interval": 10
215
180
  },
216
- {
217
- "_id": "inDeliveryCount",
218
- "type": "state",
219
- "common": {
220
- "role": "value",
221
- "name": "Number of in delivery/Anzahl in Zustellung",
222
- "type": "number",
223
- "read": true,
224
- "write": false
225
- },
226
- "native": {}
227
- },
228
- {
229
- "_id": "auth",
230
- "type": "channel",
231
- "common": {
232
- "name": "Auth Information"
233
- },
234
- "native": {}
235
- },
236
- {
237
- "_id": "auth.dhlMfaToken",
238
- "type": "state",
239
- "common": {
240
- "role": "state",
241
- "name": "DHL Mfa Token",
242
- "type": "string",
243
- "read": true,
244
- "write": false
245
- },
246
- "native": {}
247
- },
248
- {
249
- "_id": "auth.cookie",
250
- "type": "state",
251
- "common": {
252
- "role": "state",
253
- "name": "Cookie state",
254
- "type": "string",
255
- "read": true,
256
- "write": false
257
- },
258
- "native": {}
259
- },
260
- {
261
- "_id": "info.connection",
262
- "type": "state",
263
- "common": {
264
- "role": "indicator.connected",
265
- "name": "Device or service connected",
266
- "type": "boolean",
267
- "read": true,
268
- "write": false,
269
- "def": false
270
- },
271
- "native": {}
272
- },
273
- {
274
- "_id": "refresh",
275
- "type": "state",
276
- "common": {
277
- "role": "boolean",
278
- "name": "Force data refresh",
279
- "type": "boolean",
280
- "read": true,
281
- "write": true,
282
- "def": false
283
- },
284
- "native": {}
285
- }
286
- ]
181
+ "objects": [],
182
+ "instanceObjects": [
183
+ {
184
+ "_id": "info",
185
+ "type": "channel",
186
+ "common": {
187
+ "name": "Information"
188
+ },
189
+ "native": {}
190
+ },
191
+ {
192
+ "_id": "allProviderJson",
193
+ "type": "state",
194
+ "common": {
195
+ "role": "json",
196
+ "name": "Tracking List of all Providers",
197
+ "type": "string",
198
+ "read": true,
199
+ "write": false
200
+ },
201
+ "native": {}
202
+ },
203
+ {
204
+ "_id": "allProviderObjects",
205
+ "type": "state",
206
+ "common": {
207
+ "role": "json",
208
+ "name": "Tracking Dictionary of all Providers",
209
+ "type": "string",
210
+ "read": true,
211
+ "write": false
212
+ },
213
+ "native": {}
214
+ },
215
+ {
216
+ "_id": "inDelivery",
217
+ "type": "state",
218
+ "common": {
219
+ "role": "json",
220
+ "name": "Today in delivery/Heute in Zustellung",
221
+ "type": "string",
222
+ "read": true,
223
+ "write": false
224
+ },
225
+ "native": {}
226
+ },
227
+ {
228
+ "_id": "inDeliveryCount",
229
+ "type": "state",
230
+ "common": {
231
+ "role": "value",
232
+ "name": "Number of in delivery/Anzahl in Zustellung",
233
+ "type": "number",
234
+ "read": true,
235
+ "write": false
236
+ },
237
+ "native": {}
238
+ },
239
+ {
240
+ "_id": "auth",
241
+ "type": "channel",
242
+ "common": {
243
+ "name": "Auth Information"
244
+ },
245
+ "native": {}
246
+ },
247
+ {
248
+ "_id": "auth.dhlMfaToken",
249
+ "type": "state",
250
+ "common": {
251
+ "role": "state",
252
+ "name": "DHL Mfa Token",
253
+ "type": "string",
254
+ "read": true,
255
+ "write": false
256
+ },
257
+ "native": {}
258
+ },
259
+ {
260
+ "_id": "auth.cookie",
261
+ "type": "state",
262
+ "common": {
263
+ "role": "state",
264
+ "name": "Cookie state",
265
+ "type": "string",
266
+ "read": true,
267
+ "write": false
268
+ },
269
+ "native": {}
270
+ },
271
+ {
272
+ "_id": "info.connection",
273
+ "type": "state",
274
+ "common": {
275
+ "role": "indicator.connected",
276
+ "name": "Device or service connected",
277
+ "type": "boolean",
278
+ "read": true,
279
+ "write": false,
280
+ "def": false
281
+ },
282
+ "native": {}
283
+ },
284
+ {
285
+ "_id": "refresh",
286
+ "type": "state",
287
+ "common": {
288
+ "role": "boolean",
289
+ "name": "Force data refresh",
290
+ "type": "boolean",
291
+ "read": true,
292
+ "write": true,
293
+ "def": false
294
+ },
295
+ "native": {}
296
+ }
297
+ ]
287
298
  }
package/main.js CHANGED
@@ -52,7 +52,15 @@ class Parcel extends utils.Adapter {
52
52
  this.alreadySentMessages = {};
53
53
  this.ignoredPath = [];
54
54
  this.firstStart = true;
55
- this.delivery_status = { ERROR: -1, UNKNOWN: 5, REGISTERED: 10, IN_PREPARATION: 20, IN_TRANSIT: 30, OUT_FOR_DELIVERY: 40, DELIVERED: 1 };
55
+ this.delivery_status = {
56
+ ERROR: -1,
57
+ UNKNOWN: 5,
58
+ REGISTERED: 10,
59
+ IN_PREPARATION: 20,
60
+ IN_TRANSIT: 30,
61
+ OUT_FOR_DELIVERY: 40,
62
+ DELIVERED: 1,
63
+ };
56
64
  this.tmpDir = tmpdir();
57
65
  }
58
66
 
@@ -462,7 +470,7 @@ class Parcel extends utils.Adapter {
462
470
  }
463
471
  });
464
472
  let form = this.extractHidden(body);
465
- if (form.email == !this.config.amzusername) {
473
+ if (form.email !== this.config.amzusername) {
466
474
  form.email = this.config.amzusername;
467
475
  body = await this.requestClient({
468
476
  method: "post",
@@ -509,7 +517,7 @@ class Parcel extends utils.Adapter {
509
517
  })
510
518
  .then(async (res) => {
511
519
  this.log.debug(JSON.stringify(res.data));
512
- if (res.data.indexOf("Meine Bestellungen") !== -1) {
520
+ if (res.data.indexOf("js-yo-main-content") !== -1) {
513
521
  this.log.info("Login to Amazon successful");
514
522
  this.sessions["amz"] = true;
515
523
  this.setState("info.connection", true, true);
@@ -557,7 +565,7 @@ class Parcel extends utils.Adapter {
557
565
  })
558
566
  .then(async (res) => {
559
567
  this.log.debug(JSON.stringify(res.data));
560
- if (res.data.indexOf("Meine Bestellungen") !== -1) {
568
+ if (res.data.indexOf("js-yo-main-content") !== -1) {
561
569
  this.log.info("Login to Amazon successful");
562
570
  this.sessions["amz"] = true;
563
571
  this.setState("info.connection", true, true);
@@ -775,7 +783,7 @@ class Parcel extends utils.Adapter {
775
783
  "user-agent": "Hermes/33 CFNetwork/1240.0.4 Darwin/20.6.0",
776
784
  "accept-language": "de-de",
777
785
  },
778
- data: `{"username":"${this.config.hermesusername}","password":"${this.config.hermespassword}"}`,
786
+ data: { username: this.config.hermesusername, password: this.config.hermespassword },
779
787
 
780
788
  jar: this.cookieJar,
781
789
  withCredentials: true,
@@ -1302,7 +1310,10 @@ class Parcel extends utils.Adapter {
1302
1310
  if (data) {
1303
1311
  await this.cleanupProvider(id, data);
1304
1312
  this.mergeProviderJson(id, data);
1305
- this.json2iob.parse(element.path, data, { forceIndex: forceIndex, preferedArrayName: preferedArrayName });
1313
+ this.json2iob.parse(element.path, data, {
1314
+ forceIndex: forceIndex,
1315
+ preferedArrayName: preferedArrayName,
1316
+ });
1306
1317
  data && this.setState(element.path + ".json", JSON.stringify(data), true);
1307
1318
  }
1308
1319
  })
@@ -1425,7 +1436,12 @@ class Parcel extends utils.Adapter {
1425
1436
  }
1426
1437
  if (id === "ups" && data.sendungen) {
1427
1438
  const sendungsArray = data.sendungen.map((sendung) => {
1428
- const sendungsObject = { id: sendung.id, name: sendung.shipFromName, status: sendung.locStatus || sendung.status, source: "UPS" };
1439
+ const sendungsObject = {
1440
+ id: sendung.id,
1441
+ name: sendung.shipFromName,
1442
+ status: sendung.locStatus || sendung.status,
1443
+ source: "UPS",
1444
+ };
1429
1445
 
1430
1446
  sendungsObject.delivery_status = this.deliveryStatusCheck(sendung, id, sendungsObject);
1431
1447
  if (sendungsObject.delivery_status === this.delivery_status.OUT_FOR_DELIVERY) {
@@ -1444,7 +1460,12 @@ class Parcel extends utils.Adapter {
1444
1460
  if (sendung.sender && sendung.sender.lastname) {
1445
1461
  name = name + " " + sendung.sender.lastname;
1446
1462
  }
1447
- const sendungsObject = { id: sendung.id, name: name, status: sendung.lastStatusMessage || "", source: "Hermes" };
1463
+ const sendungsObject = {
1464
+ id: sendung.id,
1465
+ name: name,
1466
+ status: sendung.lastStatusMessage || "",
1467
+ source: "Hermes",
1468
+ };
1448
1469
 
1449
1470
  sendungsObject.delivery_status = this.deliveryStatusCheck(sendung, id, sendungsObject);
1450
1471
  if (sendungsObject.delivery_status === this.delivery_status.OUT_FOR_DELIVERY) {
@@ -1460,7 +1481,12 @@ class Parcel extends utils.Adapter {
1460
1481
 
1461
1482
  if (id === "dpd" && data && data.sendungen) {
1462
1483
  const sendungsArray = data.sendungen.map((sendung) => {
1463
- const sendungsObject = { id: sendung.id, name: sendung.name, status: sendung.status || "", source: "DPD" };
1484
+ const sendungsObject = {
1485
+ id: sendung.id,
1486
+ name: sendung.name,
1487
+ status: sendung.status || "",
1488
+ source: "DPD",
1489
+ };
1464
1490
 
1465
1491
  sendungsObject.delivery_status = this.deliveryStatusCheck(sendung, id, sendungsObject);
1466
1492
  if (sendungsObject.delivery_status === this.delivery_status.OUT_FOR_DELIVERY) {
@@ -1490,7 +1516,12 @@ class Parcel extends utils.Adapter {
1490
1516
  }
1491
1517
  if (id === "17track" && data.accepted) {
1492
1518
  const sendungsArray = data.accepted.map((sendung) => {
1493
- const sendungsObject = { id: sendung.number, name: sendung.number, status: sendung.track.z0 ? sendung.track.z0.z : "", source: "17track" };
1519
+ const sendungsObject = {
1520
+ id: sendung.number,
1521
+ name: sendung.number,
1522
+ status: sendung.track.z0 ? sendung.track.z0.z : "",
1523
+ source: "17track",
1524
+ };
1494
1525
  if (!this.mergedJsonObject[sendung.id]) {
1495
1526
  sendungsObject.delivery_status = this.deliveryStatusCheck(sendung, id, sendungsObject);
1496
1527
  if (sendungsObject.delivery_status === this.delivery_status.OUT_FOR_DELIVERY) {
@@ -1552,7 +1583,11 @@ class Parcel extends utils.Adapter {
1552
1583
  if (sendUser.length > 0) {
1553
1584
  for (const user of sendUser) {
1554
1585
  if (sendInstance.includes("pushover")) {
1555
- await this.sendToAsync(sendInstance, { device: user, message: text, title: "Paketstatus" });
1586
+ await this.sendToAsync(sendInstance, {
1587
+ device: user,
1588
+ message: text,
1589
+ title: "Paketstatus",
1590
+ });
1556
1591
  } else if (sendInstance.includes("signal-cmb")) {
1557
1592
  await this.sendToAsync(sendInstance, "send", {
1558
1593
  text: text,
@@ -1764,19 +1799,32 @@ class Parcel extends utils.Adapter {
1764
1799
  withCredentials: true,
1765
1800
  })
1766
1801
  .then(async (res) => {
1767
- //this.log.debug(JSON.stringify(res.data));
1802
+ this.log.debug(JSON.stringify(res.data));
1768
1803
 
1769
1804
  const dom = new JSDOM(res.data);
1770
1805
  const document = dom.window.document;
1771
1806
  const elements = [];
1772
- const orders = document.querySelectorAll(".a-box.shipment");
1807
+ const orders = document.querySelectorAll(".order-card.js-order-card");
1773
1808
 
1774
1809
  for (const order of orders) {
1775
1810
  const descHandle = order.querySelector(
1776
- ".a-fixed-right-grid-col.a-col-left .a-row div:first-child .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal"
1811
+ ".a-fixed-right-grid-col.a-col-left .a-fixed-left-grid-col.a-col-right div:first-child .a-link-normal"
1777
1812
  );
1778
1813
  const desc = descHandle ? descHandle.textContent.replace(/\n */g, "") : "";
1779
- const url = order.querySelector(".track-package-button a") ? order.querySelector(".track-package-button a").getAttribute("href") : "";
1814
+ let url = order.querySelector(".track-package-button a") ? order.querySelector(".track-package-button a").getAttribute("href") : "";
1815
+ if (!url) {
1816
+ const allLinks = order.querySelectorAll(".a-button-inner a");
1817
+ for (const link of allLinks) {
1818
+ if (link.textContent.includes("Lieferung verfolgen")) {
1819
+ url = link.getAttribute("href");
1820
+ }
1821
+ }
1822
+ }
1823
+ if (!url) {
1824
+ url = order.querySelector(".yohtmlc-shipment-level-connections .a-button-inner a")
1825
+ ? order.querySelector(".yohtmlc-shipment-level-connections .a-button-inner a").getAttribute("href")
1826
+ : "";
1827
+ }
1780
1828
  if (url) {
1781
1829
  elements.push({ desc: desc, url: url });
1782
1830
  }
@@ -1809,7 +1857,7 @@ class Parcel extends utils.Adapter {
1809
1857
  },
1810
1858
  })
1811
1859
  .then(async (res) => {
1812
- // this.log.debug(JSON.stringify(res.data));
1860
+ this.log.debug(JSON.stringify(res.data));
1813
1861
  const dom = new JSDOM(res.data);
1814
1862
  const document = dom.window.document;
1815
1863
  const statusHandle =
@@ -2141,7 +2189,12 @@ class Parcel extends utils.Adapter {
2141
2189
  url: "https://buyer.17track.net/orderapi/call",
2142
2190
  header: { "content-type": "application/x-www-form-urlencoded" },
2143
2191
 
2144
- data: JSON.stringify({ version: "1.0", timeZoneOffset: -60, method: "AddTrackNo", param: { TrackNos: [state.val] } }),
2192
+ data: JSON.stringify({
2193
+ version: "1.0",
2194
+ timeZoneOffset: -60,
2195
+ method: "AddTrackNo",
2196
+ param: { TrackNos: [state.val] },
2197
+ }),
2145
2198
  })
2146
2199
  .then(async (res) => {
2147
2200
  this.log.info(JSON.stringify(res.data));
@@ -2160,7 +2213,7 @@ class Parcel extends utils.Adapter {
2160
2213
  if (!imageBase64) {
2161
2214
  const image = await this.requestClient({
2162
2215
  method: "get",
2163
- url: state.val.replace("/v1.0", ""),
2216
+ url: state.val,
2164
2217
  responseType: "arraybuffer",
2165
2218
  }).catch((error) => {
2166
2219
  if (error.response && error.response.status === 401) {
@@ -2205,20 +2258,33 @@ class Parcel extends utils.Adapter {
2205
2258
  if (sendUser.length > 0) {
2206
2259
  for (const user of sendUser) {
2207
2260
  if (sendInstance.includes("pushover")) {
2208
- await this.sendToAsync(sendInstance, { device: user, file: `${this.tmpDir}${sep}${uuid}.jpg`, title: "✉️Briefankündigung" });
2261
+ await this.sendToAsync(sendInstance, {
2262
+ device: user,
2263
+ file: `${this.tmpDir}${sep}${uuid}.jpg`,
2264
+ title: "✉️Briefankündigung",
2265
+ });
2209
2266
  } else if (sendInstance.includes("signal-cmb")) {
2210
2267
  await this.sendToAsync(sendInstance, "send", {
2211
2268
  text: "✉️Briefankündigung",
2212
2269
  phone: user,
2213
2270
  });
2214
2271
  } else {
2215
- await this.sendToAsync(sendInstance, { user: user, text: "✉️Briefankündigung" });
2216
- await this.sendToAsync(sendInstance, { user: user, text: `${this.tmpDir}${sep}${uuid}.jpg` });
2272
+ await this.sendToAsync(sendInstance, {
2273
+ user: user,
2274
+ text: "✉️Briefankündigung",
2275
+ });
2276
+ await this.sendToAsync(sendInstance, {
2277
+ user: user,
2278
+ text: `${this.tmpDir}${sep}${uuid}.jpg`,
2279
+ });
2217
2280
  }
2218
2281
  }
2219
2282
  } else {
2220
2283
  if (sendInstance.includes("pushover")) {
2221
- await this.sendToAsync(sendInstance, { file: `${this.tmpDir}${sep}${uuid}.jpg`, title: "✉️Briefankündigung" });
2284
+ await this.sendToAsync(sendInstance, {
2285
+ file: `${this.tmpDir}${sep}${uuid}.jpg`,
2286
+ title: "✉️Briefankündigung",
2287
+ });
2222
2288
  } else if (sendInstance.includes("signal-cmb")) {
2223
2289
  await this.sendToAsync(sendInstance, "send", {
2224
2290
  text: "✉️Briefankündigung",
package/package.json CHANGED
@@ -1,79 +1,79 @@
1
1
  {
2
- "name": "iobroker.parcel",
3
- "version": "0.0.21",
4
- "description": "Parcel tracking",
5
- "author": {
6
- "name": "TA2k",
7
- "email": "tombox2020@gmail.com"
8
- },
9
- "homepage": "https://github.com/TA2k/ioBroker.parcel",
10
- "license": "MIT",
11
- "keywords": [
12
- "parcel",
13
- "tracking",
14
- "dhl",
15
- "briefe",
16
- "dpd",
17
- "gls",
18
- "hermes",
19
- "ups",
20
- "amazon",
21
- "paket"
22
- ],
23
- "repository": {
24
- "type": "git",
25
- "url": "https://github.com/TA2k/ioBroker.parcel"
26
- },
27
- "dependencies": {
28
- "@iobroker/adapter-core": "^2.6.2",
29
- "axios": "^0.27.2",
30
- "http-cookie-agent": "^4.0.2",
31
- "jsdom": "^20.0.0",
32
- "json-bigint": "^1.0.0",
33
- "qs": "^6.11.0",
34
- "tough-cookie": "^4.1.2",
35
- "uuid": "^9.0.0"
36
- },
37
- "devDependencies": {
38
- "@iobroker/testing": "^4.1.0",
39
- "@types/chai": "^4.3.3",
40
- "@types/chai-as-promised": "^7.1.5",
41
- "@types/gulp": "^4.0.9",
42
- "@types/mocha": "^9.1.1",
43
- "@types/node": "^18.7.16",
44
- "@types/proxyquire": "^1.3.28",
45
- "@types/sinon": "^10.0.13",
46
- "@types/sinon-chai": "^3.2.8",
47
- "chai": "^4.3.6",
48
- "chai-as-promised": "^7.1.1",
49
- "eslint": "^8.23.0",
50
- "mocha": "^10.0.0",
51
- "proxyquire": "^2.1.3",
52
- "sinon": "^14.0.0",
53
- "sinon-chai": "^3.7.0",
54
- "typescript": "~4.8.3"
55
- },
56
- "main": "main.js",
57
- "files": [
58
- "admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
59
- "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
60
- "lib/",
61
- "www/",
62
- "io-package.json",
63
- "LICENSE",
64
- "main.js"
65
- ],
66
- "scripts": {
67
- "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
68
- "test:package": "mocha test/package --exit",
69
- "test:unit": "mocha test/unit --exit",
70
- "test:integration": "mocha test/integration --exit",
71
- "test": "npm run test:js && npm run test:package",
72
- "check": "tsc --noEmit -p tsconfig.check.json",
73
- "lint": "eslint"
74
- },
75
- "bugs": {
76
- "url": "https://github.com/TA2k/ioBroker.parcel/issues"
77
- },
78
- "readmeFilename": "README.md"
2
+ "name": "iobroker.parcel",
3
+ "version": "0.0.25",
4
+ "description": "Parcel tracking",
5
+ "author": {
6
+ "name": "TA2k",
7
+ "email": "tombox2020@gmail.com"
8
+ },
9
+ "homepage": "https://github.com/TA2k/ioBroker.parcel",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "parcel",
13
+ "tracking",
14
+ "dhl",
15
+ "briefe",
16
+ "dpd",
17
+ "gls",
18
+ "hermes",
19
+ "ups",
20
+ "amazon",
21
+ "paket"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/TA2k/ioBroker.parcel"
26
+ },
27
+ "dependencies": {
28
+ "@iobroker/adapter-core": "^2.6.7",
29
+ "axios": "^1.2.2",
30
+ "http-cookie-agent": "^5.0.2",
31
+ "jsdom": "^20.0.3",
32
+ "json-bigint": "^1.0.0",
33
+ "qs": "^6.11.0",
34
+ "tough-cookie": "^4.1.2",
35
+ "uuid": "^9.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@iobroker/testing": "^4.1.0",
39
+ "@types/chai": "^4.3.4",
40
+ "@types/chai-as-promised": "^7.1.5",
41
+ "@types/gulp": "^4.0.10",
42
+ "@types/mocha": "^10.0.1",
43
+ "@types/node": "^18.11.18",
44
+ "@types/proxyquire": "^1.3.28",
45
+ "@types/sinon": "^10.0.13",
46
+ "@types/sinon-chai": "^3.2.9",
47
+ "chai": "^4.3.7",
48
+ "chai-as-promised": "^7.1.1",
49
+ "eslint": "^8.30.0",
50
+ "mocha": "^10.2.0",
51
+ "proxyquire": "^2.1.3",
52
+ "sinon": "^15.0.1",
53
+ "sinon-chai": "^3.7.0",
54
+ "typescript": "~4.9.4"
55
+ },
56
+ "main": "main.js",
57
+ "files": [
58
+ "admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
59
+ "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
60
+ "lib/",
61
+ "www/",
62
+ "io-package.json",
63
+ "LICENSE",
64
+ "main.js"
65
+ ],
66
+ "scripts": {
67
+ "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
68
+ "test:package": "mocha test/package --exit",
69
+ "test:unit": "mocha test/unit --exit",
70
+ "test:integration": "mocha test/integration --exit",
71
+ "test": "npm run test:js && npm run test:package",
72
+ "check": "tsc --noEmit -p tsconfig.check.json",
73
+ "lint": "eslint"
74
+ },
75
+ "bugs": {
76
+ "url": "https://github.com/TA2k/ioBroker.parcel/issues"
77
+ },
78
+ "readmeFilename": "README.md"
79
79
  }