iobroker.tibberlink 6.2.2 → 7.0.0
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 +16 -14
- package/admin/i18n/de.json +1 -0
- package/admin/i18n/en.json +1 -0
- package/admin/i18n/es.json +1 -0
- package/admin/i18n/fr.json +1 -0
- package/admin/i18n/it.json +1 -0
- package/admin/i18n/nl.json +1 -0
- package/admin/i18n/pl.json +1 -0
- package/admin/i18n/pt.json +1 -0
- package/admin/i18n/ru.json +1 -0
- package/admin/i18n/uk.json +1 -0
- package/admin/i18n/zh-cn.json +1 -0
- package/admin/jsonConfig.json +1 -1
- package/build/lib/projectUtils.js +70 -8
- package/build/lib/projectUtils.js.map +1 -1
- package/build/lib/tibberAPICaller.js +105 -45
- package/build/lib/tibberAPICaller.js.map +1 -1
- package/build/lib/tibberCalculator.js +51 -51
- package/build/lib/tibberCalculator.js.map +1 -1
- package/build/lib/tibberCharts.js +4 -4
- package/build/lib/tibberCharts.js.map +1 -1
- package/build/lib/tibberLocal.js +3 -2
- package/build/lib/tibberLocal.js.map +1 -1
- package/build/main.js +4 -4
- package/build/main.js.map +1 -1
- package/io-package.json +15 -15
- package/package.json +18 -15
package/README.md
CHANGED
|
@@ -102,6 +102,10 @@ This method requires the "FlexCharts" adapter to be installed separately.
|
|
|
102
102
|
```
|
|
103
103
|
http://[YOUR IP of FLEXCHARTS]:8082/flexcharts/echarts.html?source=state&id=tibberlink.0.Homes.[TIBBER-HOME-ID].PricesTotal.jsonFlexCharts
|
|
104
104
|
```
|
|
105
|
+
- Starting with V0.7.0 FlexCharts supports automatic chart updates via SSE (Server Sent Events). To use this add `&sse` to the URL:
|
|
106
|
+
```
|
|
107
|
+
http://[YOUR IP of FLEXCHARTS]:8082/flexcharts/echarts.html?source=state&id=tibberlink.0.Homes.[TIBBER-HOME-ID].PricesTotal.jsonFlexCharts&sse=30
|
|
108
|
+
```
|
|
105
109
|
- Refer to the [FlexCharts adapter documentation](https://github.com/MyHomeMyData/ioBroker.flexcharts) for more details.
|
|
106
110
|
|
|
107
111
|
#### **JSON Template Usage**
|
|
@@ -170,6 +174,18 @@ If you enjoyed this project — or just feeling generous, consider buying me a b
|
|
|
170
174
|
Placeholder for the next version (at the beginning of the line):
|
|
171
175
|
### **WORK IN PROGRESS**
|
|
172
176
|
-->
|
|
177
|
+
### 7.0.0 (2026-06-04)
|
|
178
|
+
|
|
179
|
+
- (copilot) BREAKING: Adapter requires node.js >= 22 now
|
|
180
|
+
- (HombachC) Adapter requires admin >=7.6.20 now
|
|
181
|
+
- (grok) added current month consumption (#872)
|
|
182
|
+
- (HombachC) upgraded typescript to 6.x
|
|
183
|
+
- (HombachC) fixed vulnerability in axios
|
|
184
|
+
- (HombachC) fixed some type definitions
|
|
185
|
+
- (HombachC) extended FlexCharts docu
|
|
186
|
+
- (HombachC) updated dependencies
|
|
187
|
+
- (HombachC) updated projectUtils
|
|
188
|
+
|
|
173
189
|
### 6.2.2 (2026-04-13)
|
|
174
190
|
|
|
175
191
|
- (HombachC) fix vulnerability in axios
|
|
@@ -194,20 +210,6 @@ If you enjoyed this project — or just feeling generous, consider buying me a b
|
|
|
194
210
|
- (HombachC) fix LTF shifting for frames greater 24h
|
|
195
211
|
- (HombachC) update dependencies
|
|
196
212
|
|
|
197
|
-
### 6.1.0 (2026-01-03)
|
|
198
|
-
|
|
199
|
-
- (HombachC) BREAKING: change flexcharts x-axis type
|
|
200
|
-
- (HombachC) introduce FlexChart output for SBB channels second output
|
|
201
|
-
- (HombachC) introduce second name for FlexChart output of SBB channels
|
|
202
|
-
- (HombachC) introduce color for FlexChart output of calculator results
|
|
203
|
-
- (HombachC) introduce more statistics for yesterdays prices
|
|
204
|
-
- (HombachC) clean code for 15min time slots
|
|
205
|
-
- (HombachC) fix schema links (#822)
|
|
206
|
-
- (HombachC) fix CurrentPrice after midnight (#812)
|
|
207
|
-
- (HombachC) update cron
|
|
208
|
-
- (HombachC) year 2026 changes
|
|
209
|
-
- (HombachC) update dependencies
|
|
210
|
-
|
|
211
213
|
### Old Changes see [CHANGELOG OLD](CHANGELOG_OLD.md)
|
|
212
214
|
|
|
213
215
|
## License
|
package/admin/i18n/de.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Informationen zur Verwendung von ECharts finden Sie unter diesem Link",
|
|
5
5
|
"LBL_FlexChartsLink": "Informationen zur Verwendung von ioBroker FlexCharts finden Sie unter diesem Link",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "FlexGraph in der Zukunft abgeschnitten",
|
|
7
|
+
"LBL_FlexGraphJSON": "Konfigurieren Sie die Vorlage, um eine Datenzeichenfolge zu erstellen, die in Diagrammen verwendet werden soll – z. B. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "FlexGraph in der Vergangenheit abgeschnitten",
|
|
8
9
|
"LBL_GraphsTab": "Einstellungen für die Diagrammausgabe",
|
|
9
10
|
"LBL_HomesList": "Konfiguration von Pulse-Live-Datenströmen",
|
package/admin/i18n/en.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "For informations how to use ECharts see this link",
|
|
5
5
|
"LBL_FlexChartsLink": "For informations how to use ioBroker FlexCharts see this link",
|
|
6
6
|
"LBL_GraphsTab": "Graph Output Settings",
|
|
7
|
+
"LBL_FlexGraphJSON": "Configure template to create a data string to be used in graphs - e.g. ioBroker FlexCharts",
|
|
7
8
|
"LBL_HomesList": "Configuration of Pulse Live Data Streams",
|
|
8
9
|
"LBL_LocalPulseTab": "Local Pulse Poll Settings",
|
|
9
10
|
"LBL_PulseList": "Local Pulse to poll data from:",
|
package/admin/i18n/es.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Para obtener información sobre cómo utilizar ECharts, consulte este enlace",
|
|
5
5
|
"LBL_FlexChartsLink": "Para obtener información sobre cómo utilizar ioBroker FlexCharts, consulte este enlace",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph Horas futuras cortadas",
|
|
7
|
+
"LBL_FlexGraphJSON": "Configure la plantilla para crear una cadena de datos que se utilizará en gráficos, p. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "Flexgraph Horas pasadas cortadas",
|
|
8
9
|
"LBL_GraphsTab": "Configuración de salida de gráficos",
|
|
9
10
|
"LBL_HomesList": "Configuración de transmisiones de datos en vivo de Pulse",
|
package/admin/i18n/fr.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Pour plus d'informations sur l'utilisation d'ECharts, voir ce lien",
|
|
5
5
|
"LBL_FlexChartsLink": "Pour plus d'informations sur l'utilisation d'ioBroker FlexCharts, consultez ce lien",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph Future Hours Coupé",
|
|
7
|
+
"LBL_FlexGraphJSON": "Configurez le modèle pour créer une chaîne de données à utiliser dans les graphiques - par ex. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "Flexgraph passés passés coupés",
|
|
8
9
|
"LBL_GraphsTab": "Paramètres de sortie graphique",
|
|
9
10
|
"LBL_HomesList": "Configuration des flux de données Pulse Live",
|
package/admin/i18n/it.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Per informazioni su come utilizzare ECharts vedere questo collegamento",
|
|
5
5
|
"LBL_FlexChartsLink": "Per informazioni su come utilizzare ioBroker FlexCharts vedere questo collegamento",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph Hours Future Tagliate",
|
|
7
|
+
"LBL_FlexGraphJSON": "Configura il modello per creare una stringa di dati da utilizzare nei grafici, ad es. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "Flexgraph Ore passate tagliate fuori",
|
|
8
9
|
"LBL_GraphsTab": "Impostazioni di output del grafico",
|
|
9
10
|
"LBL_HomesList": "Configurazione dei flussi di dati in tempo reale",
|
package/admin/i18n/nl.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Voor informatie over het gebruik van ECharts, zie deze link",
|
|
5
5
|
"LBL_FlexChartsLink": "Zie deze link voor informatie over het gebruik van ioBroker FlexCharts",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "FlexGraph toekomstige uren afgesneden",
|
|
7
|
+
"LBL_FlexGraphJSON": "Configureer de sjabloon om een gegevensreeks te maken die in grafieken kan worden gebruikt - b.v. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "Flexgraph afgelopen uren afgesneden",
|
|
8
9
|
"LBL_GraphsTab": "Instellingen voor grafiekuitvoer",
|
|
9
10
|
"LBL_HomesList": "Configuratie van Pulse Live-gegevensstromen",
|
package/admin/i18n/pl.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Aby uzyskać informacje na temat korzystania z ECharts, zobacz ten link",
|
|
5
5
|
"LBL_FlexChartsLink": "Aby uzyskać informacje na temat korzystania z ioBroker FlexCharts, zobacz ten link",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph Przyszłe godziny odcięte",
|
|
7
|
+
"LBL_FlexGraphJSON": "Skonfiguruj szablon, aby utworzyć ciąg danych do wykorzystania na wykresach - np. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "FlexGraph w przeszłości odcięty",
|
|
8
9
|
"LBL_GraphsTab": "Ustawienia wyjściowe wykresu",
|
|
9
10
|
"LBL_HomesList": "Konfiguracja impulsowych strumieni danych w czasie rzeczywistym",
|
package/admin/i18n/pt.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Para informações sobre como usar ECharts veja este link",
|
|
5
5
|
"LBL_FlexChartsLink": "Para informações sobre como usar o ioBroker FlexCharts veja este link",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph Horas futuras cortadas",
|
|
7
|
+
"LBL_FlexGraphJSON": "Configure o modelo para criar uma sequência de dados a ser usada em gráficos - por exemplo. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "FLEXGRAPH HORAS PASSAS cortadas",
|
|
8
9
|
"LBL_GraphsTab": "Configurações de saída gráfica",
|
|
9
10
|
"LBL_HomesList": "Configuração de fluxos de dados ao vivo do Pulse",
|
package/admin/i18n/ru.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Информацию о том, как использовать ECharts, можно найти по этой ссылке.",
|
|
5
5
|
"LBL_FlexChartsLink": "Информацию о том, как использовать ioBroker FlexCharts, можно найти по этой ссылке.",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph в будущие часы отключены",
|
|
7
|
+
"LBL_FlexGraphJSON": "Настройте шаблон для создания строки данных, которая будет использоваться в графиках - например. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "Flexgraph в прошлые часы отключено",
|
|
8
9
|
"LBL_GraphsTab": "Настройки вывода графика",
|
|
9
10
|
"LBL_HomesList": "Конфигурация потоков импульсных данных в реальном времени",
|
package/admin/i18n/uk.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "Щоб отримати інформацію про використання ECharts, перегляньте це посилання",
|
|
5
5
|
"LBL_FlexChartsLink": "Щоб отримати інформацію про використання ioBroker FlexCharts, перегляньте це посилання",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph майбутні години відрізані",
|
|
7
|
+
"LBL_FlexGraphJSON": "Налаштуйте шаблон для створення рядка даних для використання в графіках, наприклад. ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "Flexgraph минулі години відрізані",
|
|
8
9
|
"LBL_GraphsTab": "Параметри виведення графіка",
|
|
9
10
|
"LBL_HomesList": "Конфігурація Pulse Live Data Streams",
|
package/admin/i18n/zh-cn.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"LBL_EChartsLink": "有关如何使用 ECharts 的信息,请参阅此链接",
|
|
5
5
|
"LBL_FlexChartsLink": "有关如何使用 ioBroker FlexCharts 的信息,请参阅此链接",
|
|
6
6
|
"LBL_FlexGraphFutureCutOff": "Flexgraph Future Birs切断",
|
|
7
|
+
"LBL_FlexGraphJSON": "配置模板以创建要在图表中使用的数据字符串 - 例如ioBroker FlexCharts",
|
|
7
8
|
"LBL_FlexGraphPastCutOff": "弹性过去的时间切断了",
|
|
8
9
|
"LBL_GraphsTab": "图形输出设置",
|
|
9
10
|
"LBL_HomesList": "脉冲实时数据流的配置",
|
package/admin/jsonConfig.json
CHANGED
|
@@ -929,7 +929,7 @@
|
|
|
929
929
|
"items": {
|
|
930
930
|
"FlexGraphJSON": {
|
|
931
931
|
"type": "jsonEditor",
|
|
932
|
-
"label": "
|
|
932
|
+
"label": "LBL_FlexGraphJSON",
|
|
933
933
|
"validateJson": false,
|
|
934
934
|
"json5": true,
|
|
935
935
|
"newLine": true,
|
|
@@ -102,14 +102,7 @@ class ProjectUtils {
|
|
|
102
102
|
}
|
|
103
103
|
isLikeEmpty(inputVar) {
|
|
104
104
|
if (typeof inputVar !== "undefined" && inputVar !== null) {
|
|
105
|
-
|
|
106
|
-
sTemp = sTemp.replace(/\s+/g, "");
|
|
107
|
-
sTemp = sTemp.replace(/"+/g, "");
|
|
108
|
-
sTemp = sTemp.replace(/'+/g, "");
|
|
109
|
-
sTemp = sTemp.replace(/\[+/g, "");
|
|
110
|
-
sTemp = sTemp.replace(/\]+/g, "");
|
|
111
|
-
sTemp = sTemp.replace(/\{+/g, "");
|
|
112
|
-
sTemp = sTemp.replace(/\}+/g, "");
|
|
105
|
+
const sTemp = JSON.stringify(inputVar).replace(/[\s"'[\]{}]/g, "");
|
|
113
106
|
if (sTemp !== "") {
|
|
114
107
|
return false;
|
|
115
108
|
}
|
|
@@ -149,6 +142,9 @@ class ProjectUtils {
|
|
|
149
142
|
...((max ?? undefined) ? { max } : {}),
|
|
150
143
|
...((step ?? undefined) ? { step } : {}),
|
|
151
144
|
};
|
|
145
|
+
if (unit != null) {
|
|
146
|
+
commonObj.unit = unit;
|
|
147
|
+
}
|
|
152
148
|
await (forceMode
|
|
153
149
|
? this.adapter.setObject(stateName, { type: "state", common: commonObj, native: {} })
|
|
154
150
|
: this.adapter.setObjectNotExistsAsync(stateName, { type: "state", common: commonObj, native: {} }));
|
|
@@ -175,6 +171,72 @@ class ProjectUtils {
|
|
|
175
171
|
}
|
|
176
172
|
}
|
|
177
173
|
}
|
|
174
|
+
async checkAndSetFolder(folderObjectName, name, icon = "", forceMode = false) {
|
|
175
|
+
const commonObj = {
|
|
176
|
+
type: "meta.folder",
|
|
177
|
+
name: name ?? folderObjectName.split(".").pop() ?? folderObjectName,
|
|
178
|
+
desc: "",
|
|
179
|
+
};
|
|
180
|
+
if (icon) {
|
|
181
|
+
commonObj.icon = icon;
|
|
182
|
+
}
|
|
183
|
+
await (forceMode
|
|
184
|
+
? this.adapter.setObject(folderObjectName, {
|
|
185
|
+
type: "folder",
|
|
186
|
+
common: commonObj,
|
|
187
|
+
native: {},
|
|
188
|
+
})
|
|
189
|
+
: this.adapter.setObjectNotExistsAsync(folderObjectName, {
|
|
190
|
+
type: "folder",
|
|
191
|
+
common: commonObj,
|
|
192
|
+
native: {},
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
async checkAndSetDevice(deviceObjectName, name, onlineId = "", icon = "", forceMode = false) {
|
|
196
|
+
const commonObj = {
|
|
197
|
+
name: name ?? deviceObjectName.split(".").pop() ?? deviceObjectName,
|
|
198
|
+
desc: "",
|
|
199
|
+
};
|
|
200
|
+
if (onlineId) {
|
|
201
|
+
commonObj.statusStates = {
|
|
202
|
+
onlineId,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (icon) {
|
|
206
|
+
commonObj.icon = icon;
|
|
207
|
+
}
|
|
208
|
+
await (forceMode
|
|
209
|
+
? this.adapter.setObject(deviceObjectName, {
|
|
210
|
+
type: "device",
|
|
211
|
+
common: commonObj,
|
|
212
|
+
native: {},
|
|
213
|
+
})
|
|
214
|
+
: this.adapter.setObjectNotExistsAsync(deviceObjectName, {
|
|
215
|
+
type: "device",
|
|
216
|
+
common: commonObj,
|
|
217
|
+
native: {},
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
async checkAndSetChannel(channelObjectName, name, icon = "", forceMode = false) {
|
|
221
|
+
const commonObj = {
|
|
222
|
+
name: name ?? channelObjectName.split(".").pop() ?? channelObjectName,
|
|
223
|
+
desc: "",
|
|
224
|
+
};
|
|
225
|
+
if (icon) {
|
|
226
|
+
commonObj.icon = icon;
|
|
227
|
+
}
|
|
228
|
+
await (forceMode
|
|
229
|
+
? this.adapter.setObject(channelObjectName, {
|
|
230
|
+
type: "channel",
|
|
231
|
+
common: commonObj,
|
|
232
|
+
native: {},
|
|
233
|
+
})
|
|
234
|
+
: this.adapter.setObjectNotExistsAsync(channelObjectName, {
|
|
235
|
+
type: "channel",
|
|
236
|
+
common: commonObj,
|
|
237
|
+
native: {},
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
178
240
|
generateErrorMessage(error, context) {
|
|
179
241
|
let errorMessages = "";
|
|
180
242
|
if (error.errors && Array.isArray(error.errors)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projectUtils.js","sourceRoot":"","sources":["../../src/lib/projectUtils.ts"],"names":[],"mappings":";;;AAoBA,wDAcC;AAhCD,IAAY,UAWX;AAXD,WAAY,UAAU;IACrB,mDAAY,CAAA;IACZ,iEAAmB,CAAA;IACnB,+DAAkB,CAAA;IAClB,yDAAe,CAAA;IACf,uEAAsB,CAAA;IACtB,qEAAqB,CAAA;IACrB,uEAAsB,CAAA;IACtB,+DAAkB,CAAA;IAClB,qEAAqB,CAAA;IACrB,8EAA0B,CAAA;AAC3B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IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,EAAE;aACV,CAAC,CAAC,CAAC;IACP,CAAC;IASM,oBAAoB,CAAC,KAAU,EAAE,OAAe;QACtD,IAAI,aAAa,GAAG,EAAE,CAAC;QAEvB,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAEjD,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBAChC,IAAI,aAAa,EAAE,CAAC;oBACnB,aAAa,IAAI,IAAI,CAAC;gBACvB,CAAC;gBACD,aAAa,IAAI,GAAG,CAAC,OAAO,CAAC;YAC9B,CAAC;QACF,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAC1B,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC;QAC/B,CAAC;aAAM,CAAC;YACP,aAAa,GAAG,eAAe,CAAC;QACjC,CAAC;QAED,OAAO,UAAU,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,UAAU,IAAI,gBAAgB,uBAAuB,OAAO,OAAO,aAAa,EAAE,CAAC;IAClI,CAAC;CACD;AAzYD,oCAyYC"}
|
|
@@ -19,28 +19,35 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
19
19
|
this.adapter.log.debug(`Got homes from tibber api: ${JSON.stringify(Homes)}`);
|
|
20
20
|
const homeInfoList = [];
|
|
21
21
|
for (const currentHome of Homes) {
|
|
22
|
+
if (!currentHome.id) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
22
25
|
homeInfoList.push({
|
|
23
26
|
ID: currentHome.id,
|
|
24
|
-
NameInApp: currentHome.appNickname
|
|
25
|
-
RealTime: currentHome.features
|
|
27
|
+
NameInApp: currentHome.appNickname ?? `not set`,
|
|
28
|
+
RealTime: currentHome.features?.realTimeConsumptionEnabled ?? false,
|
|
26
29
|
FeedActive: false,
|
|
27
30
|
PriceDataPollActive: true,
|
|
28
31
|
});
|
|
29
32
|
this.tibberConfig.homeId = currentHome.id;
|
|
30
33
|
const basePath = `Homes.${currentHome.id}`;
|
|
31
34
|
void this.checkAndSetValue(`${basePath}.General.Id`, currentHome.id, "ID of your home");
|
|
32
|
-
void this.checkAndSetValue(`${basePath}.General.Timezone`, currentHome.timeZone
|
|
33
|
-
void this.checkAndSetValue(`${basePath}.General.NameInApp`, currentHome.appNickname
|
|
34
|
-
void this.checkAndSetValue(`${basePath}.General.AvatarInApp`, currentHome.appAvatar
|
|
35
|
-
void this.checkAndSetValue(`${basePath}.General.Type`, currentHome.type
|
|
36
|
-
void this.checkAndSetValue(`${basePath}.General.PrimaryHeatingSource`, currentHome.primaryHeatingSource
|
|
37
|
-
void this.checkAndSetValueNumber(`${basePath}.General.Size`, currentHome.size, "The size of the home in square meters");
|
|
38
|
-
void this.checkAndSetValueNumber(`${basePath}.General.NumberOfResidents`, currentHome.numberOfResidents, `
|
|
39
|
-
void this.checkAndSetValueNumber(`${basePath}.General.MainFuseSize`, currentHome.mainFuseSize, "The main fuse size");
|
|
40
|
-
void this.checkAndSetValueBoolean(`${basePath}.General.HasVentilationSystem`, currentHome.hasVentilationSystem, `Whether the home has a ventilation system`);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
void this.checkAndSetValue(`${basePath}.General.Timezone`, currentHome.timeZone ?? `not set`, "The time zone the home resides in");
|
|
36
|
+
void this.checkAndSetValue(`${basePath}.General.NameInApp`, currentHome.appNickname ?? `not set`, "The nickname given to the home");
|
|
37
|
+
void this.checkAndSetValue(`${basePath}.General.AvatarInApp`, currentHome.appAvatar ?? `not set`, "The chosen app avatar for the home");
|
|
38
|
+
void this.checkAndSetValue(`${basePath}.General.Type`, currentHome.type ?? `not set`, "The type of home.");
|
|
39
|
+
void this.checkAndSetValue(`${basePath}.General.PrimaryHeatingSource`, currentHome.primaryHeatingSource ?? `not set`, `The primary form of heating in the home`);
|
|
40
|
+
void this.checkAndSetValueNumber(`${basePath}.General.Size`, currentHome.size ?? 0, "The size of the home in square meters");
|
|
41
|
+
void this.checkAndSetValueNumber(`${basePath}.General.NumberOfResidents`, currentHome.numberOfResidents ?? 0, `The number of people living in the home`);
|
|
42
|
+
void this.checkAndSetValueNumber(`${basePath}.General.MainFuseSize`, currentHome.mainFuseSize ?? 0, "The main fuse size");
|
|
43
|
+
void this.checkAndSetValueBoolean(`${basePath}.General.HasVentilationSystem`, currentHome.hasVentilationSystem ?? false, `Whether the home has a ventilation system`);
|
|
44
|
+
if (currentHome.address) {
|
|
45
|
+
this.fetchAddress(currentHome.id, "Address", currentHome.address);
|
|
46
|
+
}
|
|
47
|
+
if (currentHome.owner) {
|
|
48
|
+
this.fetchLegalEntity(currentHome.id, "Owner", currentHome.owner);
|
|
49
|
+
}
|
|
50
|
+
void this.checkAndSetValueBoolean(`${basePath}.Features.RealTimeConsumptionEnabled`, currentHome.features?.realTimeConsumptionEnabled ?? false, `Whether Tibber server will send consumption data by API`);
|
|
44
51
|
}
|
|
45
52
|
return homeInfoList;
|
|
46
53
|
}
|
|
@@ -78,7 +85,7 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
78
85
|
return false;
|
|
79
86
|
}
|
|
80
87
|
const currentPrice = pricesToday.find(p => {
|
|
81
|
-
const start = new Date(p.startsAt);
|
|
88
|
+
const start = new Date(p.startsAt ?? ``);
|
|
82
89
|
const end = (0, date_fns_1.addMinutes)(start, 15);
|
|
83
90
|
return now >= start && now < end;
|
|
84
91
|
});
|
|
@@ -123,13 +130,13 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
123
130
|
await this.checkAndSetValue(`Homes.${homeId}.PricesToday.json`, JSON.stringify(newPricesToday), `The prices today as json`);
|
|
124
131
|
await this.checkAndSetValue(`Homes.${homeId}.PricesTomorrow.json`, JSON.stringify([]), `The prices tomorrow as json`);
|
|
125
132
|
if (Array.isArray(currentPricesToday) && currentPricesToday.length > 0) {
|
|
126
|
-
await this.checkAndSetValue(`Homes.${homeId}.PricesYesterday.jsonBYpriceASC`, JSON.stringify([...currentPricesToday].sort((a, b) => a.total - b.total)), `prices yesterday sorted by cost ascending as json`);
|
|
133
|
+
await this.checkAndSetValue(`Homes.${homeId}.PricesYesterday.jsonBYpriceASC`, JSON.stringify([...currentPricesToday].sort((a, b) => (a.total ?? 0) - (b.total ?? 0))), `prices yesterday sorted by cost ascending as json`);
|
|
127
134
|
this.fetchPriceAverage(homeId, `PricesYesterday.average`, currentPricesToday);
|
|
128
135
|
this.fetchPriceMaximum(homeId, `PricesYesterday.maximum`, currentPricesToday);
|
|
129
136
|
this.fetchPriceMinimum(homeId, `PricesYesterday.minimum`, currentPricesToday);
|
|
130
137
|
}
|
|
131
138
|
if (Array.isArray(newPricesToday) && newPricesToday.length > 0) {
|
|
132
|
-
await this.checkAndSetValue(`Homes.${homeId}.PricesToday.jsonBYpriceASC`, JSON.stringify([...newPricesToday].sort((a, b) => a.total - b.total)), `prices today sorted by cost ascending as json`);
|
|
139
|
+
await this.checkAndSetValue(`Homes.${homeId}.PricesToday.jsonBYpriceASC`, JSON.stringify([...newPricesToday].sort((a, b) => (a.total ?? 0) - (b.total ?? 0))), `prices today sorted by cost ascending as json`);
|
|
133
140
|
this.fetchPriceAverage(homeId, `PricesToday.average`, newPricesToday);
|
|
134
141
|
await this.fetchPriceRemainingAverage(homeId, `PricesToday.averageRemaining`, newPricesToday);
|
|
135
142
|
this.fetchPriceMaximum(homeId, `PricesToday.maximum`, newPricesToday);
|
|
@@ -194,7 +201,7 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
194
201
|
for (let i = 0; i < pricesToday.length; i++) {
|
|
195
202
|
await this.fetchPrice(homeId, `PricesToday.${i}`, pricesToday[i]);
|
|
196
203
|
}
|
|
197
|
-
void this.checkAndSetValue(`Homes.${homeId}.PricesToday.jsonBYpriceASC`, JSON.stringify(pricesToday.sort((a, b) => a.total - b.total)), `prices sorted by cost ascending as json`);
|
|
204
|
+
void this.checkAndSetValue(`Homes.${homeId}.PricesToday.jsonBYpriceASC`, JSON.stringify(pricesToday.sort((a, b) => (a.total ?? 0) - (b.total ?? 0))), `prices sorted by cost ascending as json`);
|
|
198
205
|
if (pricesToday[2]?.startsAt) {
|
|
199
206
|
const newDate = new Date(pricesToday[2].startsAt);
|
|
200
207
|
if (newDate >= today) {
|
|
@@ -268,8 +275,8 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
268
275
|
this.fetchPriceAverage(homeId, `PricesTomorrow.average`, pricesTomorrow);
|
|
269
276
|
this.fetchPriceMaximum(homeId, `PricesTomorrow.maximum`, pricesTomorrow);
|
|
270
277
|
this.fetchPriceMinimum(homeId, `PricesTomorrow.minimum`, pricesTomorrow);
|
|
271
|
-
void this.checkAndSetValue(`Homes.${homeId}.PricesTomorrow.jsonBYpriceASC`, JSON.stringify(pricesTomorrow.sort((a, b) => a.total - b.total)), `prices sorted by cost ascending as json`);
|
|
272
|
-
exDate = new Date(pricesTomorrow[2].startsAt);
|
|
278
|
+
void this.checkAndSetValue(`Homes.${homeId}.PricesTomorrow.jsonBYpriceASC`, JSON.stringify(pricesTomorrow.sort((a, b) => (a.total ?? 0) - (b.total ?? 0))), `prices sorted by cost ascending as json`);
|
|
279
|
+
exDate = new Date(pricesTomorrow[2].startsAt ?? ``);
|
|
273
280
|
if (exDate && exDate >= morgen) {
|
|
274
281
|
return true;
|
|
275
282
|
}
|
|
@@ -300,16 +307,45 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
300
307
|
}
|
|
301
308
|
const homeID = home.homeID;
|
|
302
309
|
const resolutions = [
|
|
303
|
-
{
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
310
|
+
{
|
|
311
|
+
type: EnergyResolution_js_1.EnergyResolution.HOURLY,
|
|
312
|
+
state: `jsonHourly`,
|
|
313
|
+
numCons: home.numberConsHourly,
|
|
314
|
+
description: `hour`,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
type: EnergyResolution_js_1.EnergyResolution.DAILY,
|
|
318
|
+
state: `jsonDaily`,
|
|
319
|
+
numCons: home.numberConsDaily,
|
|
320
|
+
description: `day`,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
type: EnergyResolution_js_1.EnergyResolution.WEEKLY,
|
|
324
|
+
state: `jsonWeekly`,
|
|
325
|
+
numCons: home.numberConsWeekly,
|
|
326
|
+
description: `week`,
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
type: EnergyResolution_js_1.EnergyResolution.MONTHLY,
|
|
330
|
+
state: `jsonMonthly`,
|
|
331
|
+
numCons: home.numberConsMonthly,
|
|
332
|
+
description: `month`,
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
type: EnergyResolution_js_1.EnergyResolution.ANNUAL,
|
|
336
|
+
state: `jsonAnnual`,
|
|
337
|
+
numCons: home.numberConsAnnual,
|
|
338
|
+
description: `year`,
|
|
339
|
+
},
|
|
308
340
|
];
|
|
309
341
|
for (const { type, state, numCons, description } of resolutions) {
|
|
310
342
|
if (numCons && numCons > 0) {
|
|
311
343
|
const consumption = await this.tibberQuery.getConsumption(type, numCons, homeID);
|
|
312
344
|
void this.checkAndSetValue(`Homes.${homeID}.Consumption.${state}`, JSON.stringify(consumption), `Historical consumption last ${description}s as json)`, `json`);
|
|
345
|
+
if (description == `day`) {
|
|
346
|
+
const currentMonthConsumption = this.getCurrentMonthConsumption(consumption);
|
|
347
|
+
await this.checkAndSetValueNumber(`Homes.${homeID}.Consumption.currentMonthConsumption`, currentMonthConsumption ?? 0, `Total consumption for the current month`, `kWh`, `value.energy.consumed`);
|
|
348
|
+
}
|
|
313
349
|
}
|
|
314
350
|
else {
|
|
315
351
|
void this.checkAndSetValue(`Homes.${homeID}.Consumption.${state}`, `[]`);
|
|
@@ -322,9 +358,33 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
322
358
|
this.adapter.log.error(this.generateErrorMessage(error, `pull of consumption data`));
|
|
323
359
|
}
|
|
324
360
|
}
|
|
361
|
+
getCurrentMonthConsumption(consumption) {
|
|
362
|
+
if (!consumption || consumption.length === 0) {
|
|
363
|
+
return undefined;
|
|
364
|
+
}
|
|
365
|
+
const now = new Date();
|
|
366
|
+
let sum = 0;
|
|
367
|
+
for (const entry of consumption) {
|
|
368
|
+
const dateStr = entry.from ?? entry.to;
|
|
369
|
+
if (!dateStr) {
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
const entryDate = (0, date_fns_1.parseISO)(dateStr);
|
|
373
|
+
if (!(0, date_fns_1.isValid)(entryDate)) {
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
if ((0, date_fns_1.isSameMonth)(entryDate, now)) {
|
|
377
|
+
const value = entry.consumption;
|
|
378
|
+
if (typeof value === "number" && isFinite(value) && value >= 0) {
|
|
379
|
+
sum += value;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return sum > 0 ? sum : undefined;
|
|
384
|
+
}
|
|
325
385
|
async fetchPrice(homeId, objectDestination, price) {
|
|
326
386
|
const basePath = `Homes.${homeId}.${objectDestination}`;
|
|
327
|
-
const date = new Date(price.startsAt);
|
|
387
|
+
const date = new Date(price.startsAt ?? ``);
|
|
328
388
|
const timeLabel = `${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
|
|
329
389
|
await this.adapter.setObject(basePath, {
|
|
330
390
|
type: "folder",
|
|
@@ -333,11 +393,11 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
333
393
|
},
|
|
334
394
|
native: {},
|
|
335
395
|
});
|
|
336
|
-
await this.checkAndSetValueNumber(`${basePath}.total`, price.total, `Total price (energy + taxes)`);
|
|
337
|
-
void this.checkAndSetValueNumber(`${basePath}.energy`, price.energy, `Spotmarket energy price`);
|
|
338
|
-
void this.checkAndSetValueNumber(`${basePath}.tax`, price.tax, `Tax part of the price (energy, tax, VAT...)`);
|
|
339
|
-
void this.checkAndSetValue(`${basePath}.startsAt`, price.startsAt
|
|
340
|
-
void this.checkAndSetValue(`${basePath}.level`, price.level
|
|
396
|
+
await this.checkAndSetValueNumber(`${basePath}.total`, price.total ?? 0, `Total price (energy + taxes)`);
|
|
397
|
+
void this.checkAndSetValueNumber(`${basePath}.energy`, price.energy ?? 0, `Spotmarket energy price`);
|
|
398
|
+
void this.checkAndSetValueNumber(`${basePath}.tax`, price.tax ?? 0, `Tax part of the price (energy, tax, VAT...)`);
|
|
399
|
+
void this.checkAndSetValue(`${basePath}.startsAt`, price.startsAt ?? `---`, `Start time of the price`);
|
|
400
|
+
void this.checkAndSetValue(`${basePath}.level`, price.level ?? `---`, `Price level compared to recent price values`);
|
|
341
401
|
}
|
|
342
402
|
fetchPriceAverage(homeId, objectDestination, price) {
|
|
343
403
|
if (!price || price.length === 0) {
|
|
@@ -355,7 +415,7 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
355
415
|
}
|
|
356
416
|
const now = new Date();
|
|
357
417
|
const filteredPrices = price.filter(item => {
|
|
358
|
-
const start = new Date(item.startsAt);
|
|
418
|
+
const start = new Date(item.startsAt ?? ``);
|
|
359
419
|
return start >= now;
|
|
360
420
|
});
|
|
361
421
|
if (!filteredPrices.length) {
|
|
@@ -367,7 +427,7 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
367
427
|
const taxSum = filteredPrices.reduce((sum, item) => sum + (item.tax ?? 0), 0);
|
|
368
428
|
const count = filteredPrices.length;
|
|
369
429
|
const basePath = `Homes.${homeId}.${objectDestination}`;
|
|
370
|
-
const date = new Date(filteredPrices[0].startsAt);
|
|
430
|
+
const date = new Date(filteredPrices[0].startsAt ?? ``);
|
|
371
431
|
const timeLabel = `${date.getHours().toString().padStart(2, "0")}:${date.getMinutes().toString().padStart(2, "0")}`;
|
|
372
432
|
await this.adapter.setObject(basePath, {
|
|
373
433
|
type: "folder",
|
|
@@ -384,25 +444,25 @@ class TibberAPICaller extends projectUtils_js_1.ProjectUtils {
|
|
|
384
444
|
if (!price || price.length === 0) {
|
|
385
445
|
return;
|
|
386
446
|
}
|
|
387
|
-
const maxEntry = price.reduce((max, current) => (current.total > max.total ? current : max));
|
|
447
|
+
const maxEntry = price.reduce((max, current) => ((current.total ?? 0) > (max.total ?? 0) ? current : max));
|
|
388
448
|
const basePath = `Homes.${homeId}.${objectDestination}`;
|
|
389
|
-
void this.checkAndSetValueNumber(`${basePath}.total`, Math.round(1000 * maxEntry.total) / 1000, `Todays total price maximum`);
|
|
390
|
-
void this.checkAndSetValueNumber(`${basePath}.energy`, Math.round(1000 * maxEntry.energy) / 1000, `Todays spotmarket price at total price maximum`);
|
|
391
|
-
void this.checkAndSetValueNumber(`${basePath}.tax`, Math.round(1000 * maxEntry.tax) / 1000, `Todays tax price at total price maximum`);
|
|
392
|
-
void this.checkAndSetValue(`${basePath}.level`, maxEntry.level
|
|
393
|
-
void this.checkAndSetValue(`${basePath}.startsAt`, maxEntry.startsAt
|
|
449
|
+
void this.checkAndSetValueNumber(`${basePath}.total`, Math.round(1000 * (maxEntry.total ?? 0)) / 1000, `Todays total price maximum`);
|
|
450
|
+
void this.checkAndSetValueNumber(`${basePath}.energy`, Math.round(1000 * (maxEntry.energy ?? 0)) / 1000, `Todays spotmarket price at total price maximum`);
|
|
451
|
+
void this.checkAndSetValueNumber(`${basePath}.tax`, Math.round(1000 * (maxEntry.tax ?? 0)) / 1000, `Todays tax price at total price maximum`);
|
|
452
|
+
void this.checkAndSetValue(`${basePath}.level`, maxEntry.level ?? `---`, `Price level compared to recent price values`);
|
|
453
|
+
void this.checkAndSetValue(`${basePath}.startsAt`, maxEntry.startsAt ?? `---`, `Start time of the price maximum`);
|
|
394
454
|
}
|
|
395
455
|
fetchPriceMinimum(homeId, objectDestination, price) {
|
|
396
456
|
if (!price || price.length === 0) {
|
|
397
457
|
return;
|
|
398
458
|
}
|
|
399
|
-
const minEntry = price.reduce((min, current) => (current.total < min.total ? current : min));
|
|
459
|
+
const minEntry = price.reduce((min, current) => ((current.total ?? 0) < (min.total ?? 0) ? current : min));
|
|
400
460
|
const basePath = `Homes.${homeId}.${objectDestination}`;
|
|
401
|
-
void this.checkAndSetValueNumber(`${basePath}.total`, Math.round(1000 * minEntry.total) / 1000, `Todays total price minimum`);
|
|
402
|
-
void this.checkAndSetValueNumber(`${basePath}.energy`, Math.round(1000 * minEntry.energy) / 1000, `Todays spotmarket price at total price minimum`);
|
|
403
|
-
void this.checkAndSetValueNumber(`${basePath}.tax`, Math.round(1000 * minEntry.tax) / 1000, `Todays tax price at total price minimum`);
|
|
404
|
-
void this.checkAndSetValue(`${basePath}.level`, minEntry.level
|
|
405
|
-
void this.checkAndSetValue(`${basePath}.startsAt`, minEntry.startsAt
|
|
461
|
+
void this.checkAndSetValueNumber(`${basePath}.total`, Math.round(1000 * (minEntry.total ?? 0)) / 1000, `Todays total price minimum`);
|
|
462
|
+
void this.checkAndSetValueNumber(`${basePath}.energy`, Math.round(1000 * (minEntry.energy ?? 0)) / 1000, `Todays spotmarket price at total price minimum`);
|
|
463
|
+
void this.checkAndSetValueNumber(`${basePath}.tax`, Math.round(1000 * (minEntry.tax ?? 0)) / 1000, `Todays tax price at total price minimum`);
|
|
464
|
+
void this.checkAndSetValue(`${basePath}.level`, minEntry.level ?? `---`, `Price level compared to recent price values`);
|
|
465
|
+
void this.checkAndSetValue(`${basePath}.startsAt`, minEntry.startsAt ?? `---`, `Start time of the price minimum`);
|
|
406
466
|
}
|
|
407
467
|
emptyingPrice(homeId, objectDestination) {
|
|
408
468
|
const basePath = `Homes.${homeId}.${objectDestination}`;
|