iobroker.parcelapp 0.10.4 → 0.11.1
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/README.md +14 -15
- package/admin/i18n/de.json +11 -1
- package/admin/i18n/en.json +11 -1
- package/admin/i18n/es.json +11 -1
- package/admin/i18n/fr.json +11 -1
- package/admin/i18n/it.json +11 -1
- package/admin/i18n/nl.json +11 -1
- package/admin/i18n/pl.json +11 -1
- package/admin/i18n/pt.json +11 -1
- package/admin/i18n/ru.json +11 -1
- package/admin/i18n/uk.json +11 -1
- package/admin/i18n/zh-cn.json +11 -1
- package/build/lib/state-manager.js +98 -26
- package/build/lib/state-manager.js.map +2 -2
- package/build/main.js +103 -16
- package/build/main.js.map +2 -2
- package/io-package.json +53 -28
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
ioBroker adapter for the [parcel.app](https://parcelapp.net) API. Supports all carriers that parcel.app tracks.
|
|
10
10
|
|
|
11
|
+
📖 **Full user documentation:** [English](docs/en/README.md) · [Deutsch](docs/de/README.md) — setup step by step, every datapoint explained, scripting and FAQ.
|
|
12
|
+
|
|
11
13
|
---
|
|
12
14
|
|
|
13
15
|
## Features
|
|
@@ -140,6 +142,18 @@ sendTo("parcelapp.0", "addDelivery", {
|
|
|
140
142
|
Placeholder for the next version (at the beginning of the line):
|
|
141
143
|
### **WORK IN PROGRESS**
|
|
142
144
|
-->
|
|
145
|
+
### 0.11.1 (2026-09-04)
|
|
146
|
+
|
|
147
|
+
- Fixed: The last-changed timestamp of a package kept its old label and had no description as long as the package did not move.
|
|
148
|
+
|
|
149
|
+
### 0.11.0 (2026-09-04)
|
|
150
|
+
|
|
151
|
+
- Fixed: Since version 0.10.3 the Test Connection button gave no response at all, and packages added from a script never showed up — both work again.
|
|
152
|
+
- Fixed: On installations that already existed, the summary datapoints and the connection state kept their old English names — an update now reaches every datapoint.
|
|
153
|
+
- New: Datapoints whose name alone does not explain them now carry a short description in the object tree, in all eleven languages.
|
|
154
|
+
- New: Detailed user documentation in English and German, shown in the ioBroker documentation portal.
|
|
155
|
+
- Fixed: Two settings from much older versions were still listed in the instance configuration although nothing used them any more.
|
|
156
|
+
|
|
143
157
|
### 0.10.4 (2026-09-02)
|
|
144
158
|
|
|
145
159
|
- Fixed: A malformed reply from parcel.app (empty body or a broken delivery entry) no longer aborts the poll with a cryptic internal message — it is reported as an API problem and retried next poll.
|
|
@@ -155,21 +169,6 @@ sendTo("parcelapp.0", "addDelivery", {
|
|
|
155
169
|
|
|
156
170
|
- Changed: Internal cleanup. No user-facing changes.
|
|
157
171
|
|
|
158
|
-
### 0.10.1 (2026-07-13) — stable
|
|
159
|
-
|
|
160
|
-
- Internal refactoring. No user-facing changes.
|
|
161
|
-
|
|
162
|
-
### 0.10.0 (2026-07-08)
|
|
163
|
-
|
|
164
|
-
- Fixed: the admin "Test Connection" button now reports real failures — before, it always showed "Ok" even with a wrong API key.
|
|
165
|
-
- Fixed: a package's last-updated timestamp no longer jumps to the restart time after an adapter restart — it only changes when tracking data actually changed.
|
|
166
|
-
- Fixed: a stalled API response can no longer freeze polling until a manual restart — every request now has a hard 60-second deadline.
|
|
167
|
-
- Fixed: a failed adapter start now triggers an automatic restart instead of leaving the adapter idle until restarted by hand.
|
|
168
|
-
- Changed: recurring errors such as a wrong API key are logged once instead of every poll cycle, and stopping the adapter no longer leaves a red error line in the log.
|
|
169
|
-
- Changed: short ioBroker database hiccups no longer flip the connection indicator — it now reflects only the parcel.app connection.
|
|
170
|
-
- Changed: the fallback package name ("Package …") is localized like all other texts, and the adapter is listed under a fitting admin category (misc-data).
|
|
171
|
-
- Changed: the automatic poll after adding a delivery now respects the one-minute pacing, so bulk-adds can no longer exhaust the hourly API budget.
|
|
172
|
-
|
|
173
172
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
174
173
|
|
|
175
174
|
## Support
|
package/admin/i18n/de.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Zustellversuch gescheitert",
|
|
45
45
|
"status_7": "Ausnahme",
|
|
46
46
|
"status_8": "Registriert",
|
|
47
|
-
"packageName": "Paket %s"
|
|
47
|
+
"packageName": "Paket %s",
|
|
48
|
+
"descInfoConnection": "Wahr, solange der Adapter die parcel.app-API erreicht.",
|
|
49
|
+
"descStatusCode": "Numerischer Status von parcel.app (0-8); -1 bedeutet, dass der Wert nicht gedeutet werden konnte.",
|
|
50
|
+
"descExtraInfo": "Zusatzangabe, die der Zusteller benötigt, etwa Postleitzahl oder E-Mail-Adresse.",
|
|
51
|
+
"descDeliveryWindow": "Erwartetes Zustellfenster; ein über mehrere Tage reichendes Fenster trägt auf beiden Seiten das Datum.",
|
|
52
|
+
"descDeliveryEstimate": "Erwartete Zustellung in Worten - heute, morgen oder in einigen Tagen.",
|
|
53
|
+
"descLastEvent": "Jüngste Sendungsmeldung des Zustellers mit Datum.",
|
|
54
|
+
"descLastUpdated": "Zeitpunkt der letzten Änderung der Sendungsdaten - nicht der letzte Abruf.",
|
|
55
|
+
"descActiveCount": "Anzahl der Pakete, die noch nicht zugestellt sind.",
|
|
56
|
+
"descTodayCount": "Anzahl der Pakete, die heute erwartet werden.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Gemeinsames Fenster aller heute erwarteten Pakete - frühester Beginn bis spätestes Ende."
|
|
48
58
|
}
|
package/admin/i18n/en.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Delivery Attempt Failed",
|
|
45
45
|
"status_7": "Exception",
|
|
46
46
|
"status_8": "Info Received",
|
|
47
|
-
"packageName": "Package %s"
|
|
47
|
+
"packageName": "Package %s",
|
|
48
|
+
"descInfoConnection": "True while the adapter can reach the parcel.app API.",
|
|
49
|
+
"descStatusCode": "Numeric status from parcel.app (0-8); -1 means the value could not be interpreted.",
|
|
50
|
+
"descExtraInfo": "Additional detail the carrier needs, such as a postal code or e-mail address.",
|
|
51
|
+
"descDeliveryWindow": "Expected delivery time window; a window spanning several days carries the date on both sides.",
|
|
52
|
+
"descDeliveryEstimate": "Expected delivery in words - today, tomorrow or in a number of days.",
|
|
53
|
+
"descLastEvent": "Most recent tracking event reported by the carrier, with its date.",
|
|
54
|
+
"descLastUpdated": "When the tracking data last changed - not when the adapter last polled.",
|
|
55
|
+
"descActiveCount": "Number of packages that have not been delivered yet.",
|
|
56
|
+
"descTodayCount": "Number of packages expected to arrive today.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Combined window of all packages expected today - earliest start to latest end."
|
|
48
58
|
}
|
package/admin/i18n/es.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Intento de entrega fallido",
|
|
45
45
|
"status_7": "Excepción",
|
|
46
46
|
"status_8": "Registrado",
|
|
47
|
-
"packageName": "Paquete %s"
|
|
47
|
+
"packageName": "Paquete %s",
|
|
48
|
+
"descInfoConnection": "Verdadero mientras el adaptador pueda acceder a la API de parcel.app.",
|
|
49
|
+
"descStatusCode": "Estado numérico de parcel.app (0-8); -1 significa que el valor no se pudo interpretar.",
|
|
50
|
+
"descExtraInfo": "Dato adicional que necesita el transportista, por ejemplo un código postal o una dirección de correo.",
|
|
51
|
+
"descDeliveryWindow": "Ventana de entrega prevista; una ventana de varios días lleva la fecha a ambos lados.",
|
|
52
|
+
"descDeliveryEstimate": "Entrega prevista en palabras - hoy, mañana o dentro de unos días.",
|
|
53
|
+
"descLastEvent": "Evento de seguimiento más reciente comunicado por el transportista, con su fecha.",
|
|
54
|
+
"descLastUpdated": "Momento del último cambio de los datos de seguimiento - no de la última consulta.",
|
|
55
|
+
"descActiveCount": "Número de paquetes que aún no se han entregado.",
|
|
56
|
+
"descTodayCount": "Número de paquetes que se esperan hoy.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Ventana combinada de todos los paquetes esperados hoy - del inicio más temprano al final más tardío."
|
|
48
58
|
}
|
package/admin/i18n/fr.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Échec de la livraison",
|
|
45
45
|
"status_7": "Exception",
|
|
46
46
|
"status_8": "Enregistré",
|
|
47
|
-
"packageName": "Colis %s"
|
|
47
|
+
"packageName": "Colis %s",
|
|
48
|
+
"descInfoConnection": "Vrai tant que l'adaptateur parvient à joindre l'API parcel.app.",
|
|
49
|
+
"descStatusCode": "Statut numérique de parcel.app (0-8) ; -1 signifie que la valeur n'a pas pu être interprétée.",
|
|
50
|
+
"descExtraInfo": "Information complémentaire exigée par le transporteur, par exemple un code postal ou une adresse e-mail.",
|
|
51
|
+
"descDeliveryWindow": "Créneau de livraison prévu ; un créneau sur plusieurs jours porte la date de chaque côté.",
|
|
52
|
+
"descDeliveryEstimate": "Livraison prévue en toutes lettres - aujourd'hui, demain ou dans quelques jours.",
|
|
53
|
+
"descLastEvent": "Dernier événement de suivi communiqué par le transporteur, avec sa date.",
|
|
54
|
+
"descLastUpdated": "Moment du dernier changement des données de suivi - pas de la dernière interrogation.",
|
|
55
|
+
"descActiveCount": "Nombre de colis qui ne sont pas encore livrés.",
|
|
56
|
+
"descTodayCount": "Nombre de colis attendus aujourd'hui.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Créneau combiné de tous les colis attendus aujourd'hui - du début le plus tôt à la fin la plus tardive."
|
|
48
58
|
}
|
package/admin/i18n/it.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Consegna fallita",
|
|
45
45
|
"status_7": "Eccezione",
|
|
46
46
|
"status_8": "Registrato",
|
|
47
|
-
"packageName": "Pacco %s"
|
|
47
|
+
"packageName": "Pacco %s",
|
|
48
|
+
"descInfoConnection": "Vero finché l'adattatore riesce a raggiungere l'API di parcel.app.",
|
|
49
|
+
"descStatusCode": "Stato numerico di parcel.app (0-8); -1 significa che il valore non è stato interpretabile.",
|
|
50
|
+
"descExtraInfo": "Dato aggiuntivo richiesto dal corriere, ad esempio un codice postale o un indirizzo e-mail.",
|
|
51
|
+
"descDeliveryWindow": "Finestra di consegna prevista; una finestra su più giorni riporta la data su entrambi i lati.",
|
|
52
|
+
"descDeliveryEstimate": "Consegna prevista a parole - oggi, domani o fra alcuni giorni.",
|
|
53
|
+
"descLastEvent": "Evento di tracciamento più recente comunicato dal corriere, con la data.",
|
|
54
|
+
"descLastUpdated": "Momento dell'ultima variazione dei dati di tracciamento - non dell'ultima interrogazione.",
|
|
55
|
+
"descActiveCount": "Numero di pacchi non ancora consegnati.",
|
|
56
|
+
"descTodayCount": "Numero di pacchi attesi oggi.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Finestra combinata di tutti i pacchi attesi oggi - dall'inizio più precoce alla fine più tarda."
|
|
48
58
|
}
|
package/admin/i18n/nl.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Bezorgpoging mislukt",
|
|
45
45
|
"status_7": "Uitzondering",
|
|
46
46
|
"status_8": "Geregistreerd",
|
|
47
|
-
"packageName": "Pakket %s"
|
|
47
|
+
"packageName": "Pakket %s",
|
|
48
|
+
"descInfoConnection": "Waar zolang de adapter de parcel.app-API kan bereiken.",
|
|
49
|
+
"descStatusCode": "Numerieke status van parcel.app (0-8); -1 betekent dat de waarde niet kon worden geduid.",
|
|
50
|
+
"descExtraInfo": "Aanvullend gegeven dat de vervoerder nodig heeft, zoals postcode of e-mailadres.",
|
|
51
|
+
"descDeliveryWindow": "Verwacht bezorgvenster; een venster over meerdere dagen toont aan beide kanten de datum.",
|
|
52
|
+
"descDeliveryEstimate": "Verwachte bezorging in woorden - vandaag, morgen of over een aantal dagen.",
|
|
53
|
+
"descLastEvent": "Meest recente zendingsmelding van de vervoerder, met datum.",
|
|
54
|
+
"descLastUpdated": "Moment waarop de zendinggegevens voor het laatst zijn gewijzigd - niet de laatste opvraging.",
|
|
55
|
+
"descActiveCount": "Aantal pakketten dat nog niet is bezorgd.",
|
|
56
|
+
"descTodayCount": "Aantal pakketten dat vandaag wordt verwacht.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Gecombineerd venster van alle vandaag verwachte pakketten - vroegste start tot laatste einde."
|
|
48
58
|
}
|
package/admin/i18n/pl.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Nieudana próba doręczenia",
|
|
45
45
|
"status_7": "Wyjątek",
|
|
46
46
|
"status_8": "Zarejestrowane",
|
|
47
|
-
"packageName": "Paczka %s"
|
|
47
|
+
"packageName": "Paczka %s",
|
|
48
|
+
"descInfoConnection": "Prawda, dopóki adapter może połączyć się z API parcel.app.",
|
|
49
|
+
"descStatusCode": "Status liczbowy z parcel.app (0-8); -1 oznacza, że wartości nie dało się zinterpretować.",
|
|
50
|
+
"descExtraInfo": "Dodatkowa informacja wymagana przez przewoźnika, np. kod pocztowy lub adres e-mail.",
|
|
51
|
+
"descDeliveryWindow": "Przewidywane okno dostawy; okno obejmujące kilka dni zawiera datę po obu stronach.",
|
|
52
|
+
"descDeliveryEstimate": "Przewidywana dostawa słownie - dziś, jutro lub za kilka dni.",
|
|
53
|
+
"descLastEvent": "Najnowsze zdarzenie śledzenia zgłoszone przez przewoźnika, wraz z datą.",
|
|
54
|
+
"descLastUpdated": "Moment ostatniej zmiany danych śledzenia - nie ostatniego odpytania.",
|
|
55
|
+
"descActiveCount": "Liczba przesyłek, które nie zostały jeszcze doręczone.",
|
|
56
|
+
"descTodayCount": "Liczba przesyłek oczekiwanych dzisiaj.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Wspólne okno wszystkich przesyłek oczekiwanych dzisiaj - od najwcześniejszego początku do najpóźniejszego końca."
|
|
48
58
|
}
|
package/admin/i18n/pt.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Tentativa de entrega falhou",
|
|
45
45
|
"status_7": "Exceção",
|
|
46
46
|
"status_8": "Registado",
|
|
47
|
-
"packageName": "Encomenda %s"
|
|
47
|
+
"packageName": "Encomenda %s",
|
|
48
|
+
"descInfoConnection": "Verdadeiro enquanto o adaptador conseguir alcançar a API do parcel.app.",
|
|
49
|
+
"descStatusCode": "Estado numérico do parcel.app (0-8); -1 significa que o valor não pôde ser interpretado.",
|
|
50
|
+
"descExtraInfo": "Detalhe adicional exigido pela transportadora, como código postal ou endereço de e-mail.",
|
|
51
|
+
"descDeliveryWindow": "Janela de entrega prevista; uma janela que abrange vários dias mostra a data de ambos os lados.",
|
|
52
|
+
"descDeliveryEstimate": "Entrega prevista por extenso - hoje, amanhã ou dentro de alguns dias.",
|
|
53
|
+
"descLastEvent": "Evento de rastreio mais recente comunicado pela transportadora, com a data.",
|
|
54
|
+
"descLastUpdated": "Momento da última alteração dos dados de rastreio - não da última consulta.",
|
|
55
|
+
"descActiveCount": "Número de encomendas que ainda não foram entregues.",
|
|
56
|
+
"descTodayCount": "Número de encomendas previstas para hoje.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Janela combinada de todas as encomendas previstas para hoje - do início mais cedo ao fim mais tarde."
|
|
48
58
|
}
|
package/admin/i18n/ru.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Неудачная доставка",
|
|
45
45
|
"status_7": "Исключение",
|
|
46
46
|
"status_8": "Зарегистрировано",
|
|
47
|
-
"packageName": "Посылка %s"
|
|
47
|
+
"packageName": "Посылка %s",
|
|
48
|
+
"descInfoConnection": "Истина, пока адаптер может связаться с API parcel.app.",
|
|
49
|
+
"descStatusCode": "Числовой статус от parcel.app (0-8); -1 означает, что значение не удалось распознать.",
|
|
50
|
+
"descExtraInfo": "Дополнительные данные, нужные перевозчику, например почтовый индекс или адрес электронной почты.",
|
|
51
|
+
"descDeliveryWindow": "Ожидаемое временное окно доставки; окно, охватывающее несколько дней, содержит дату с обеих сторон.",
|
|
52
|
+
"descDeliveryEstimate": "Ожидаемая доставка словами - сегодня, завтра или через несколько дней.",
|
|
53
|
+
"descLastEvent": "Последнее событие отслеживания от перевозчика с датой.",
|
|
54
|
+
"descLastUpdated": "Момент последнего изменения данных отслеживания - не время последнего опроса.",
|
|
55
|
+
"descActiveCount": "Количество посылок, которые ещё не доставлены.",
|
|
56
|
+
"descTodayCount": "Количество посылок, ожидаемых сегодня.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Общее окно всех ожидаемых сегодня посылок - от самого раннего начала до самого позднего конца."
|
|
48
58
|
}
|
package/admin/i18n/uk.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "Невдала спроба доставки",
|
|
45
45
|
"status_7": "Виняток",
|
|
46
46
|
"status_8": "Зареєстровано",
|
|
47
|
-
"packageName": "Посилка %s"
|
|
47
|
+
"packageName": "Посилка %s",
|
|
48
|
+
"descInfoConnection": "Істина, доки адаптер може дістатися до API parcel.app.",
|
|
49
|
+
"descStatusCode": "Числовий статус від parcel.app (0-8); -1 означає, що значення не вдалося розпізнати.",
|
|
50
|
+
"descExtraInfo": "Додаткові дані, потрібні перевізникові, наприклад поштовий індекс або адреса електронної пошти.",
|
|
51
|
+
"descDeliveryWindow": "Очікуване вікно доставки; вікно, що охоплює кілька днів, містить дату з обох боків.",
|
|
52
|
+
"descDeliveryEstimate": "Очікувана доставка словами - сьогодні, завтра або за кілька днів.",
|
|
53
|
+
"descLastEvent": "Найновіша подія відстеження від перевізника, разом із датою.",
|
|
54
|
+
"descLastUpdated": "Момент останньої зміни даних відстеження - не останнього опитування.",
|
|
55
|
+
"descActiveCount": "Кількість посилок, які ще не доставлено.",
|
|
56
|
+
"descTodayCount": "Кількість посилок, що очікуються сьогодні.",
|
|
57
|
+
"descSummaryDeliveryWindow": "Спільне вікно всіх очікуваних сьогодні посилок - від найранішого початку до найпізнішого кінця."
|
|
48
58
|
}
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -44,5 +44,15 @@
|
|
|
44
44
|
"status_6": "派送失败",
|
|
45
45
|
"status_7": "异常",
|
|
46
46
|
"status_8": "已登记",
|
|
47
|
-
"packageName": "包裹 %s"
|
|
47
|
+
"packageName": "包裹 %s",
|
|
48
|
+
"descInfoConnection": "适配器能够连接 parcel.app API 时为真。",
|
|
49
|
+
"descStatusCode": "来自 parcel.app 的数字状态(0-8);-1 表示该值无法识别。",
|
|
50
|
+
"descExtraInfo": "承运商所需的附加信息,例如邮政编码或电子邮件地址。",
|
|
51
|
+
"descDeliveryWindow": "预计派送时间段;跨越多天的时间段会在两侧显示日期。",
|
|
52
|
+
"descDeliveryEstimate": "以文字表示的预计派送时间——今天、明天或若干天后。",
|
|
53
|
+
"descLastEvent": "承运商报告的最新跟踪事件及其日期。",
|
|
54
|
+
"descLastUpdated": "跟踪数据最后一次发生变化的时间——不是最后一次轮询的时间。",
|
|
55
|
+
"descActiveCount": "尚未派送的包裹数量。",
|
|
56
|
+
"descTodayCount": "预计今天送达的包裹数量。",
|
|
57
|
+
"descSummaryDeliveryWindow": "今天预计送达的所有包裹的合并时间段——最早开始到最晚结束。"
|
|
48
58
|
}
|
|
@@ -31,7 +31,7 @@ const DELETE_BATCH_SIZE = 25;
|
|
|
31
31
|
class StateManager {
|
|
32
32
|
adapter;
|
|
33
33
|
/**
|
|
34
|
-
* Cache of state IDs
|
|
34
|
+
* Cache of state IDs whose object has already been written this process.
|
|
35
35
|
* Skips repeat DB lookups on the hot path — each poll touches ~11 states
|
|
36
36
|
* per delivery, and most deliveries see no schema change between polls.
|
|
37
37
|
* On `cleanupDeliveries`, IDs of removed packages are dropped so a re-add
|
|
@@ -236,19 +236,40 @@ class StateManager {
|
|
|
236
236
|
const lastEvent = this.formatLastEvent(delivery);
|
|
237
237
|
const lastLocation = this.extractLastLocation(delivery);
|
|
238
238
|
const stateDefs = [
|
|
239
|
-
[`${devicePath}.carrier`, (0, import_i18n.tName)("carrier"), "string", "text", carrierName],
|
|
240
|
-
[`${devicePath}.status`, (0, import_i18n.tName)("status"), "string", "text", statusText],
|
|
241
|
-
[`${devicePath}.statusCode`, (0, import_i18n.tName)("statusCode"), "number", "value", statusCode],
|
|
242
|
-
[`${devicePath}.description`, (0, import_i18n.tName)("description"), "string", "text", description],
|
|
243
|
-
[`${devicePath}.trackingNumber`, (0, import_i18n.tName)("trackingNumber"), "string", "text", trackingNumber],
|
|
244
|
-
[`${devicePath}.extraInfo`, (0, import_i18n.tName)("extraInfo"), "string", "text", extraInfo],
|
|
245
|
-
[
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
[`${devicePath}.carrier`, (0, import_i18n.tName)("carrier"), "string", "text", carrierName, void 0],
|
|
240
|
+
[`${devicePath}.status`, (0, import_i18n.tName)("status"), "string", "text", statusText, void 0],
|
|
241
|
+
[`${devicePath}.statusCode`, (0, import_i18n.tName)("statusCode"), "number", "value", statusCode, (0, import_i18n.tName)("descStatusCode")],
|
|
242
|
+
[`${devicePath}.description`, (0, import_i18n.tName)("description"), "string", "text", description, void 0],
|
|
243
|
+
[`${devicePath}.trackingNumber`, (0, import_i18n.tName)("trackingNumber"), "string", "text", trackingNumber, void 0],
|
|
244
|
+
[`${devicePath}.extraInfo`, (0, import_i18n.tName)("extraInfo"), "string", "text", extraInfo, (0, import_i18n.tName)("descExtraInfo")],
|
|
245
|
+
[
|
|
246
|
+
`${devicePath}.deliveryWindow`,
|
|
247
|
+
(0, import_i18n.tName)("deliveryWindow"),
|
|
248
|
+
"string",
|
|
249
|
+
"text",
|
|
250
|
+
deliveryWindow,
|
|
251
|
+
(0, import_i18n.tName)("descDeliveryWindow")
|
|
252
|
+
],
|
|
253
|
+
[
|
|
254
|
+
`${devicePath}.deliveryEstimate`,
|
|
255
|
+
(0, import_i18n.tName)("deliveryEstimate"),
|
|
256
|
+
"string",
|
|
257
|
+
"text",
|
|
258
|
+
deliveryEstimate,
|
|
259
|
+
(0, import_i18n.tName)("descDeliveryEstimate")
|
|
260
|
+
],
|
|
261
|
+
[`${devicePath}.lastEvent`, (0, import_i18n.tName)("lastEvent"), "string", "text", lastEvent, (0, import_i18n.tName)("descLastEvent")],
|
|
262
|
+
[`${devicePath}.lastLocation`, (0, import_i18n.tName)("lastLocation"), "string", "text", lastLocation, void 0]
|
|
249
263
|
];
|
|
250
264
|
const changed = await Promise.all(
|
|
251
|
-
stateDefs.map(([id, name, type, role, val]) => this.createAndSet(id, name, type, role, val))
|
|
265
|
+
stateDefs.map(([id, name, type, role, val, desc]) => this.createAndSet(id, name, type, role, val, desc))
|
|
266
|
+
);
|
|
267
|
+
await this.ensureStateObject(
|
|
268
|
+
`${devicePath}.lastUpdated`,
|
|
269
|
+
(0, import_i18n.tName)("lastUpdated"),
|
|
270
|
+
"string",
|
|
271
|
+
"date",
|
|
272
|
+
(0, import_i18n.tName)("descLastUpdated")
|
|
252
273
|
);
|
|
253
274
|
if (changed.some(Boolean)) {
|
|
254
275
|
await this.createAndSet(
|
|
@@ -272,14 +293,29 @@ class StateManager {
|
|
|
272
293
|
`updateSummary: ${activeDeliveries.length} active, ${todayDeliveries.length} expected today`
|
|
273
294
|
);
|
|
274
295
|
await Promise.all([
|
|
275
|
-
this.createAndSet(
|
|
276
|
-
|
|
296
|
+
this.createAndSet(
|
|
297
|
+
"summary.activeCount",
|
|
298
|
+
(0, import_i18n.tName)("activeCount"),
|
|
299
|
+
"number",
|
|
300
|
+
"value",
|
|
301
|
+
activeDeliveries.length,
|
|
302
|
+
(0, import_i18n.tName)("descActiveCount")
|
|
303
|
+
),
|
|
304
|
+
this.createAndSet(
|
|
305
|
+
"summary.todayCount",
|
|
306
|
+
(0, import_i18n.tName)("todayCount"),
|
|
307
|
+
"number",
|
|
308
|
+
"value",
|
|
309
|
+
todayDeliveries.length,
|
|
310
|
+
(0, import_i18n.tName)("descTodayCount")
|
|
311
|
+
),
|
|
277
312
|
this.createAndSet(
|
|
278
313
|
"summary.deliveryWindow",
|
|
279
314
|
(0, import_i18n.tName)("summaryDeliveryWindow"),
|
|
280
315
|
"string",
|
|
281
316
|
"text",
|
|
282
|
-
this.calculateCombinedWindow(todayDeliveries)
|
|
317
|
+
this.calculateCombinedWindow(todayDeliveries),
|
|
318
|
+
(0, import_i18n.tName)("descSummaryDeliveryWindow")
|
|
283
319
|
)
|
|
284
320
|
]);
|
|
285
321
|
}
|
|
@@ -579,28 +615,64 @@ class StateManager {
|
|
|
579
615
|
return StateManager.formatWindow(minStart, maxEnd);
|
|
580
616
|
}
|
|
581
617
|
/**
|
|
582
|
-
* Create/
|
|
583
|
-
*
|
|
584
|
-
*
|
|
618
|
+
* Create/refresh a read-only state and set its value. Runs the object write
|
|
619
|
+
* once per ID per process (the cache skips the repeat round-trip on the hot
|
|
620
|
+
* path); only the value changes per poll.
|
|
621
|
+
*
|
|
622
|
+
* v0.11.0: `extendObject` instead of `setObjectNotExistsAsync`. The old call
|
|
623
|
+
* only ever touched an object that did not exist yet, so a changed name,
|
|
624
|
+
* description, role or type reached FRESH installs only — an existing tree
|
|
625
|
+
* kept the text it was created with, while manifest, linter, type check and
|
|
626
|
+
* the name gate all stayed green. Measured on a live install: the three
|
|
627
|
+
* permanent `summary.*` states still carried their plain-English pre-i18n
|
|
628
|
+
* names, while the per-package states looked correct only because packages
|
|
629
|
+
* are deleted and recreated. `extendObject` merges, so a user-set `custom`
|
|
630
|
+
* (history/logging) survives — the name deliberately does NOT: the adapter
|
|
631
|
+
* owns the names of its own states.
|
|
585
632
|
*
|
|
586
633
|
* @param id State ID relative to adapter namespace
|
|
587
634
|
* @param name Display name (translation object or plain string)
|
|
588
635
|
* @param type Value type
|
|
589
636
|
* @param role ioBroker role
|
|
590
637
|
* @param val Value to set
|
|
638
|
+
* @param desc Short explanation, or undefined where there is nothing to explain
|
|
591
639
|
* @returns true when the broker actually wrote the value (it differed or the
|
|
592
640
|
* state was new) — the DB-backed "did anything change" signal driving
|
|
593
641
|
* `lastUpdated` (v0.10.0, M5)
|
|
594
642
|
*/
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
643
|
+
/**
|
|
644
|
+
* Write a state's OBJECT once per process — name, description, type and role.
|
|
645
|
+
*
|
|
646
|
+
* Split out of {@link createAndSet} in v0.11.1 because `lastUpdated` writes its VALUE only
|
|
647
|
+
* when the tracking data actually changed. With the object write welded to the value write,
|
|
648
|
+
* its object was refreshed only on that same condition — so on a quiet installation, where no
|
|
649
|
+
* package moves for days, the datapoint kept the `common` it was created with forever. Measured
|
|
650
|
+
* on a live install right after the v0.11.0 upgrade: all four `lastUpdated` states still
|
|
651
|
+
* carried no description while their 24 siblings already had one. Same class as
|
|
652
|
+
* `reference_abgeleiteter_wert_nur_bei_aenderung` — a write path behind a condition looks alive
|
|
653
|
+
* because the condition is usually true, and an outdated name in the tree is what gives it away.
|
|
654
|
+
*
|
|
655
|
+
* The object write is unconditional now; only the VALUE keeps its condition.
|
|
656
|
+
*
|
|
657
|
+
* @param id State ID relative to adapter namespace
|
|
658
|
+
* @param name Display name (translation object or plain string)
|
|
659
|
+
* @param type Value type
|
|
660
|
+
* @param role ioBroker role
|
|
661
|
+
* @param desc Short explanation, or undefined where there is nothing to explain
|
|
662
|
+
*/
|
|
663
|
+
async ensureStateObject(id, name, type, role, desc) {
|
|
664
|
+
if (this.createdIds.has(id)) {
|
|
665
|
+
return;
|
|
603
666
|
}
|
|
667
|
+
const common = { name, type, role, read: true, write: false };
|
|
668
|
+
if (desc !== void 0) {
|
|
669
|
+
common.desc = desc;
|
|
670
|
+
}
|
|
671
|
+
await this.adapter.extendObject(id, { type: "state", common, native: {} });
|
|
672
|
+
this.createdIds.add(id);
|
|
673
|
+
}
|
|
674
|
+
async createAndSet(id, name, type, role, val, desc) {
|
|
675
|
+
await this.ensureStateObject(id, name, type, role, desc);
|
|
604
676
|
const result = await this.adapter.setStateChangedAsync(id, { val, ack: true });
|
|
605
677
|
return typeof result === "object" && result !== null && result.notChanged === false;
|
|
606
678
|
}
|