iobroker.tibberlink 0.1.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/LICENSE +200 -0
- package/README.md +34 -0
- package/admin/i18n/de/translations.json +6 -0
- package/admin/i18n/en/translations.json +6 -0
- package/admin/i18n/es/translations.json +6 -0
- package/admin/i18n/fr/translations.json +6 -0
- package/admin/i18n/it/translations.json +6 -0
- package/admin/i18n/nl/translations.json +6 -0
- package/admin/i18n/pl/translations.json +6 -0
- package/admin/i18n/pt/translations.json +6 -0
- package/admin/i18n/ru/translations.json +6 -0
- package/admin/i18n/uk/translations.json +6 -0
- package/admin/i18n/zh-cn/translations.json +6 -0
- package/admin/jsonConfig.json +152 -0
- package/admin/tibberlink.png +0 -0
- package/build/lib/tibberAPICaller.js +126 -0
- package/build/lib/tibberAPICaller.js.map +1 -0
- package/build/lib/tibberHelper.js +88 -0
- package/build/lib/tibberHelper.js.map +1 -0
- package/build/lib/tibberPulse.js +109 -0
- package/build/lib/tibberPulse.js.map +1 -0
- package/build/lib/tools.js +99 -0
- package/build/lib/tools.js.map +1 -0
- package/build/main.js +293 -0
- package/build/main.js.map +1 -0
- package/io-package.json +110 -0
- package/package.json +85 -0
package/build/main.js
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
// The adapter-core module gives you access to the core ioBroker functions
|
|
27
|
+
// you need to create an adapter
|
|
28
|
+
const utils = __importStar(require("@iobroker/adapter-core"));
|
|
29
|
+
const tibberAPICaller_1 = require("./lib/tibberAPICaller");
|
|
30
|
+
const tibberPulse_1 = require("./lib/tibberPulse");
|
|
31
|
+
class Tibberlink extends utils.Adapter {
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
super({
|
|
34
|
+
...options,
|
|
35
|
+
name: "tibberlink",
|
|
36
|
+
});
|
|
37
|
+
this.queryUrl = "";
|
|
38
|
+
this.on("ready", this.onReady.bind(this));
|
|
39
|
+
this.on("stateChange", this.onStateChange.bind(this));
|
|
40
|
+
// this.on("objectChange", this.onObjectChange.bind(this));
|
|
41
|
+
// this.on("message", this.onMessage.bind(this));
|
|
42
|
+
this.on("unload", this.onUnload.bind(this));
|
|
43
|
+
this.homeIdList = [];
|
|
44
|
+
this.intervallList = [];
|
|
45
|
+
this.queryUrl = "https://api.tibber.com/v1-beta/gql";
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Is called when databases are connected and adapter received configuration.
|
|
49
|
+
*/
|
|
50
|
+
async onReady() {
|
|
51
|
+
// Reset the connection indicator during startup;
|
|
52
|
+
if (!this.config.TibberAPIToken) {
|
|
53
|
+
// No Token defined in configuration
|
|
54
|
+
this.log.warn("Missing API Token - please check configuration");
|
|
55
|
+
this.setState("info.connection", false, true);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Need 2 configs - API and Feed (feed changed query url)
|
|
59
|
+
const tibberConfigAPI = {
|
|
60
|
+
active: true,
|
|
61
|
+
apiEndpoint: {
|
|
62
|
+
apiKey: this.config.TibberAPIToken,
|
|
63
|
+
queryUrl: this.queryUrl,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const tibberConfigFeed = {
|
|
67
|
+
active: true,
|
|
68
|
+
apiEndpoint: {
|
|
69
|
+
apiKey: this.config.TibberAPIToken,
|
|
70
|
+
queryUrl: this.queryUrl,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
// Now read all Data from API
|
|
74
|
+
const tibberAPICaller = new tibberAPICaller_1.TibberAPICaller(tibberConfigAPI, this);
|
|
75
|
+
try {
|
|
76
|
+
this.homeIdList = await tibberAPICaller.updateHomesFromAPI();
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'homes'"));
|
|
80
|
+
}
|
|
81
|
+
// if feed is not used - set info.connection if data received
|
|
82
|
+
if (!this.config.FeedActive) {
|
|
83
|
+
if (this.homeIdList) {
|
|
84
|
+
this.setState("info.connection", true, true);
|
|
85
|
+
this.log.debug("Connection Check: Feed not enabled and I received home list from api - good connection");
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.setState("info.connection", false, true);
|
|
89
|
+
this.log.debug("Connection Check: Feed not enabled and I do not get home list from api - bad connection");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// sentry.io ping
|
|
93
|
+
if (this.supportsFeature && this.supportsFeature("PLUGINS")) {
|
|
94
|
+
const sentryInstance = this.getPluginInstance("sentry");
|
|
95
|
+
const today = new Date();
|
|
96
|
+
//var last = await this.getStateAsync('LastSentryLogDay')
|
|
97
|
+
//if (last?.val != await today.getDate()) {
|
|
98
|
+
if (sentryInstance) {
|
|
99
|
+
const Sentry = sentryInstance.getSentryObject();
|
|
100
|
+
Sentry && Sentry.withScope((scope) => {
|
|
101
|
+
scope.setLevel("info");
|
|
102
|
+
scope.setTag("SentryDay", today.getDate());
|
|
103
|
+
scope.setTag("HomeIDs", this.homeIdList.length);
|
|
104
|
+
Sentry.captureMessage("Adapter TibberLink started", "info"); // Level "info"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// this.setStateAsync("LastSentryLoggedError", { val: "unknown", ack: true }); // Clean last error every adapter start
|
|
108
|
+
// this.setStateAsync("LastSentryLogDay", { val: today.getDate(), ack: true });
|
|
109
|
+
// }
|
|
110
|
+
}
|
|
111
|
+
// Init Load Data for home
|
|
112
|
+
if (this.homeIdList.length > 0) {
|
|
113
|
+
for (const index in this.homeIdList) {
|
|
114
|
+
try {
|
|
115
|
+
await tibberAPICaller.updateCurrentPrice(this.homeIdList[index]);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'Aktueller Preis'"));
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
await tibberAPICaller.updatePricesToday(this.homeIdList[index]);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'Preise von heute'"));
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
await tibberAPICaller.updatePricesTomorrow(this.homeIdList[index]);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'Preise von morgen'"));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const energyPriceCallIntervall = this.setInterval(() => {
|
|
135
|
+
if (this.homeIdList.length > 0) {
|
|
136
|
+
for (const index in this.homeIdList) {
|
|
137
|
+
try {
|
|
138
|
+
tibberAPICaller.updateCurrentPrice(this.homeIdList[index]);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'Aktueller Preis'"));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, 300000);
|
|
146
|
+
this.intervallList.push(energyPriceCallIntervall);
|
|
147
|
+
const energyPricesListUpdateInterval = this.setInterval(() => {
|
|
148
|
+
if (this.homeIdList.length > 0) {
|
|
149
|
+
for (const index in this.homeIdList) {
|
|
150
|
+
try {
|
|
151
|
+
tibberAPICaller.updatePricesToday(this.homeIdList[index]);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'Preise von heute'"));
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
tibberAPICaller.updatePricesTomorrow(this.homeIdList[index]);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
this.log.warn(tibberAPICaller.generateErrorMessage(error, "Abruf 'Preise von morgen'"));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, 1500000);
|
|
165
|
+
this.intervallList.push(energyPricesListUpdateInterval);
|
|
166
|
+
// If User uses TibberConfig - start connection
|
|
167
|
+
if (this.config.FeedActive) {
|
|
168
|
+
for (const index in this.homeIdList) {
|
|
169
|
+
try {
|
|
170
|
+
tibberConfigFeed.homeId = this.homeIdList[index]; // ERROR: Only latest homeID will be used at this point
|
|
171
|
+
// define fields for Datafeed
|
|
172
|
+
tibberConfigFeed.timestamp = true;
|
|
173
|
+
tibberConfigFeed.power = true;
|
|
174
|
+
if (this.config.FeedConfigLastMeterConsumption) {
|
|
175
|
+
tibberConfigFeed.lastMeterConsumption = true;
|
|
176
|
+
}
|
|
177
|
+
if (this.config.FeedConfigAccumulatedConsumption) {
|
|
178
|
+
tibberConfigFeed.accumulatedConsumption = true;
|
|
179
|
+
}
|
|
180
|
+
if (this.config.FeedConfigAccumulatedProduction) {
|
|
181
|
+
tibberConfigFeed.accumulatedProduction = true;
|
|
182
|
+
}
|
|
183
|
+
if (this.config.FeedConfigAccumulatedConsumptionLastHour) {
|
|
184
|
+
tibberConfigFeed.accumulatedConsumptionLastHour = true;
|
|
185
|
+
}
|
|
186
|
+
if (this.config.FeedConfigAccumulatedProductionLastHour) {
|
|
187
|
+
tibberConfigFeed.accumulatedProductionLastHour = true;
|
|
188
|
+
}
|
|
189
|
+
if (this.config.FeedConfigAccumulatedCost) {
|
|
190
|
+
tibberConfigFeed.accumulatedCost = true;
|
|
191
|
+
}
|
|
192
|
+
if (this.config.FeedConfigAccumulatedCost) {
|
|
193
|
+
tibberConfigFeed.accumulatedReward = true;
|
|
194
|
+
}
|
|
195
|
+
if (this.config.FeedConfigCurrency) {
|
|
196
|
+
tibberConfigFeed.currency = true;
|
|
197
|
+
}
|
|
198
|
+
if (this.config.FeedConfigMinPower) {
|
|
199
|
+
tibberConfigFeed.minPower = true;
|
|
200
|
+
}
|
|
201
|
+
if (this.config.FeedConfigAveragePower) {
|
|
202
|
+
tibberConfigFeed.averagePower = true;
|
|
203
|
+
}
|
|
204
|
+
if (this.config.FeedConfigMaxPower) {
|
|
205
|
+
tibberConfigFeed.maxPower = true;
|
|
206
|
+
}
|
|
207
|
+
if (this.config.FeedConfigPowerProduction) {
|
|
208
|
+
tibberConfigFeed.powerProduction = true;
|
|
209
|
+
}
|
|
210
|
+
if (this.config.FeedConfigMinPowerProduction) {
|
|
211
|
+
tibberConfigFeed.minPowerProduction = true;
|
|
212
|
+
}
|
|
213
|
+
if (this.config.FeedConfigMaxPowerProduction) {
|
|
214
|
+
tibberConfigFeed.maxPowerProduction = true;
|
|
215
|
+
}
|
|
216
|
+
if (this.config.FeedConfigLastMeterProduction) {
|
|
217
|
+
tibberConfigFeed.lastMeterProduction = true;
|
|
218
|
+
}
|
|
219
|
+
if (this.config.FeedConfigPowerFactor) {
|
|
220
|
+
tibberConfigFeed.powerFactor = true;
|
|
221
|
+
}
|
|
222
|
+
if (this.config.FeedConfigVoltagePhase1) {
|
|
223
|
+
tibberConfigFeed.voltagePhase1 = true;
|
|
224
|
+
}
|
|
225
|
+
if (this.config.FeedConfigVoltagePhase2) {
|
|
226
|
+
tibberConfigFeed.voltagePhase2 = true;
|
|
227
|
+
}
|
|
228
|
+
if (this.config.FeedConfigVoltagePhase3) {
|
|
229
|
+
tibberConfigFeed.voltagePhase3 = true;
|
|
230
|
+
}
|
|
231
|
+
if (this.config.FeedConfigCurrentL1) {
|
|
232
|
+
tibberConfigFeed.currentL1 = true;
|
|
233
|
+
}
|
|
234
|
+
if (this.config.FeedConfigCurrentL2) {
|
|
235
|
+
tibberConfigFeed.currentL2 = true;
|
|
236
|
+
}
|
|
237
|
+
if (this.config.FeedConfigCurrentL3) {
|
|
238
|
+
tibberConfigFeed.currentL3 = true;
|
|
239
|
+
}
|
|
240
|
+
if (this.config.FeedConfigSignalStrength) {
|
|
241
|
+
tibberConfigFeed.signalStrength = true;
|
|
242
|
+
}
|
|
243
|
+
const tibberPulse = new tibberPulse_1.TibberPulse(tibberConfigFeed, this);
|
|
244
|
+
tibberPulse.ConnectPulseStream();
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
this.log.warn(e.message);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Is called when adapter shuts down - callback has to be called under any circumstances!
|
|
255
|
+
*/
|
|
256
|
+
onUnload(callback) {
|
|
257
|
+
try {
|
|
258
|
+
// Here you must clear all timeouts or intervals that may still be active
|
|
259
|
+
// clearTimeout(timeout1);
|
|
260
|
+
for (const index in this.intervallList) {
|
|
261
|
+
this.clearInterval(this.intervallList[index]);
|
|
262
|
+
}
|
|
263
|
+
// info.connect to false, if adapter is closed
|
|
264
|
+
this.setState("info.connection", false, true);
|
|
265
|
+
callback();
|
|
266
|
+
}
|
|
267
|
+
catch (e) {
|
|
268
|
+
callback();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Is called if a subscribed state changes
|
|
273
|
+
*/
|
|
274
|
+
onStateChange(id, state) {
|
|
275
|
+
if (state) {
|
|
276
|
+
// The state was changed
|
|
277
|
+
this.log.info(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
// The state was deleted
|
|
281
|
+
this.log.info(`state ${id} deleted`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (require.main !== module) {
|
|
286
|
+
// Export the constructor in compact mode
|
|
287
|
+
module.exports = (options) => new Tibberlink(options);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
// otherwise start the instance directly
|
|
291
|
+
(() => new Tibberlink())();
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAA0E;AAC1E,gCAAgC;AAChC,8DAAgD;AAEhD,2DAAwD;AACxD,mDAAgD;AAEhD,MAAM,UAAW,SAAQ,KAAK,CAAC,OAAO;IAKrC,YAAmB,UAAyC,EAAE;QAC7D,KAAK,CAAC;YACL,GAAG,OAAO;YACV,IAAI,EAAE,YAAY;SAClB,CAAC,CAAC;QANJ,aAAQ,GAAG,EAAE,CAAC;QAOb,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI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/io-package.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"common": {
|
|
3
|
+
"name": "tibberlink",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"news": {
|
|
6
|
+
"0.1.0": {
|
|
7
|
+
"en": "initial release",
|
|
8
|
+
"de": "Erstveröffentlichung",
|
|
9
|
+
"ru": "начальный выпуск",
|
|
10
|
+
"pt": "lançamento inicial",
|
|
11
|
+
"nl": "niet",
|
|
12
|
+
"fr": "initial release",
|
|
13
|
+
"it": "rilascio iniziale",
|
|
14
|
+
"es": "liberación inicial",
|
|
15
|
+
"pl": "pierwsze wydanie",
|
|
16
|
+
"uk": "початковий реліз",
|
|
17
|
+
"zh-cn": "初步释放"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"titleLang": {
|
|
21
|
+
"en": "Tibber Link",
|
|
22
|
+
"de": "Tibber Link",
|
|
23
|
+
"ru": "Тиббер Ссылка",
|
|
24
|
+
"pt": "Tibber Link",
|
|
25
|
+
"nl": "Tibber Link",
|
|
26
|
+
"fr": "Tibber Link",
|
|
27
|
+
"it": "Tibber Link",
|
|
28
|
+
"es": "Tibber Link",
|
|
29
|
+
"pl": "Tibber Link",
|
|
30
|
+
"uk": "Посилання",
|
|
31
|
+
"zh-cn": "网络联系"
|
|
32
|
+
},
|
|
33
|
+
"desc": {
|
|
34
|
+
"en": "links tibber API data to be used in ioBroker",
|
|
35
|
+
"de": "Verbindet Tibber API-Daten um in ioBroker verwendet zu werden",
|
|
36
|
+
"ru": "ссылки tibber API данные, которые будут использоваться в ioBroker",
|
|
37
|
+
"pt": "links tibber API dados para ser usado no ioBroker",
|
|
38
|
+
"nl": "vertaling:",
|
|
39
|
+
"fr": "liens données de l'API tibber à utiliser dans ioBroker",
|
|
40
|
+
"it": "link tibber dati API da utilizzare in ioBroker",
|
|
41
|
+
"es": "enlaces de datos de la API de tibber para ser utilizado en ioBroker",
|
|
42
|
+
"pl": "dane dotyczące API API są używane w ioBrokerie",
|
|
43
|
+
"uk": "посилання tibber дані API для використання в ioBroker",
|
|
44
|
+
"zh-cn": "broker将使用的tibber API数据链接"
|
|
45
|
+
},
|
|
46
|
+
"authors": ["Hombach <TibberLink@homba.ch>"],
|
|
47
|
+
"keywords": ["power", "energy", "Tibber"],
|
|
48
|
+
"license": "GPL-3.0-only",
|
|
49
|
+
"platform": "Javascript/Node.js",
|
|
50
|
+
"main": "build/main.js",
|
|
51
|
+
"icon": "tibberlink.png",
|
|
52
|
+
"enabled": true,
|
|
53
|
+
"extIcon": "https://raw.githubusercontent.com/Hombach/ioBroker.tibberlink/main/admin/tibberlink.png",
|
|
54
|
+
"readme": "https://github.com/Hombach/ioBroker.tibberlink/blob/main/README.md",
|
|
55
|
+
"loglevel": "info",
|
|
56
|
+
"mode": "daemon",
|
|
57
|
+
"allowInit": true,
|
|
58
|
+
"type": "communication",
|
|
59
|
+
"compact": true,
|
|
60
|
+
"connectionType": "cloud",
|
|
61
|
+
"dataSource": "poll",
|
|
62
|
+
"materialize": true,
|
|
63
|
+
"adminUI": {
|
|
64
|
+
"config": "json"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": [
|
|
67
|
+
{
|
|
68
|
+
"js-controller": ">=3.2.16"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"globalDependencies": [
|
|
72
|
+
{
|
|
73
|
+
"admin": ">=5.0.0"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"plugins": {
|
|
77
|
+
"sentry": {
|
|
78
|
+
"dsn": "https://0e33dc63a0e34165850d97add3cc3684@o415875.ingest.sentry.io/5307610"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"native": {
|
|
83
|
+
"TibberAPIToken": "",
|
|
84
|
+
"PulseActive": false
|
|
85
|
+
},
|
|
86
|
+
"objects": [],
|
|
87
|
+
"instanceObjects": [
|
|
88
|
+
{
|
|
89
|
+
"_id": "info",
|
|
90
|
+
"type": "channel",
|
|
91
|
+
"common": {
|
|
92
|
+
"name": "Information"
|
|
93
|
+
},
|
|
94
|
+
"native": {}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"_id": "info.connection",
|
|
98
|
+
"type": "state",
|
|
99
|
+
"common": {
|
|
100
|
+
"role": "indicator.connected",
|
|
101
|
+
"name": "Device or service connected",
|
|
102
|
+
"type": "boolean",
|
|
103
|
+
"read": true,
|
|
104
|
+
"write": false,
|
|
105
|
+
"def": false
|
|
106
|
+
},
|
|
107
|
+
"native": {}
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "iobroker.tibberlink",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "links tibber API data to be used in ioBroker",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Hombach",
|
|
7
|
+
"email": "tibberlink@homba.ch"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Hombach/ioBroker.tibberlink",
|
|
10
|
+
"license": "GPL-3.0-only",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"power",
|
|
13
|
+
"energy",
|
|
14
|
+
"Energieversorger",
|
|
15
|
+
"Tibber"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/hombach/ioBroker.tibberlink.git"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">= 16.4.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@iobroker/adapter-core": "^2.6.8",
|
|
26
|
+
"tibber-api": "~5.1.9"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@alcalzone/release-script": "^3.5.9",
|
|
30
|
+
"@iobroker/testing": "^4.1.0",
|
|
31
|
+
"@iobroker/dev-server": "^0.6.0",
|
|
32
|
+
"@types/chai": "^4.3.5",
|
|
33
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
34
|
+
"@types/mocha": "^10.0.1",
|
|
35
|
+
"@types/node": "^20.4.2",
|
|
36
|
+
"@types/proxyquire": "^1.3.28",
|
|
37
|
+
"@types/sinon": "^10.0.15",
|
|
38
|
+
"@types/sinon-chai": "^3.2.8",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
41
|
+
"axios": "^1.4.0",
|
|
42
|
+
"chai": "^4.3.6",
|
|
43
|
+
"chai-as-promised": "^7.1.1",
|
|
44
|
+
"eslint": "^8.45.0",
|
|
45
|
+
"eslint-config-prettier": "^8.8.0",
|
|
46
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
47
|
+
"mocha": "^10.2.0",
|
|
48
|
+
"prettier": "^2.8.8",
|
|
49
|
+
"proxyquire": "^2.1.3",
|
|
50
|
+
"rimraf": "^5.0.1",
|
|
51
|
+
"sinon": "^15.2.0",
|
|
52
|
+
"sinon-chai": "^3.7.0",
|
|
53
|
+
"source-map-support": "^0.5.21",
|
|
54
|
+
"ts-node": "^10.9.1",
|
|
55
|
+
"typescript": "~5.1.6"
|
|
56
|
+
},
|
|
57
|
+
"main": "build/main.js",
|
|
58
|
+
"files": [
|
|
59
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*).json",
|
|
60
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
61
|
+
"build/",
|
|
62
|
+
"www/",
|
|
63
|
+
"io-package.json",
|
|
64
|
+
"LICENSE"
|
|
65
|
+
],
|
|
66
|
+
"scripts": {
|
|
67
|
+
"prebuild": "rimraf ./build",
|
|
68
|
+
"build:ts": "tsc -p tsconfig.build.json",
|
|
69
|
+
"build": "npm run build:ts",
|
|
70
|
+
"watch:ts": "tsc -p tsconfig.build.json --watch",
|
|
71
|
+
"watch": "npm run watch:ts",
|
|
72
|
+
"test:ts": "mocha --config test/mocharc.custom.json src/**/*.test.ts",
|
|
73
|
+
"test:package": "mocha test/package --exit",
|
|
74
|
+
"test:unit": "mocha test/unit --exit",
|
|
75
|
+
"test:integration": "mocha test/integration --exit",
|
|
76
|
+
"test": "npm run test:ts && npm run test:package",
|
|
77
|
+
"check": "tsc --noEmit",
|
|
78
|
+
"lint": "eslint --ext .ts src/",
|
|
79
|
+
"release": "release-script"
|
|
80
|
+
},
|
|
81
|
+
"bugs": {
|
|
82
|
+
"url": "https://github.com/Hombach/ioBroker.tibberlink/issues"
|
|
83
|
+
},
|
|
84
|
+
"readmeFilename": "README.md"
|
|
85
|
+
}
|