iobroker.utility-monitor 1.5.0 → 1.6.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 +86 -8
- package/io-package.json +31 -53
- package/lib/billingManager.js +333 -49
- package/lib/calculator.js +27 -13
- package/lib/multiMeterManager.js +192 -2
- package/lib/state/history.js +95 -0
- package/lib/state/meter.js +605 -0
- package/lib/state/roles.js +16 -0
- package/lib/state/totals.js +136 -0
- package/lib/state/utility.js +650 -0
- package/lib/stateManager.js +8 -2046
- package/lib/utils/helpers.js +56 -0
- package/lib/utils/stateCache.js +147 -0
- package/main.js +2 -6
- package/package.json +1 -1
package/lib/stateManager.js
CHANGED
|
@@ -1,2053 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
* Manages the creation and structure of all adapter states
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* State role definitions for different state types
|
|
7
|
-
*/
|
|
8
|
-
const STATE_ROLES = {
|
|
9
|
-
consumption: 'value.power.consumption',
|
|
10
|
-
cost: 'value.money',
|
|
11
|
-
meterReading: 'value',
|
|
12
|
-
price: 'value.price',
|
|
13
|
-
timestamp: 'value.time',
|
|
14
|
-
indicator: 'indicator',
|
|
15
|
-
value: 'value',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Creates the complete state structure for a utility type (gas, water, electricity)
|
|
20
|
-
*
|
|
21
|
-
* @param {object} adapter - The adapter instance
|
|
22
|
-
* @param {string} type - Utility type: 'gas', 'water', or 'electricity'
|
|
23
|
-
* @param {object} _config - Configuration for this utility
|
|
24
|
-
* @returns {Promise<void>}
|
|
25
|
-
*/
|
|
26
|
-
async function createUtilityStateStructure(adapter, type, _config = {}) {
|
|
27
|
-
const isGas = type === 'gas';
|
|
28
|
-
|
|
29
|
-
const labels = {
|
|
30
|
-
gas: { name: 'Gas', unit: 'kWh', volumeUnit: 'm³' },
|
|
31
|
-
water: { name: 'Wasser', unit: 'm³', volumeUnit: 'm³' },
|
|
32
|
-
electricity: { name: 'Strom', unit: 'kWh', volumeUnit: 'kWh' },
|
|
33
|
-
pv: { name: 'PV', unit: 'kWh', volumeUnit: 'kWh', consumption: 'Einspeisung', cost: 'Vergütung' },
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const label = labels[type];
|
|
37
|
-
|
|
38
|
-
// Create main channel
|
|
39
|
-
await adapter.setObjectNotExistsAsync(type, {
|
|
40
|
-
type: 'channel',
|
|
41
|
-
common: {
|
|
42
|
-
name: `${label.name}-Überwachung`,
|
|
43
|
-
},
|
|
44
|
-
native: {},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// CONSUMPTION STATES
|
|
48
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption`, {
|
|
49
|
-
type: 'channel',
|
|
50
|
-
common: {
|
|
51
|
-
name: label.consumption || 'Verbrauch',
|
|
52
|
-
},
|
|
53
|
-
native: {},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// For gas: add volume states (m³) in addition to energy states (kWh)
|
|
57
|
-
// Water doesn't need volume states because it's already measured in m³
|
|
58
|
-
if (type === 'gas') {
|
|
59
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.dailyVolume`, {
|
|
60
|
-
type: 'state',
|
|
61
|
-
common: {
|
|
62
|
-
name: 'Täglicher Verbrauch (m³)',
|
|
63
|
-
type: 'number',
|
|
64
|
-
role: STATE_ROLES.consumption,
|
|
65
|
-
read: true,
|
|
66
|
-
write: false,
|
|
67
|
-
unit: 'm³',
|
|
68
|
-
def: 0,
|
|
69
|
-
},
|
|
70
|
-
native: {},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.monthlyVolume`, {
|
|
74
|
-
type: 'state',
|
|
75
|
-
common: {
|
|
76
|
-
name: 'Monatlicher Verbrauch (m³)',
|
|
77
|
-
type: 'number',
|
|
78
|
-
role: STATE_ROLES.consumption,
|
|
79
|
-
read: true,
|
|
80
|
-
write: false,
|
|
81
|
-
unit: 'm³',
|
|
82
|
-
def: 0,
|
|
83
|
-
},
|
|
84
|
-
native: {},
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.yearlyVolume`, {
|
|
88
|
-
type: 'state',
|
|
89
|
-
common: {
|
|
90
|
-
name: 'Jährlicher Verbrauch (m³)',
|
|
91
|
-
type: 'number',
|
|
92
|
-
role: STATE_ROLES.consumption,
|
|
93
|
-
read: true,
|
|
94
|
-
write: false,
|
|
95
|
-
unit: 'm³',
|
|
96
|
-
def: 0,
|
|
97
|
-
},
|
|
98
|
-
native: {},
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.daily`, {
|
|
103
|
-
type: 'state',
|
|
104
|
-
common: {
|
|
105
|
-
name: `Tages-${(label.consumption || 'Verbrauch').toLowerCase()} (${label.unit})`,
|
|
106
|
-
type: 'number',
|
|
107
|
-
role: STATE_ROLES.consumption,
|
|
108
|
-
read: true,
|
|
109
|
-
write: false,
|
|
110
|
-
unit: label.unit,
|
|
111
|
-
def: 0,
|
|
112
|
-
},
|
|
113
|
-
native: {},
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.monthly`, {
|
|
117
|
-
type: 'state',
|
|
118
|
-
common: {
|
|
119
|
-
name: `Monats-${(label.consumption || 'Verbrauch').toLowerCase()} (${label.unit})`,
|
|
120
|
-
type: 'number',
|
|
121
|
-
role: STATE_ROLES.consumption,
|
|
122
|
-
read: true,
|
|
123
|
-
write: false,
|
|
124
|
-
unit: label.unit,
|
|
125
|
-
def: 0,
|
|
126
|
-
},
|
|
127
|
-
native: {},
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.yearly`, {
|
|
131
|
-
type: 'state',
|
|
132
|
-
common: {
|
|
133
|
-
name: `Jahres-${(label.consumption || 'Verbrauch').toLowerCase()} (${label.unit})`,
|
|
134
|
-
type: 'number',
|
|
135
|
-
role: STATE_ROLES.consumption,
|
|
136
|
-
read: true,
|
|
137
|
-
write: false,
|
|
138
|
-
unit: label.unit,
|
|
139
|
-
def: 0,
|
|
140
|
-
},
|
|
141
|
-
native: {},
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.weekly`, {
|
|
145
|
-
type: 'state',
|
|
146
|
-
common: {
|
|
147
|
-
name: `Wochen-${(label.consumption || 'Verbrauch').toLowerCase()} (${label.unit})`,
|
|
148
|
-
type: 'number',
|
|
149
|
-
role: STATE_ROLES.consumption,
|
|
150
|
-
read: true,
|
|
151
|
-
write: false,
|
|
152
|
-
unit: label.unit,
|
|
153
|
-
def: 0,
|
|
154
|
-
},
|
|
155
|
-
native: {},
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// Map internal type to config type (electricity -> strom, water -> wasser, gas -> gas)
|
|
159
|
-
const configTypeMap = {
|
|
160
|
-
electricity: 'strom',
|
|
161
|
-
water: 'wasser',
|
|
162
|
-
gas: 'gas',
|
|
163
|
-
pv: 'pv',
|
|
164
|
-
};
|
|
165
|
-
const configType = configTypeMap[type] || type;
|
|
166
|
-
|
|
167
|
-
// HT/NT consumption states - only create if HT/NT tariff is enabled
|
|
168
|
-
// Note: Water typically doesn't have HT/NT, but logic remains generic if config exists
|
|
169
|
-
const htNtEnabledKey = `${configType}HtNtEnabled`;
|
|
170
|
-
if (_config[htNtEnabledKey]) {
|
|
171
|
-
const htNtStates = ['dailyHT', 'dailyNT', 'monthlyHT', 'monthlyNT', 'yearlyHT', 'yearlyNT'];
|
|
172
|
-
const htNtLabels = {
|
|
173
|
-
dailyHT: 'Tagesverbrauch Haupttarif (HT)',
|
|
174
|
-
dailyNT: 'Tagesverbrauch Nebentarif (NT)',
|
|
175
|
-
monthlyHT: 'Monatsverbrauch Haupttarif (HT)',
|
|
176
|
-
monthlyNT: 'Monatsverbrauch Nebentarif (NT)',
|
|
177
|
-
yearlyHT: 'Jahresverbrauch Haupttarif (HT)',
|
|
178
|
-
yearlyNT: 'Jahresverbrauch Nebentarif (NT)',
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
for (const state of htNtStates) {
|
|
182
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.${state}`, {
|
|
183
|
-
type: 'state',
|
|
184
|
-
common: {
|
|
185
|
-
name: `${htNtLabels[state]} (${label.unit})`,
|
|
186
|
-
type: 'number',
|
|
187
|
-
role: STATE_ROLES.consumption,
|
|
188
|
-
read: true,
|
|
189
|
-
write: false,
|
|
190
|
-
unit: label.unit,
|
|
191
|
-
def: 0,
|
|
192
|
-
},
|
|
193
|
-
native: {},
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const htNtWeeklyStates = ['weeklyHT', 'weeklyNT'];
|
|
198
|
-
const htNtWeeklyLabels = {
|
|
199
|
-
weeklyHT: 'Wochenverbrauch Haupttarif (HT)',
|
|
200
|
-
weeklyNT: 'Wochenverbrauch Nebentarif (NT)',
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
for (const state of htNtWeeklyStates) {
|
|
204
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.${state}`, {
|
|
205
|
-
type: 'state',
|
|
206
|
-
common: {
|
|
207
|
-
name: `${htNtWeeklyLabels[state]} (${label.unit})`,
|
|
208
|
-
type: 'number',
|
|
209
|
-
role: STATE_ROLES.consumption,
|
|
210
|
-
read: true,
|
|
211
|
-
write: false,
|
|
212
|
-
unit: label.unit,
|
|
213
|
-
def: 0,
|
|
214
|
-
},
|
|
215
|
-
native: {},
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
await adapter.setObjectNotExistsAsync(`${type}.consumption.lastUpdate`, {
|
|
221
|
-
type: 'state',
|
|
222
|
-
common: {
|
|
223
|
-
name: 'Letzte Aktualisierung',
|
|
224
|
-
type: 'number',
|
|
225
|
-
role: STATE_ROLES.timestamp,
|
|
226
|
-
read: true,
|
|
227
|
-
write: false,
|
|
228
|
-
},
|
|
229
|
-
native: {},
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
// COST STATES
|
|
233
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs`, {
|
|
234
|
-
type: 'channel',
|
|
235
|
-
common: {
|
|
236
|
-
name: label.cost || 'Kosten',
|
|
237
|
-
},
|
|
238
|
-
native: {},
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.daily`, {
|
|
242
|
-
type: 'state',
|
|
243
|
-
common: {
|
|
244
|
-
name: `Tages-${(label.cost || 'Kosten').toLowerCase()} (€)`,
|
|
245
|
-
type: 'number',
|
|
246
|
-
role: STATE_ROLES.cost,
|
|
247
|
-
read: true,
|
|
248
|
-
write: false,
|
|
249
|
-
unit: '€',
|
|
250
|
-
def: 0,
|
|
251
|
-
},
|
|
252
|
-
native: {},
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.monthly`, {
|
|
256
|
-
type: 'state',
|
|
257
|
-
common: {
|
|
258
|
-
name: `Monats-${(label.cost || 'Kosten').toLowerCase()} (€)`,
|
|
259
|
-
type: 'number',
|
|
260
|
-
role: STATE_ROLES.cost,
|
|
261
|
-
read: true,
|
|
262
|
-
write: false,
|
|
263
|
-
unit: '€',
|
|
264
|
-
def: 0,
|
|
265
|
-
},
|
|
266
|
-
native: {},
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.yearly`, {
|
|
270
|
-
type: 'state',
|
|
271
|
-
common: {
|
|
272
|
-
name: `Jahres-${(label.cost || 'Kosten').toLowerCase()} (€)`,
|
|
273
|
-
type: 'number',
|
|
274
|
-
role: STATE_ROLES.cost,
|
|
275
|
-
read: true,
|
|
276
|
-
write: false,
|
|
277
|
-
unit: '€',
|
|
278
|
-
def: 0,
|
|
279
|
-
},
|
|
280
|
-
native: {},
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.weekly`, {
|
|
284
|
-
type: 'state',
|
|
285
|
-
common: {
|
|
286
|
-
name: `Wochen-${(label.cost || 'Kosten').toLowerCase()} (€)`,
|
|
287
|
-
type: 'number',
|
|
288
|
-
role: STATE_ROLES.cost,
|
|
289
|
-
read: true,
|
|
290
|
-
write: false,
|
|
291
|
-
unit: '€',
|
|
292
|
-
def: 0,
|
|
293
|
-
},
|
|
294
|
-
native: {},
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
// HT/NT states - only create if HT/NT tariff is enabled
|
|
298
|
-
// Note: htNtEnabledKey already calculated above for consumption section
|
|
299
|
-
if (_config[htNtEnabledKey]) {
|
|
300
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.yearlyHT`, {
|
|
301
|
-
type: 'state',
|
|
302
|
-
common: {
|
|
303
|
-
name: 'Jahreskosten Haupttarif (HT) (€)',
|
|
304
|
-
type: 'number',
|
|
305
|
-
role: STATE_ROLES.cost,
|
|
306
|
-
read: true,
|
|
307
|
-
write: false,
|
|
308
|
-
unit: '€',
|
|
309
|
-
def: 0,
|
|
310
|
-
},
|
|
311
|
-
native: {},
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.yearlyNT`, {
|
|
315
|
-
type: 'state',
|
|
316
|
-
common: {
|
|
317
|
-
name: 'Jahreskosten Nebentarif (NT) (€)',
|
|
318
|
-
type: 'number',
|
|
319
|
-
role: STATE_ROLES.cost,
|
|
320
|
-
read: true,
|
|
321
|
-
write: false,
|
|
322
|
-
unit: '€',
|
|
323
|
-
def: 0,
|
|
324
|
-
},
|
|
325
|
-
native: {},
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.monthlyHT`, {
|
|
329
|
-
type: 'state',
|
|
330
|
-
common: {
|
|
331
|
-
name: 'Monatskosten Haupttarif (HT) (€)',
|
|
332
|
-
type: 'number',
|
|
333
|
-
role: STATE_ROLES.cost,
|
|
334
|
-
read: true,
|
|
335
|
-
write: false,
|
|
336
|
-
unit: '€',
|
|
337
|
-
def: 0,
|
|
338
|
-
},
|
|
339
|
-
native: {},
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.monthlyNT`, {
|
|
343
|
-
type: 'state',
|
|
344
|
-
common: {
|
|
345
|
-
name: 'Monatskosten Nebentarif (NT) (€)',
|
|
346
|
-
type: 'number',
|
|
347
|
-
role: STATE_ROLES.cost,
|
|
348
|
-
read: true,
|
|
349
|
-
write: false,
|
|
350
|
-
unit: '€',
|
|
351
|
-
def: 0,
|
|
352
|
-
},
|
|
353
|
-
native: {},
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.dailyHT`, {
|
|
357
|
-
type: 'state',
|
|
358
|
-
common: {
|
|
359
|
-
name: 'Tageskosten Haupttarif (HT) (€)',
|
|
360
|
-
type: 'number',
|
|
361
|
-
role: STATE_ROLES.cost,
|
|
362
|
-
read: true,
|
|
363
|
-
write: false,
|
|
364
|
-
unit: '€',
|
|
365
|
-
def: 0,
|
|
366
|
-
},
|
|
367
|
-
native: {},
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.dailyNT`, {
|
|
371
|
-
type: 'state',
|
|
372
|
-
common: {
|
|
373
|
-
name: 'Tageskosten Nebentarif (NT) (€)',
|
|
374
|
-
type: 'number',
|
|
375
|
-
role: STATE_ROLES.cost,
|
|
376
|
-
read: true,
|
|
377
|
-
write: false,
|
|
378
|
-
unit: '€',
|
|
379
|
-
def: 0,
|
|
380
|
-
},
|
|
381
|
-
native: {},
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.weeklyHT`, {
|
|
385
|
-
type: 'state',
|
|
386
|
-
common: {
|
|
387
|
-
name: 'Wochenkosten Haupttarif (HT) (€)',
|
|
388
|
-
type: 'number',
|
|
389
|
-
role: STATE_ROLES.cost,
|
|
390
|
-
read: true,
|
|
391
|
-
write: false,
|
|
392
|
-
unit: '€',
|
|
393
|
-
def: 0,
|
|
394
|
-
},
|
|
395
|
-
native: {},
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.weeklyNT`, {
|
|
399
|
-
type: 'state',
|
|
400
|
-
common: {
|
|
401
|
-
name: 'Wochenkosten Nebentarif (NT) (€)',
|
|
402
|
-
type: 'number',
|
|
403
|
-
role: STATE_ROLES.cost,
|
|
404
|
-
read: true,
|
|
405
|
-
write: false,
|
|
406
|
-
unit: '€',
|
|
407
|
-
def: 0,
|
|
408
|
-
},
|
|
409
|
-
native: {},
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.totalYearly`, {
|
|
414
|
-
type: 'state',
|
|
415
|
-
common: {
|
|
416
|
-
name: `Gesamt-${(label.cost || 'Kosten').toLowerCase()} Jahr (Verbrauch + Grundgebühr) (€)`,
|
|
417
|
-
type: 'number',
|
|
418
|
-
role: STATE_ROLES.cost,
|
|
419
|
-
read: true,
|
|
420
|
-
write: false,
|
|
421
|
-
unit: '€',
|
|
422
|
-
def: 0,
|
|
423
|
-
},
|
|
424
|
-
native: {},
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.annualFee`, {
|
|
428
|
-
type: 'state',
|
|
429
|
-
common: {
|
|
430
|
-
name: 'Jahresgebühr akkumuliert (€)',
|
|
431
|
-
type: 'number',
|
|
432
|
-
role: STATE_ROLES.cost,
|
|
433
|
-
read: true,
|
|
434
|
-
write: false,
|
|
435
|
-
unit: '€',
|
|
436
|
-
def: 0,
|
|
437
|
-
},
|
|
438
|
-
native: {},
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.basicCharge`, {
|
|
442
|
-
type: 'state',
|
|
443
|
-
common: {
|
|
444
|
-
name: 'Grundgebühr (€/Monat)',
|
|
445
|
-
type: 'number',
|
|
446
|
-
role: STATE_ROLES.cost,
|
|
447
|
-
read: true,
|
|
448
|
-
write: false,
|
|
449
|
-
unit: '€',
|
|
450
|
-
def: 0,
|
|
451
|
-
},
|
|
452
|
-
native: {},
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.paidTotal`, {
|
|
456
|
-
type: 'state',
|
|
457
|
-
common: {
|
|
458
|
-
name: 'Bezahlt gesamt (Abschlag × Monate)',
|
|
459
|
-
type: 'number',
|
|
460
|
-
role: STATE_ROLES.cost,
|
|
461
|
-
read: true,
|
|
462
|
-
write: false,
|
|
463
|
-
unit: '€',
|
|
464
|
-
def: 0,
|
|
465
|
-
},
|
|
466
|
-
native: {},
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
await adapter.setObjectNotExistsAsync(`${type}.costs.balance`, {
|
|
470
|
-
type: 'state',
|
|
471
|
-
common: {
|
|
472
|
-
name: 'Saldo (Bezahlt - Verbraucht)',
|
|
473
|
-
type: 'number',
|
|
474
|
-
role: STATE_ROLES.cost,
|
|
475
|
-
read: true,
|
|
476
|
-
write: false,
|
|
477
|
-
unit: '€',
|
|
478
|
-
def: 0,
|
|
479
|
-
},
|
|
480
|
-
native: {},
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
// BILLING STATES (Abrechnungszeitraum-Management)
|
|
484
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing`, {
|
|
485
|
-
type: 'channel',
|
|
486
|
-
common: {
|
|
487
|
-
name: 'Abrechnungszeitraum',
|
|
488
|
-
},
|
|
489
|
-
native: {},
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.endReading`, {
|
|
493
|
-
type: 'state',
|
|
494
|
-
common: {
|
|
495
|
-
name: 'Endzählerstand (manuell eintragen)',
|
|
496
|
-
type: 'number',
|
|
497
|
-
role: STATE_ROLES.meterReading,
|
|
498
|
-
read: true,
|
|
499
|
-
write: true,
|
|
500
|
-
unit: label.volumeUnit,
|
|
501
|
-
def: 0,
|
|
502
|
-
},
|
|
503
|
-
native: {},
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.closePeriod`, {
|
|
507
|
-
type: 'state',
|
|
508
|
-
common: {
|
|
509
|
-
name: 'Zeitraum jetzt abschließen (Button)',
|
|
510
|
-
type: 'boolean',
|
|
511
|
-
role: 'button',
|
|
512
|
-
read: true,
|
|
513
|
-
write: true,
|
|
514
|
-
def: false,
|
|
515
|
-
},
|
|
516
|
-
native: {},
|
|
517
|
-
});
|
|
518
|
-
|
|
519
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.periodEnd`, {
|
|
520
|
-
type: 'state',
|
|
521
|
-
common: {
|
|
522
|
-
name: 'Abrechnungszeitraum endet am',
|
|
523
|
-
type: 'string',
|
|
524
|
-
role: 'text',
|
|
525
|
-
read: true,
|
|
526
|
-
write: false,
|
|
527
|
-
def: '',
|
|
528
|
-
},
|
|
529
|
-
native: {},
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.daysRemaining`, {
|
|
533
|
-
type: 'state',
|
|
534
|
-
common: {
|
|
535
|
-
name: 'Tage bis Abrechnungsende',
|
|
536
|
-
type: 'number',
|
|
537
|
-
role: 'value',
|
|
538
|
-
read: true,
|
|
539
|
-
write: false,
|
|
540
|
-
unit: 'Tage',
|
|
541
|
-
def: 0,
|
|
542
|
-
},
|
|
543
|
-
native: {},
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.newInitialReading`, {
|
|
547
|
-
type: 'state',
|
|
548
|
-
common: {
|
|
549
|
-
name: 'Neuer Startwert (für Config übernehmen!)',
|
|
550
|
-
type: 'number',
|
|
551
|
-
role: STATE_ROLES.meterReading,
|
|
552
|
-
read: true,
|
|
553
|
-
write: false,
|
|
554
|
-
unit: label.volumeUnit,
|
|
555
|
-
def: 0,
|
|
556
|
-
},
|
|
557
|
-
native: {},
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.notificationSent`, {
|
|
561
|
-
type: 'state',
|
|
562
|
-
common: {
|
|
563
|
-
name: 'Benachrichtigung Zählerstand versendet',
|
|
564
|
-
type: 'boolean',
|
|
565
|
-
role: 'indicator',
|
|
566
|
-
read: true,
|
|
567
|
-
write: false,
|
|
568
|
-
def: false,
|
|
569
|
-
},
|
|
570
|
-
native: {},
|
|
571
|
-
});
|
|
572
|
-
|
|
573
|
-
await adapter.setObjectNotExistsAsync(`${type}.billing.notificationChangeSent`, {
|
|
574
|
-
type: 'state',
|
|
575
|
-
common: {
|
|
576
|
-
name: 'Benachrichtigung Vertragswechsel versendet',
|
|
577
|
-
type: 'boolean',
|
|
578
|
-
role: 'indicator',
|
|
579
|
-
read: true,
|
|
580
|
-
write: false,
|
|
581
|
-
def: false,
|
|
582
|
-
},
|
|
583
|
-
native: {},
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
// ADJUSTMENT STATES (Manuelle Anpassung)
|
|
587
|
-
await adapter.setObjectNotExistsAsync(`${type}.adjustment`, {
|
|
588
|
-
type: 'channel',
|
|
589
|
-
common: {
|
|
590
|
-
name: 'Manuelle Anpassung',
|
|
591
|
-
},
|
|
592
|
-
native: {},
|
|
593
|
-
});
|
|
594
|
-
|
|
595
|
-
await adapter.setObjectNotExistsAsync(`${type}.adjustment.value`, {
|
|
596
|
-
type: 'state',
|
|
597
|
-
common: {
|
|
598
|
-
name: 'Korrekturwert (Differenz zum echten Zähler)',
|
|
599
|
-
type: 'number',
|
|
600
|
-
role: STATE_ROLES.value,
|
|
601
|
-
read: true,
|
|
602
|
-
write: true,
|
|
603
|
-
unit: label.volumeUnit,
|
|
604
|
-
def: 0,
|
|
605
|
-
},
|
|
606
|
-
native: {},
|
|
607
|
-
});
|
|
608
|
-
|
|
609
|
-
await adapter.setObjectNotExistsAsync(`${type}.adjustment.note`, {
|
|
610
|
-
type: 'state',
|
|
611
|
-
common: {
|
|
612
|
-
name: 'Notiz/Grund für Anpassung',
|
|
613
|
-
type: 'string',
|
|
614
|
-
role: 'text',
|
|
615
|
-
read: true,
|
|
616
|
-
write: true,
|
|
617
|
-
def: '',
|
|
618
|
-
},
|
|
619
|
-
native: {},
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
await adapter.setObjectNotExistsAsync(`${type}.adjustment.applied`, {
|
|
623
|
-
type: 'state',
|
|
624
|
-
common: {
|
|
625
|
-
name: 'Zeitstempel der letzten Anwendung',
|
|
626
|
-
type: 'number',
|
|
627
|
-
role: 'value.time',
|
|
628
|
-
read: true,
|
|
629
|
-
write: false,
|
|
630
|
-
def: 0,
|
|
631
|
-
},
|
|
632
|
-
native: {},
|
|
633
|
-
});
|
|
634
|
-
|
|
635
|
-
// INFO STATES
|
|
636
|
-
await adapter.setObjectNotExistsAsync(`${type}.info`, {
|
|
637
|
-
type: 'channel',
|
|
638
|
-
common: {
|
|
639
|
-
name: 'Informationen',
|
|
640
|
-
},
|
|
641
|
-
native: {},
|
|
642
|
-
});
|
|
643
|
-
|
|
644
|
-
// For gas, store volume in m³ separate from energy in kWh
|
|
645
|
-
if (isGas) {
|
|
646
|
-
await adapter.setObjectNotExistsAsync(`${type}.info.meterReadingVolume`, {
|
|
647
|
-
type: 'state',
|
|
648
|
-
common: {
|
|
649
|
-
name: `Zählerstand Volumen (${label.volumeUnit})`,
|
|
650
|
-
type: 'number',
|
|
651
|
-
role: STATE_ROLES.meterReading,
|
|
652
|
-
read: true,
|
|
653
|
-
write: false,
|
|
654
|
-
unit: label.volumeUnit,
|
|
655
|
-
def: 0,
|
|
656
|
-
},
|
|
657
|
-
native: {},
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
await adapter.setObjectNotExistsAsync(`${type}.info.meterReading`, {
|
|
662
|
-
type: 'state',
|
|
663
|
-
common: {
|
|
664
|
-
name: `Zählerstand (${label.unit})`,
|
|
665
|
-
type: 'number',
|
|
666
|
-
role: STATE_ROLES.meterReading,
|
|
667
|
-
read: true,
|
|
668
|
-
write: false,
|
|
669
|
-
unit: label.unit,
|
|
670
|
-
def: 0,
|
|
671
|
-
},
|
|
672
|
-
native: {},
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
await adapter.setObjectNotExistsAsync(`${type}.info.currentPrice`, {
|
|
676
|
-
type: 'state',
|
|
677
|
-
common: {
|
|
678
|
-
name: `Aktueller Preis (€/${label.unit})`,
|
|
679
|
-
type: 'number',
|
|
680
|
-
role: STATE_ROLES.price,
|
|
681
|
-
read: true,
|
|
682
|
-
write: false,
|
|
683
|
-
unit: `€/${label.unit}`,
|
|
684
|
-
def: 0,
|
|
685
|
-
},
|
|
686
|
-
native: {},
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
await adapter.setObjectNotExistsAsync(`${type}.info.lastSync`, {
|
|
690
|
-
type: 'state',
|
|
691
|
-
common: {
|
|
692
|
-
name: 'Letzte Synchronisation',
|
|
693
|
-
type: 'number',
|
|
694
|
-
role: STATE_ROLES.timestamp,
|
|
695
|
-
read: true,
|
|
696
|
-
write: false,
|
|
697
|
-
},
|
|
698
|
-
native: {},
|
|
699
|
-
});
|
|
700
|
-
|
|
701
|
-
await adapter.setObjectNotExistsAsync(`${type}.info.sensorActive`, {
|
|
702
|
-
type: 'state',
|
|
703
|
-
common: {
|
|
704
|
-
name: 'Sensor aktiv',
|
|
705
|
-
type: 'boolean',
|
|
706
|
-
role: STATE_ROLES.indicator,
|
|
707
|
-
read: true,
|
|
708
|
-
write: false,
|
|
709
|
-
def: false,
|
|
710
|
-
},
|
|
711
|
-
native: {},
|
|
712
|
-
});
|
|
713
|
-
|
|
714
|
-
await adapter.setObjectNotExistsAsync(`${type}.info.currentTariff`, {
|
|
715
|
-
type: 'state',
|
|
716
|
-
common: {
|
|
717
|
-
name: 'Aktueller Tarif (HT/NT)',
|
|
718
|
-
type: 'string',
|
|
719
|
-
role: 'text',
|
|
720
|
-
read: true,
|
|
721
|
-
write: false,
|
|
722
|
-
def: 'Standard',
|
|
723
|
-
},
|
|
724
|
-
native: {},
|
|
725
|
-
});
|
|
726
|
-
|
|
727
|
-
// STATISTICS STATES
|
|
728
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics`, {
|
|
729
|
-
type: 'channel',
|
|
730
|
-
common: {
|
|
731
|
-
name: 'Statistiken',
|
|
732
|
-
},
|
|
733
|
-
native: {},
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.averageDaily`, {
|
|
737
|
-
type: 'state',
|
|
738
|
-
common: {
|
|
739
|
-
name: `Durchschnitt pro Tag (${label.unit})`,
|
|
740
|
-
type: 'number',
|
|
741
|
-
role: STATE_ROLES.consumption,
|
|
742
|
-
read: true,
|
|
743
|
-
write: false,
|
|
744
|
-
unit: label.unit,
|
|
745
|
-
def: 0,
|
|
746
|
-
},
|
|
747
|
-
native: {},
|
|
748
|
-
});
|
|
749
|
-
|
|
750
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.averageMonthly`, {
|
|
751
|
-
type: 'state',
|
|
752
|
-
common: {
|
|
753
|
-
name: `Durchschnitt pro Monat (${label.unit})`,
|
|
754
|
-
type: 'number',
|
|
755
|
-
role: STATE_ROLES.consumption,
|
|
756
|
-
read: true,
|
|
757
|
-
write: false,
|
|
758
|
-
unit: label.unit,
|
|
759
|
-
def: 0,
|
|
760
|
-
},
|
|
761
|
-
native: {},
|
|
762
|
-
});
|
|
763
|
-
|
|
764
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastDay`, {
|
|
765
|
-
type: 'state',
|
|
766
|
-
common: {
|
|
767
|
-
name: `Verbrauch gestern (${label.unit})`,
|
|
768
|
-
type: 'number',
|
|
769
|
-
role: STATE_ROLES.consumption,
|
|
770
|
-
read: true,
|
|
771
|
-
write: false,
|
|
772
|
-
unit: label.unit,
|
|
773
|
-
def: 0,
|
|
774
|
-
},
|
|
775
|
-
native: {},
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
// HT/NT lastDay states - only create if HT/NT tariff is enabled
|
|
779
|
-
if (_config[htNtEnabledKey]) {
|
|
780
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastDayHT`, {
|
|
781
|
-
type: 'state',
|
|
782
|
-
common: {
|
|
783
|
-
name: `Verbrauch gestern HT (${label.unit})`,
|
|
784
|
-
type: 'number',
|
|
785
|
-
role: STATE_ROLES.consumption,
|
|
786
|
-
read: true,
|
|
787
|
-
write: false,
|
|
788
|
-
unit: label.unit,
|
|
789
|
-
def: 0,
|
|
790
|
-
},
|
|
791
|
-
native: {},
|
|
792
|
-
});
|
|
793
|
-
|
|
794
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastDayNT`, {
|
|
795
|
-
type: 'state',
|
|
796
|
-
common: {
|
|
797
|
-
name: `Verbrauch gestern NT (${label.unit})`,
|
|
798
|
-
type: 'number',
|
|
799
|
-
role: STATE_ROLES.consumption,
|
|
800
|
-
read: true,
|
|
801
|
-
write: false,
|
|
802
|
-
unit: label.unit,
|
|
803
|
-
def: 0,
|
|
804
|
-
},
|
|
805
|
-
native: {},
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
if (type === 'gas') {
|
|
810
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastDayVolume`, {
|
|
811
|
-
type: 'state',
|
|
812
|
-
common: {
|
|
813
|
-
name: `Verbrauch gestern (${label.volumeUnit})`,
|
|
814
|
-
type: 'number',
|
|
815
|
-
role: STATE_ROLES.consumption,
|
|
816
|
-
read: true,
|
|
817
|
-
write: false,
|
|
818
|
-
unit: label.volumeUnit,
|
|
819
|
-
def: 0,
|
|
820
|
-
},
|
|
821
|
-
native: {},
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
// Last week consumption
|
|
826
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastWeek`, {
|
|
827
|
-
type: 'state',
|
|
828
|
-
common: {
|
|
829
|
-
name: `Verbrauch letzte Woche (${label.unit})`,
|
|
830
|
-
type: 'number',
|
|
831
|
-
role: STATE_ROLES.consumption,
|
|
832
|
-
read: true,
|
|
833
|
-
write: false,
|
|
834
|
-
unit: label.unit,
|
|
835
|
-
def: 0,
|
|
836
|
-
},
|
|
837
|
-
native: {},
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
if (type === 'gas') {
|
|
841
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastWeekVolume`, {
|
|
842
|
-
type: 'state',
|
|
843
|
-
common: {
|
|
844
|
-
name: `Verbrauch letzte Woche (${label.volumeUnit})`,
|
|
845
|
-
type: 'number',
|
|
846
|
-
role: STATE_ROLES.consumption,
|
|
847
|
-
read: true,
|
|
848
|
-
write: false,
|
|
849
|
-
unit: label.volumeUnit,
|
|
850
|
-
def: 0,
|
|
851
|
-
},
|
|
852
|
-
native: {},
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
// Last month consumption
|
|
857
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastMonth`, {
|
|
858
|
-
type: 'state',
|
|
859
|
-
common: {
|
|
860
|
-
name: `Verbrauch letzter Monat (${label.unit})`,
|
|
861
|
-
type: 'number',
|
|
862
|
-
role: STATE_ROLES.consumption,
|
|
863
|
-
read: true,
|
|
864
|
-
write: false,
|
|
865
|
-
unit: label.unit,
|
|
866
|
-
def: 0,
|
|
867
|
-
},
|
|
868
|
-
native: {},
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
if (type === 'gas') {
|
|
872
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastMonthVolume`, {
|
|
873
|
-
type: 'state',
|
|
874
|
-
common: {
|
|
875
|
-
name: `Verbrauch letzter Monat (${label.volumeUnit})`,
|
|
876
|
-
type: 'number',
|
|
877
|
-
role: STATE_ROLES.consumption,
|
|
878
|
-
read: true,
|
|
879
|
-
write: false,
|
|
880
|
-
unit: label.volumeUnit,
|
|
881
|
-
def: 0,
|
|
882
|
-
},
|
|
883
|
-
native: {},
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastDayStart`, {
|
|
888
|
-
type: 'state',
|
|
889
|
-
common: {
|
|
890
|
-
name: 'Tageszähler zurückgesetzt am',
|
|
891
|
-
type: 'number',
|
|
892
|
-
role: STATE_ROLES.timestamp,
|
|
893
|
-
read: true,
|
|
894
|
-
write: false,
|
|
895
|
-
},
|
|
896
|
-
native: {},
|
|
897
|
-
});
|
|
898
|
-
|
|
899
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastWeekStart`, {
|
|
900
|
-
type: 'state',
|
|
901
|
-
common: {
|
|
902
|
-
name: 'Wochenzähler zurückgesetzt am',
|
|
903
|
-
type: 'number',
|
|
904
|
-
role: STATE_ROLES.timestamp,
|
|
905
|
-
read: true,
|
|
906
|
-
write: false,
|
|
907
|
-
},
|
|
908
|
-
native: {},
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastMonthStart`, {
|
|
912
|
-
type: 'state',
|
|
913
|
-
common: {
|
|
914
|
-
name: 'Monatszähler zurückgesetzt am',
|
|
915
|
-
type: 'number',
|
|
916
|
-
role: STATE_ROLES.timestamp,
|
|
917
|
-
read: true,
|
|
918
|
-
write: false,
|
|
919
|
-
},
|
|
920
|
-
native: {},
|
|
921
|
-
});
|
|
922
|
-
|
|
923
|
-
await adapter.setObjectNotExistsAsync(`${type}.statistics.lastYearStart`, {
|
|
924
|
-
type: 'state',
|
|
925
|
-
common: {
|
|
926
|
-
name: 'Jahreszähler zurückgesetzt am',
|
|
927
|
-
type: 'number',
|
|
928
|
-
role: STATE_ROLES.timestamp,
|
|
929
|
-
read: true,
|
|
930
|
-
write: false,
|
|
931
|
-
},
|
|
932
|
-
native: {},
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
adapter.log.debug(`State structure created for ${type}`);
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/**
|
|
939
|
-
* Creates the state structure for a meter (main or additional)
|
|
940
|
-
* Can be used for main meter or any custom-named additional meter
|
|
941
|
-
*
|
|
942
|
-
* @param {object} adapter - The adapter instance
|
|
943
|
-
* @param {string} type - Utility type: 'gas', 'water', or 'electricity'
|
|
944
|
-
* @param {string} meterName - Meter name: 'main' or custom name (e.g., 'erdgeschoss')
|
|
945
|
-
* @param {object} _config - Configuration for this meter
|
|
946
|
-
* @returns {Promise<void>}
|
|
947
|
-
*/
|
|
948
|
-
async function createMeterStructure(adapter, type, meterName, _config = {}) {
|
|
949
|
-
const isGas = type === 'gas';
|
|
950
|
-
|
|
951
|
-
// All meters now include the meter name in labels for consistency
|
|
952
|
-
const labels = {
|
|
953
|
-
gas: { name: `Gas (${meterName})`, unit: 'kWh', volumeUnit: 'm³' },
|
|
954
|
-
water: { name: `Wasser (${meterName})`, unit: 'm³', volumeUnit: 'm³' },
|
|
955
|
-
electricity: { name: `Strom (${meterName})`, unit: 'kWh', volumeUnit: 'kWh' },
|
|
956
|
-
pv: { name: `PV (${meterName})`, unit: 'kWh', volumeUnit: 'kWh' },
|
|
957
|
-
};
|
|
958
|
-
|
|
959
|
-
const label = labels[type];
|
|
960
|
-
if (!label) {
|
|
961
|
-
adapter.log.error(
|
|
962
|
-
`MISSING LABEL for type "${type}" in createMeterStructure! Meter: ${meterName}. Valid types: ${Object.keys(labels).join(', ')}`,
|
|
963
|
-
);
|
|
964
|
-
// Fallback to prevent crash
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
const basePath = `${type}.${meterName}`;
|
|
968
|
-
|
|
969
|
-
// Create main channel
|
|
970
|
-
await adapter.setObjectNotExistsAsync(basePath, {
|
|
971
|
-
type: 'channel',
|
|
972
|
-
common: {
|
|
973
|
-
name: `${label.name}-Überwachung`,
|
|
974
|
-
},
|
|
975
|
-
native: {},
|
|
976
|
-
});
|
|
977
|
-
|
|
978
|
-
// CONSUMPTION STATES
|
|
979
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption`, {
|
|
980
|
-
type: 'channel',
|
|
981
|
-
common: {
|
|
982
|
-
name: 'Verbrauch',
|
|
983
|
-
},
|
|
984
|
-
native: {},
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
// For gas: add volume states (m³)
|
|
988
|
-
if (type === 'gas') {
|
|
989
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.dailyVolume`, {
|
|
990
|
-
type: 'state',
|
|
991
|
-
common: {
|
|
992
|
-
name: 'Täglicher Verbrauch (m³)',
|
|
993
|
-
type: 'number',
|
|
994
|
-
role: STATE_ROLES.consumption,
|
|
995
|
-
read: true,
|
|
996
|
-
write: false,
|
|
997
|
-
unit: 'm³',
|
|
998
|
-
def: 0,
|
|
999
|
-
},
|
|
1000
|
-
native: {},
|
|
1001
|
-
});
|
|
1002
|
-
|
|
1003
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.monthlyVolume`, {
|
|
1004
|
-
type: 'state',
|
|
1005
|
-
common: {
|
|
1006
|
-
name: 'Monatlicher Verbrauch (m³)',
|
|
1007
|
-
type: 'number',
|
|
1008
|
-
role: STATE_ROLES.consumption,
|
|
1009
|
-
read: true,
|
|
1010
|
-
write: false,
|
|
1011
|
-
unit: 'm³',
|
|
1012
|
-
def: 0,
|
|
1013
|
-
},
|
|
1014
|
-
native: {},
|
|
1015
|
-
});
|
|
1016
|
-
|
|
1017
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.yearlyVolume`, {
|
|
1018
|
-
type: 'state',
|
|
1019
|
-
common: {
|
|
1020
|
-
name: 'Jährlicher Verbrauch (m³)',
|
|
1021
|
-
type: 'number',
|
|
1022
|
-
role: STATE_ROLES.consumption,
|
|
1023
|
-
read: true,
|
|
1024
|
-
write: false,
|
|
1025
|
-
unit: 'm³',
|
|
1026
|
-
def: 0,
|
|
1027
|
-
},
|
|
1028
|
-
native: {},
|
|
1029
|
-
});
|
|
1030
|
-
|
|
1031
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.weeklyVolume`, {
|
|
1032
|
-
type: 'state',
|
|
1033
|
-
common: {
|
|
1034
|
-
name: 'Wöchentlicher Verbrauch (m³)',
|
|
1035
|
-
type: 'number',
|
|
1036
|
-
role: STATE_ROLES.consumption,
|
|
1037
|
-
read: true,
|
|
1038
|
-
write: false,
|
|
1039
|
-
unit: 'm³',
|
|
1040
|
-
def: 0,
|
|
1041
|
-
},
|
|
1042
|
-
native: {},
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.daily`, {
|
|
1047
|
-
type: 'state',
|
|
1048
|
-
common: {
|
|
1049
|
-
name: `Tagesverbrauch (${label.unit})`,
|
|
1050
|
-
type: 'number',
|
|
1051
|
-
role: STATE_ROLES.consumption,
|
|
1052
|
-
read: true,
|
|
1053
|
-
write: false,
|
|
1054
|
-
unit: label.unit,
|
|
1055
|
-
def: 0,
|
|
1056
|
-
},
|
|
1057
|
-
native: {},
|
|
1058
|
-
});
|
|
1059
|
-
|
|
1060
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.monthly`, {
|
|
1061
|
-
type: 'state',
|
|
1062
|
-
common: {
|
|
1063
|
-
name: `Monatsverbrauch (${label.unit})`,
|
|
1064
|
-
type: 'number',
|
|
1065
|
-
role: STATE_ROLES.consumption,
|
|
1066
|
-
read: true,
|
|
1067
|
-
write: false,
|
|
1068
|
-
unit: label.unit,
|
|
1069
|
-
def: 0,
|
|
1070
|
-
},
|
|
1071
|
-
native: {},
|
|
1072
|
-
});
|
|
1073
|
-
|
|
1074
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.yearly`, {
|
|
1075
|
-
type: 'state',
|
|
1076
|
-
common: {
|
|
1077
|
-
name: `Jahresverbrauch (${label.unit})`,
|
|
1078
|
-
type: 'number',
|
|
1079
|
-
role: STATE_ROLES.consumption,
|
|
1080
|
-
read: true,
|
|
1081
|
-
write: false,
|
|
1082
|
-
unit: label.unit,
|
|
1083
|
-
def: 0,
|
|
1084
|
-
},
|
|
1085
|
-
native: {},
|
|
1086
|
-
});
|
|
1087
|
-
|
|
1088
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.weekly`, {
|
|
1089
|
-
type: 'state',
|
|
1090
|
-
common: {
|
|
1091
|
-
name: `Wochenverbrauch (${label.unit})`,
|
|
1092
|
-
type: 'number',
|
|
1093
|
-
role: STATE_ROLES.consumption,
|
|
1094
|
-
read: true,
|
|
1095
|
-
write: false,
|
|
1096
|
-
unit: label.unit,
|
|
1097
|
-
def: 0,
|
|
1098
|
-
},
|
|
1099
|
-
native: {},
|
|
1100
|
-
});
|
|
1101
|
-
|
|
1102
|
-
if (_config.htNtEnabled) {
|
|
1103
|
-
const htNtStates = [
|
|
1104
|
-
'dailyHT',
|
|
1105
|
-
'dailyNT',
|
|
1106
|
-
'monthlyHT',
|
|
1107
|
-
'monthlyNT',
|
|
1108
|
-
'yearlyHT',
|
|
1109
|
-
'yearlyNT',
|
|
1110
|
-
'weeklyHT',
|
|
1111
|
-
'weeklyNT',
|
|
1112
|
-
];
|
|
1113
|
-
const htNtLabels = {
|
|
1114
|
-
dailyHT: 'Tagesverbrauch Haupttarif (HT)',
|
|
1115
|
-
dailyNT: 'Tagesverbrauch Nebentarif (NT)',
|
|
1116
|
-
monthlyHT: 'Monatsverbrauch Haupttarif (HT)',
|
|
1117
|
-
monthlyNT: 'Monatsverbrauch Nebentarif (NT)',
|
|
1118
|
-
yearlyHT: 'Jahresverbrauch Haupttarif (HT)',
|
|
1119
|
-
yearlyNT: 'Jahresverbrauch Nebentarif (NT)',
|
|
1120
|
-
weeklyHT: 'Wochenverbrauch Haupttarif (HT)',
|
|
1121
|
-
weeklyNT: 'Wochenverbrauch Nebentarif (NT)',
|
|
1122
|
-
weeklyVolumeHT: 'Wochenverbrauch Haupttarif (m³)',
|
|
1123
|
-
weeklyVolumeNT: 'Wochenverbrauch Nebentarif (m³)',
|
|
1124
|
-
};
|
|
1125
|
-
|
|
1126
|
-
if (type === 'gas') {
|
|
1127
|
-
htNtStates.push('weeklyVolumeHT', 'weeklyVolumeNT');
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
for (const state of htNtStates) {
|
|
1131
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.${state}`, {
|
|
1132
|
-
type: 'state',
|
|
1133
|
-
common: {
|
|
1134
|
-
name: `${htNtLabels[state]} (${label.unit})`,
|
|
1135
|
-
type: 'number',
|
|
1136
|
-
role: STATE_ROLES.consumption,
|
|
1137
|
-
read: true,
|
|
1138
|
-
write: false,
|
|
1139
|
-
unit: label.unit,
|
|
1140
|
-
def: 0,
|
|
1141
|
-
},
|
|
1142
|
-
native: {},
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.lastUpdate`, {
|
|
1148
|
-
type: 'state',
|
|
1149
|
-
common: {
|
|
1150
|
-
name: 'Letzte Aktualisierung',
|
|
1151
|
-
type: 'number',
|
|
1152
|
-
role: STATE_ROLES.timestamp,
|
|
1153
|
-
read: true,
|
|
1154
|
-
write: false,
|
|
1155
|
-
},
|
|
1156
|
-
native: {},
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
// COST STATES
|
|
1160
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs`, {
|
|
1161
|
-
type: 'channel',
|
|
1162
|
-
common: {
|
|
1163
|
-
name: 'Kosten',
|
|
1164
|
-
},
|
|
1165
|
-
native: {},
|
|
1166
|
-
});
|
|
1167
|
-
|
|
1168
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.daily`, {
|
|
1169
|
-
type: 'state',
|
|
1170
|
-
common: {
|
|
1171
|
-
name: 'Tageskosten (€)',
|
|
1172
|
-
type: 'number',
|
|
1173
|
-
role: STATE_ROLES.cost,
|
|
1174
|
-
read: true,
|
|
1175
|
-
write: false,
|
|
1176
|
-
unit: '€',
|
|
1177
|
-
def: 0,
|
|
1178
|
-
},
|
|
1179
|
-
native: {},
|
|
1180
|
-
});
|
|
1181
|
-
|
|
1182
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.monthly`, {
|
|
1183
|
-
type: 'state',
|
|
1184
|
-
common: {
|
|
1185
|
-
name: 'Monatskosten (€)',
|
|
1186
|
-
type: 'number',
|
|
1187
|
-
role: STATE_ROLES.cost,
|
|
1188
|
-
read: true,
|
|
1189
|
-
write: false,
|
|
1190
|
-
unit: '€',
|
|
1191
|
-
def: 0,
|
|
1192
|
-
},
|
|
1193
|
-
native: {},
|
|
1194
|
-
});
|
|
1195
|
-
|
|
1196
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.yearly`, {
|
|
1197
|
-
type: 'state',
|
|
1198
|
-
common: {
|
|
1199
|
-
name: 'Jahreskosten (€)',
|
|
1200
|
-
type: 'number',
|
|
1201
|
-
role: STATE_ROLES.cost,
|
|
1202
|
-
read: true,
|
|
1203
|
-
write: false,
|
|
1204
|
-
unit: '€',
|
|
1205
|
-
def: 0,
|
|
1206
|
-
},
|
|
1207
|
-
native: {},
|
|
1208
|
-
});
|
|
1209
|
-
|
|
1210
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.weekly`, {
|
|
1211
|
-
type: 'state',
|
|
1212
|
-
common: {
|
|
1213
|
-
name: 'Wochenkosten (€)',
|
|
1214
|
-
type: 'number',
|
|
1215
|
-
role: STATE_ROLES.cost,
|
|
1216
|
-
read: true,
|
|
1217
|
-
write: false,
|
|
1218
|
-
unit: '€',
|
|
1219
|
-
def: 0,
|
|
1220
|
-
},
|
|
1221
|
-
native: {},
|
|
1222
|
-
});
|
|
1223
|
-
|
|
1224
|
-
if (_config.htNtEnabled) {
|
|
1225
|
-
const htNtCostStates = [
|
|
1226
|
-
'dailyHT',
|
|
1227
|
-
'dailyNT',
|
|
1228
|
-
'monthlyHT',
|
|
1229
|
-
'monthlyNT',
|
|
1230
|
-
'yearlyHT',
|
|
1231
|
-
'yearlyNT',
|
|
1232
|
-
'weeklyHT',
|
|
1233
|
-
'weeklyNT',
|
|
1234
|
-
];
|
|
1235
|
-
const htNtCostLabels = {
|
|
1236
|
-
dailyHT: 'Tageskosten Haupttarif (HT)',
|
|
1237
|
-
dailyNT: 'Tageskosten Nebentarif (NT)',
|
|
1238
|
-
monthlyHT: 'Monatskosten Haupttarif (HT)',
|
|
1239
|
-
monthlyNT: 'Monatskosten Nebentarif (NT)',
|
|
1240
|
-
yearlyHT: 'Jahreskosten Haupttarif (HT)',
|
|
1241
|
-
yearlyNT: 'Jahreskosten Nebentarif (NT)',
|
|
1242
|
-
weeklyHT: 'Wochenkosten Haupttarif (HT)',
|
|
1243
|
-
weeklyNT: 'Wochenkosten Nebentarif (NT)',
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
for (const state of htNtCostStates) {
|
|
1247
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.${state}`, {
|
|
1248
|
-
type: 'state',
|
|
1249
|
-
common: {
|
|
1250
|
-
name: `${htNtCostLabels[state]} (€)`,
|
|
1251
|
-
type: 'number',
|
|
1252
|
-
role: STATE_ROLES.cost,
|
|
1253
|
-
read: true,
|
|
1254
|
-
write: false,
|
|
1255
|
-
unit: '€',
|
|
1256
|
-
def: 0,
|
|
1257
|
-
},
|
|
1258
|
-
native: {},
|
|
1259
|
-
});
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.totalYearly`, {
|
|
1264
|
-
type: 'state',
|
|
1265
|
-
common: {
|
|
1266
|
-
name: 'Gesamtkosten Jahr (Verbrauch + Grundgebühr) (€)',
|
|
1267
|
-
type: 'number',
|
|
1268
|
-
role: STATE_ROLES.cost,
|
|
1269
|
-
read: true,
|
|
1270
|
-
write: false,
|
|
1271
|
-
unit: '€',
|
|
1272
|
-
def: 0,
|
|
1273
|
-
},
|
|
1274
|
-
native: {},
|
|
1275
|
-
});
|
|
1276
|
-
|
|
1277
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.annualFee`, {
|
|
1278
|
-
type: 'state',
|
|
1279
|
-
common: {
|
|
1280
|
-
name: 'Jahresgebühr akkumuliert (€)',
|
|
1281
|
-
type: 'number',
|
|
1282
|
-
role: STATE_ROLES.cost,
|
|
1283
|
-
read: true,
|
|
1284
|
-
write: false,
|
|
1285
|
-
unit: '€',
|
|
1286
|
-
def: 0,
|
|
1287
|
-
},
|
|
1288
|
-
native: {},
|
|
1289
|
-
});
|
|
1290
|
-
|
|
1291
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.basicCharge`, {
|
|
1292
|
-
type: 'state',
|
|
1293
|
-
common: {
|
|
1294
|
-
name: 'Grundgebühr (€/Monat)',
|
|
1295
|
-
type: 'number',
|
|
1296
|
-
role: STATE_ROLES.cost,
|
|
1297
|
-
read: true,
|
|
1298
|
-
write: false,
|
|
1299
|
-
unit: '€',
|
|
1300
|
-
def: 0,
|
|
1301
|
-
},
|
|
1302
|
-
native: {},
|
|
1303
|
-
});
|
|
1304
|
-
|
|
1305
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.paidTotal`, {
|
|
1306
|
-
type: 'state',
|
|
1307
|
-
common: {
|
|
1308
|
-
name: 'Bezahlt gesamt (Abschlag × Monate)',
|
|
1309
|
-
type: 'number',
|
|
1310
|
-
role: STATE_ROLES.cost,
|
|
1311
|
-
read: true,
|
|
1312
|
-
write: false,
|
|
1313
|
-
unit: '€',
|
|
1314
|
-
def: 0,
|
|
1315
|
-
},
|
|
1316
|
-
native: {},
|
|
1317
|
-
});
|
|
1318
|
-
|
|
1319
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.balance`, {
|
|
1320
|
-
type: 'state',
|
|
1321
|
-
common: {
|
|
1322
|
-
name: 'Saldo (Bezahlt - Verbraucht)',
|
|
1323
|
-
type: 'number',
|
|
1324
|
-
role: STATE_ROLES.cost,
|
|
1325
|
-
read: true,
|
|
1326
|
-
write: false,
|
|
1327
|
-
unit: '€',
|
|
1328
|
-
def: 0,
|
|
1329
|
-
},
|
|
1330
|
-
native: {},
|
|
1331
|
-
});
|
|
1332
|
-
|
|
1333
|
-
// BILLING STATES
|
|
1334
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing`, {
|
|
1335
|
-
type: 'channel',
|
|
1336
|
-
common: {
|
|
1337
|
-
name: 'Abrechnungszeitraum',
|
|
1338
|
-
},
|
|
1339
|
-
native: {},
|
|
1340
|
-
});
|
|
1341
|
-
|
|
1342
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.endReading`, {
|
|
1343
|
-
type: 'state',
|
|
1344
|
-
common: {
|
|
1345
|
-
name: 'Endzählerstand (manuell eintragen)',
|
|
1346
|
-
type: 'number',
|
|
1347
|
-
role: STATE_ROLES.meterReading,
|
|
1348
|
-
read: true,
|
|
1349
|
-
write: true,
|
|
1350
|
-
unit: label.volumeUnit,
|
|
1351
|
-
def: 0,
|
|
1352
|
-
},
|
|
1353
|
-
native: {},
|
|
1354
|
-
});
|
|
1355
|
-
|
|
1356
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.closePeriod`, {
|
|
1357
|
-
type: 'state',
|
|
1358
|
-
common: {
|
|
1359
|
-
name: 'Zeitraum jetzt abschließen (Button)',
|
|
1360
|
-
type: 'boolean',
|
|
1361
|
-
role: 'button',
|
|
1362
|
-
read: true,
|
|
1363
|
-
write: true,
|
|
1364
|
-
def: false,
|
|
1365
|
-
},
|
|
1366
|
-
native: {},
|
|
1367
|
-
});
|
|
1368
|
-
|
|
1369
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.periodEnd`, {
|
|
1370
|
-
type: 'state',
|
|
1371
|
-
common: {
|
|
1372
|
-
name: 'Abrechnungszeitraum endet am',
|
|
1373
|
-
type: 'string',
|
|
1374
|
-
role: 'text',
|
|
1375
|
-
read: true,
|
|
1376
|
-
write: false,
|
|
1377
|
-
def: '',
|
|
1378
|
-
},
|
|
1379
|
-
native: {},
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.daysRemaining`, {
|
|
1383
|
-
type: 'state',
|
|
1384
|
-
common: {
|
|
1385
|
-
name: 'Tage bis Abrechnungsende',
|
|
1386
|
-
type: 'number',
|
|
1387
|
-
role: 'value',
|
|
1388
|
-
read: true,
|
|
1389
|
-
write: false,
|
|
1390
|
-
unit: 'Tage',
|
|
1391
|
-
def: 0,
|
|
1392
|
-
},
|
|
1393
|
-
native: {},
|
|
1394
|
-
});
|
|
1395
|
-
|
|
1396
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.newInitialReading`, {
|
|
1397
|
-
type: 'state',
|
|
1398
|
-
common: {
|
|
1399
|
-
name: 'Neuer Startwert (für Config übernehmen!)',
|
|
1400
|
-
type: 'number',
|
|
1401
|
-
role: STATE_ROLES.meterReading,
|
|
1402
|
-
read: true,
|
|
1403
|
-
write: false,
|
|
1404
|
-
unit: label.volumeUnit,
|
|
1405
|
-
def: 0,
|
|
1406
|
-
},
|
|
1407
|
-
native: {},
|
|
1408
|
-
});
|
|
1409
|
-
|
|
1410
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.notificationSent`, {
|
|
1411
|
-
type: 'state',
|
|
1412
|
-
common: {
|
|
1413
|
-
name: 'Benachrichtigung Zählerstand versendet',
|
|
1414
|
-
type: 'boolean',
|
|
1415
|
-
role: 'indicator',
|
|
1416
|
-
read: true,
|
|
1417
|
-
write: false,
|
|
1418
|
-
def: false,
|
|
1419
|
-
},
|
|
1420
|
-
native: {},
|
|
1421
|
-
});
|
|
1422
|
-
|
|
1423
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.billing.notificationChangeSent`, {
|
|
1424
|
-
type: 'state',
|
|
1425
|
-
common: {
|
|
1426
|
-
name: 'Benachrichtigung Vertragswechsel versendet',
|
|
1427
|
-
type: 'boolean',
|
|
1428
|
-
role: 'indicator',
|
|
1429
|
-
read: true,
|
|
1430
|
-
write: false,
|
|
1431
|
-
def: false,
|
|
1432
|
-
},
|
|
1433
|
-
native: {},
|
|
1434
|
-
});
|
|
1435
|
-
|
|
1436
|
-
// ADJUSTMENT STATES
|
|
1437
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.adjustment`, {
|
|
1438
|
-
type: 'channel',
|
|
1439
|
-
common: {
|
|
1440
|
-
name: 'Manuelle Anpassung',
|
|
1441
|
-
},
|
|
1442
|
-
native: {},
|
|
1443
|
-
});
|
|
1444
|
-
|
|
1445
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.adjustment.value`, {
|
|
1446
|
-
type: 'state',
|
|
1447
|
-
common: {
|
|
1448
|
-
name: 'Korrekturwert (Differenz zum echten Zähler)',
|
|
1449
|
-
type: 'number',
|
|
1450
|
-
role: STATE_ROLES.value,
|
|
1451
|
-
read: true,
|
|
1452
|
-
write: true,
|
|
1453
|
-
unit: label.volumeUnit,
|
|
1454
|
-
def: 0,
|
|
1455
|
-
},
|
|
1456
|
-
native: {},
|
|
1457
|
-
});
|
|
1458
|
-
|
|
1459
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.adjustment.note`, {
|
|
1460
|
-
type: 'state',
|
|
1461
|
-
common: {
|
|
1462
|
-
name: 'Notiz/Grund für Anpassung',
|
|
1463
|
-
type: 'string',
|
|
1464
|
-
role: 'text',
|
|
1465
|
-
read: true,
|
|
1466
|
-
write: true,
|
|
1467
|
-
def: '',
|
|
1468
|
-
},
|
|
1469
|
-
native: {},
|
|
1470
|
-
});
|
|
1471
|
-
|
|
1472
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.adjustment.applied`, {
|
|
1473
|
-
type: 'state',
|
|
1474
|
-
common: {
|
|
1475
|
-
name: 'Zeitstempel der letzten Anwendung',
|
|
1476
|
-
type: 'number',
|
|
1477
|
-
role: 'value.time',
|
|
1478
|
-
read: true,
|
|
1479
|
-
write: false,
|
|
1480
|
-
def: 0,
|
|
1481
|
-
},
|
|
1482
|
-
native: {},
|
|
1483
|
-
});
|
|
1484
|
-
|
|
1485
|
-
// INFO STATES
|
|
1486
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info`, {
|
|
1487
|
-
type: 'channel',
|
|
1488
|
-
common: {
|
|
1489
|
-
name: 'Informationen',
|
|
1490
|
-
},
|
|
1491
|
-
native: {},
|
|
1492
|
-
});
|
|
1493
|
-
|
|
1494
|
-
// For gas, store volume in m³ separate from energy in kWh
|
|
1495
|
-
if (isGas) {
|
|
1496
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info.meterReadingVolume`, {
|
|
1497
|
-
type: 'state',
|
|
1498
|
-
common: {
|
|
1499
|
-
name: `Zählerstand Volumen (${label.volumeUnit})`,
|
|
1500
|
-
type: 'number',
|
|
1501
|
-
role: STATE_ROLES.meterReading,
|
|
1502
|
-
read: true,
|
|
1503
|
-
write: false,
|
|
1504
|
-
unit: label.volumeUnit,
|
|
1505
|
-
def: 0,
|
|
1506
|
-
},
|
|
1507
|
-
native: {},
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info.meterReading`, {
|
|
1512
|
-
type: 'state',
|
|
1513
|
-
common: {
|
|
1514
|
-
name: `Zählerstand (${label.unit})`,
|
|
1515
|
-
type: 'number',
|
|
1516
|
-
role: STATE_ROLES.meterReading,
|
|
1517
|
-
read: true,
|
|
1518
|
-
write: false,
|
|
1519
|
-
unit: label.unit,
|
|
1520
|
-
def: 0,
|
|
1521
|
-
},
|
|
1522
|
-
native: {},
|
|
1523
|
-
});
|
|
1524
|
-
|
|
1525
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info.currentPrice`, {
|
|
1526
|
-
type: 'state',
|
|
1527
|
-
common: {
|
|
1528
|
-
name: `Aktueller Preis (€/${label.unit})`,
|
|
1529
|
-
type: 'number',
|
|
1530
|
-
role: STATE_ROLES.price,
|
|
1531
|
-
read: true,
|
|
1532
|
-
write: false,
|
|
1533
|
-
unit: `€/${label.unit}`,
|
|
1534
|
-
def: 0,
|
|
1535
|
-
},
|
|
1536
|
-
native: {},
|
|
1537
|
-
});
|
|
1538
|
-
|
|
1539
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info.sensorActive`, {
|
|
1540
|
-
type: 'state',
|
|
1541
|
-
common: {
|
|
1542
|
-
name: 'Sensor aktiv',
|
|
1543
|
-
type: 'boolean',
|
|
1544
|
-
role: 'indicator.reachable',
|
|
1545
|
-
read: true,
|
|
1546
|
-
write: false,
|
|
1547
|
-
def: false,
|
|
1548
|
-
},
|
|
1549
|
-
native: {},
|
|
1550
|
-
});
|
|
1551
|
-
|
|
1552
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info.lastSync`, {
|
|
1553
|
-
type: 'state',
|
|
1554
|
-
common: {
|
|
1555
|
-
name: 'Letzte Synchronisation',
|
|
1556
|
-
type: 'number',
|
|
1557
|
-
role: STATE_ROLES.timestamp,
|
|
1558
|
-
read: true,
|
|
1559
|
-
write: false,
|
|
1560
|
-
},
|
|
1561
|
-
native: {},
|
|
1562
|
-
});
|
|
1563
|
-
|
|
1564
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.info.currentTariff`, {
|
|
1565
|
-
type: 'state',
|
|
1566
|
-
common: {
|
|
1567
|
-
name: 'Aktueller Tarif',
|
|
1568
|
-
type: 'string',
|
|
1569
|
-
role: 'text',
|
|
1570
|
-
read: true,
|
|
1571
|
-
write: false,
|
|
1572
|
-
def: 'Standard',
|
|
1573
|
-
},
|
|
1574
|
-
native: {},
|
|
1575
|
-
});
|
|
1576
|
-
|
|
1577
|
-
// STATISTICS STATES
|
|
1578
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics`, {
|
|
1579
|
-
type: 'channel',
|
|
1580
|
-
common: {
|
|
1581
|
-
name: 'Statistiken',
|
|
1582
|
-
},
|
|
1583
|
-
native: {},
|
|
1584
|
-
});
|
|
1585
|
-
|
|
1586
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.averageDaily`, {
|
|
1587
|
-
type: 'state',
|
|
1588
|
-
common: {
|
|
1589
|
-
name: `Durchschnitt pro Tag (${label.unit})`,
|
|
1590
|
-
type: 'number',
|
|
1591
|
-
role: STATE_ROLES.consumption,
|
|
1592
|
-
read: true,
|
|
1593
|
-
write: false,
|
|
1594
|
-
unit: label.unit,
|
|
1595
|
-
def: 0,
|
|
1596
|
-
},
|
|
1597
|
-
native: {},
|
|
1598
|
-
});
|
|
1599
|
-
|
|
1600
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.averageMonthly`, {
|
|
1601
|
-
type: 'state',
|
|
1602
|
-
common: {
|
|
1603
|
-
name: `Durchschnitt pro Monat (${label.unit})`,
|
|
1604
|
-
type: 'number',
|
|
1605
|
-
role: STATE_ROLES.consumption,
|
|
1606
|
-
read: true,
|
|
1607
|
-
write: false,
|
|
1608
|
-
unit: label.unit,
|
|
1609
|
-
def: 0,
|
|
1610
|
-
},
|
|
1611
|
-
native: {},
|
|
1612
|
-
});
|
|
1613
|
-
|
|
1614
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastDay`, {
|
|
1615
|
-
type: 'state',
|
|
1616
|
-
common: {
|
|
1617
|
-
name: `Verbrauch gestern (${label.unit})`,
|
|
1618
|
-
type: 'number',
|
|
1619
|
-
role: STATE_ROLES.consumption,
|
|
1620
|
-
read: true,
|
|
1621
|
-
write: false,
|
|
1622
|
-
unit: label.unit,
|
|
1623
|
-
def: 0,
|
|
1624
|
-
},
|
|
1625
|
-
native: {},
|
|
1626
|
-
});
|
|
1627
|
-
|
|
1628
|
-
if (type === 'gas') {
|
|
1629
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastDayVolume`, {
|
|
1630
|
-
type: 'state',
|
|
1631
|
-
common: {
|
|
1632
|
-
name: `Verbrauch gestern (${label.volumeUnit})`,
|
|
1633
|
-
type: 'number',
|
|
1634
|
-
role: STATE_ROLES.consumption,
|
|
1635
|
-
read: true,
|
|
1636
|
-
write: false,
|
|
1637
|
-
unit: label.volumeUnit,
|
|
1638
|
-
def: 0,
|
|
1639
|
-
},
|
|
1640
|
-
native: {},
|
|
1641
|
-
});
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
// Last week consumption
|
|
1645
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastWeek`, {
|
|
1646
|
-
type: 'state',
|
|
1647
|
-
common: {
|
|
1648
|
-
name: `Verbrauch letzte Woche (${label.unit})`,
|
|
1649
|
-
type: 'number',
|
|
1650
|
-
role: STATE_ROLES.consumption,
|
|
1651
|
-
read: true,
|
|
1652
|
-
write: false,
|
|
1653
|
-
unit: label.unit,
|
|
1654
|
-
def: 0,
|
|
1655
|
-
},
|
|
1656
|
-
native: {},
|
|
1657
|
-
});
|
|
1658
|
-
|
|
1659
|
-
if (type === 'gas') {
|
|
1660
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastWeekVolume`, {
|
|
1661
|
-
type: 'state',
|
|
1662
|
-
common: {
|
|
1663
|
-
name: `Verbrauch letzte Woche (${label.volumeUnit})`,
|
|
1664
|
-
type: 'number',
|
|
1665
|
-
role: STATE_ROLES.consumption,
|
|
1666
|
-
read: true,
|
|
1667
|
-
write: false,
|
|
1668
|
-
unit: label.volumeUnit,
|
|
1669
|
-
def: 0,
|
|
1670
|
-
},
|
|
1671
|
-
native: {},
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
// Last month consumption
|
|
1676
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastMonth`, {
|
|
1677
|
-
type: 'state',
|
|
1678
|
-
common: {
|
|
1679
|
-
name: `Verbrauch letzter Monat (${label.unit})`,
|
|
1680
|
-
type: 'number',
|
|
1681
|
-
role: STATE_ROLES.consumption,
|
|
1682
|
-
read: true,
|
|
1683
|
-
write: false,
|
|
1684
|
-
unit: label.unit,
|
|
1685
|
-
def: 0,
|
|
1686
|
-
},
|
|
1687
|
-
native: {},
|
|
1688
|
-
});
|
|
1689
|
-
|
|
1690
|
-
if (type === 'gas') {
|
|
1691
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastMonthVolume`, {
|
|
1692
|
-
type: 'state',
|
|
1693
|
-
common: {
|
|
1694
|
-
name: `Verbrauch letzter Monat (${label.volumeUnit})`,
|
|
1695
|
-
type: 'number',
|
|
1696
|
-
role: STATE_ROLES.consumption,
|
|
1697
|
-
read: true,
|
|
1698
|
-
write: false,
|
|
1699
|
-
unit: label.volumeUnit,
|
|
1700
|
-
def: 0,
|
|
1701
|
-
},
|
|
1702
|
-
native: {},
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastDayStart`, {
|
|
1707
|
-
type: 'state',
|
|
1708
|
-
common: {
|
|
1709
|
-
name: 'Tageszähler zurückgesetzt am',
|
|
1710
|
-
type: 'number',
|
|
1711
|
-
role: STATE_ROLES.timestamp,
|
|
1712
|
-
read: true,
|
|
1713
|
-
write: false,
|
|
1714
|
-
},
|
|
1715
|
-
native: {},
|
|
1716
|
-
});
|
|
1717
|
-
|
|
1718
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastMonthStart`, {
|
|
1719
|
-
type: 'state',
|
|
1720
|
-
common: {
|
|
1721
|
-
name: 'Monatszähler zurückgesetzt am',
|
|
1722
|
-
type: 'number',
|
|
1723
|
-
role: STATE_ROLES.timestamp,
|
|
1724
|
-
read: true,
|
|
1725
|
-
write: false,
|
|
1726
|
-
},
|
|
1727
|
-
native: {},
|
|
1728
|
-
});
|
|
1729
|
-
|
|
1730
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastYearStart`, {
|
|
1731
|
-
type: 'state',
|
|
1732
|
-
common: {
|
|
1733
|
-
name: 'Jahreszähler zurückgesetzt am',
|
|
1734
|
-
type: 'number',
|
|
1735
|
-
role: STATE_ROLES.timestamp,
|
|
1736
|
-
read: true,
|
|
1737
|
-
write: false,
|
|
1738
|
-
},
|
|
1739
|
-
native: {},
|
|
1740
|
-
});
|
|
1741
|
-
|
|
1742
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.statistics.lastWeekStart`, {
|
|
1743
|
-
type: 'state',
|
|
1744
|
-
common: {
|
|
1745
|
-
name: 'Wochenzähler zurückgesetzt am',
|
|
1746
|
-
type: 'number',
|
|
1747
|
-
role: STATE_ROLES.timestamp,
|
|
1748
|
-
read: true,
|
|
1749
|
-
write: false,
|
|
1750
|
-
},
|
|
1751
|
-
native: {},
|
|
1752
|
-
});
|
|
1753
|
-
|
|
1754
|
-
adapter.log.debug(`Meter state structure created for ${type}.${meterName}`);
|
|
1755
|
-
}
|
|
1
|
+
'use strict';
|
|
1756
2
|
|
|
1757
3
|
/**
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
* @param {object} adapter - The adapter instance
|
|
1761
|
-
* @param {string} type - Utility type: 'gas', 'water', or 'electricity'
|
|
1762
|
-
* @returns {Promise<void>}
|
|
1763
|
-
*/
|
|
1764
|
-
async function deleteUtilityStateStructure(adapter, type) {
|
|
1765
|
-
try {
|
|
1766
|
-
await adapter.delObjectAsync(type, { recursive: true });
|
|
1767
|
-
adapter.log.debug(`State structure deleted for ${type}`);
|
|
1768
|
-
} catch (error) {
|
|
1769
|
-
adapter.log.warn(`Could not delete state structure for ${type}: ${error.message}`);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
/**
|
|
1774
|
-
* Creates the totals state structure for a utility type
|
|
1775
|
-
* Totals show the sum of all meters (main + additional)
|
|
1776
|
-
*
|
|
1777
|
-
* @param {object} adapter - The adapter instance
|
|
1778
|
-
* @param {string} type - Utility type: 'gas', 'water', or 'electricity'
|
|
1779
|
-
* @returns {Promise<void>}
|
|
1780
|
-
*/
|
|
1781
|
-
async function createTotalsStructure(adapter, type) {
|
|
1782
|
-
const labels = {
|
|
1783
|
-
gas: { name: 'Gas (Gesamt)', unit: 'kWh' },
|
|
1784
|
-
water: { name: 'Wasser (Gesamt)', unit: 'm³' },
|
|
1785
|
-
electricity: { name: 'Strom (Gesamt)', unit: 'kWh' },
|
|
1786
|
-
pv: { name: 'PV (Gesamt)', unit: 'kWh' },
|
|
1787
|
-
};
|
|
1788
|
-
|
|
1789
|
-
const label = labels[type];
|
|
1790
|
-
if (!label) {
|
|
1791
|
-
adapter.log.error(
|
|
1792
|
-
`MISSING LABEL for type "${type}" in createTotalsStructure! Valid types: ${Object.keys(labels).join(', ')}`,
|
|
1793
|
-
);
|
|
1794
|
-
return;
|
|
1795
|
-
}
|
|
1796
|
-
const basePath = `${type}.totals`;
|
|
1797
|
-
|
|
1798
|
-
// Create main channel
|
|
1799
|
-
await adapter.setObjectNotExistsAsync(basePath, {
|
|
1800
|
-
type: 'channel',
|
|
1801
|
-
common: {
|
|
1802
|
-
name: `${label.name} - Summe aller Zähler`,
|
|
1803
|
-
},
|
|
1804
|
-
native: {},
|
|
1805
|
-
});
|
|
1806
|
-
|
|
1807
|
-
// CONSUMPTION STATES (totals)
|
|
1808
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption`, {
|
|
1809
|
-
type: 'channel',
|
|
1810
|
-
common: {
|
|
1811
|
-
name: 'Gesamtverbrauch',
|
|
1812
|
-
},
|
|
1813
|
-
native: {},
|
|
1814
|
-
});
|
|
1815
|
-
|
|
1816
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.daily`, {
|
|
1817
|
-
type: 'state',
|
|
1818
|
-
common: {
|
|
1819
|
-
name: `Tagesverbrauch Gesamt (${label.unit})`,
|
|
1820
|
-
type: 'number',
|
|
1821
|
-
role: STATE_ROLES.consumption,
|
|
1822
|
-
read: true,
|
|
1823
|
-
write: false,
|
|
1824
|
-
unit: label.unit,
|
|
1825
|
-
def: 0,
|
|
1826
|
-
},
|
|
1827
|
-
native: {},
|
|
1828
|
-
});
|
|
1829
|
-
|
|
1830
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.monthly`, {
|
|
1831
|
-
type: 'state',
|
|
1832
|
-
common: {
|
|
1833
|
-
name: `Monatsverbrauch Gesamt (${label.unit})`,
|
|
1834
|
-
type: 'number',
|
|
1835
|
-
role: STATE_ROLES.consumption,
|
|
1836
|
-
read: true,
|
|
1837
|
-
write: false,
|
|
1838
|
-
unit: label.unit,
|
|
1839
|
-
def: 0,
|
|
1840
|
-
},
|
|
1841
|
-
native: {},
|
|
1842
|
-
});
|
|
1843
|
-
|
|
1844
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.yearly`, {
|
|
1845
|
-
type: 'state',
|
|
1846
|
-
common: {
|
|
1847
|
-
name: `Jahresverbrauch Gesamt (${label.unit})`,
|
|
1848
|
-
type: 'number',
|
|
1849
|
-
role: STATE_ROLES.consumption,
|
|
1850
|
-
read: true,
|
|
1851
|
-
write: false,
|
|
1852
|
-
unit: label.unit,
|
|
1853
|
-
def: 0,
|
|
1854
|
-
},
|
|
1855
|
-
native: {},
|
|
1856
|
-
});
|
|
1857
|
-
|
|
1858
|
-
if (type === 'gas') {
|
|
1859
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.weeklyVolume`, {
|
|
1860
|
-
type: 'state',
|
|
1861
|
-
common: {
|
|
1862
|
-
name: 'Wochenverbrauch Gesamt (m³)',
|
|
1863
|
-
type: 'number',
|
|
1864
|
-
role: STATE_ROLES.consumption,
|
|
1865
|
-
read: true,
|
|
1866
|
-
write: false,
|
|
1867
|
-
unit: 'm³',
|
|
1868
|
-
def: 0,
|
|
1869
|
-
},
|
|
1870
|
-
native: {},
|
|
1871
|
-
});
|
|
1872
|
-
|
|
1873
|
-
// Also add HT/NT volume totals if gas has HT/NT enabled
|
|
1874
|
-
if (adapter.config.gasHtNtEnabled) {
|
|
1875
|
-
const hntVolumeStates = ['weeklyVolumeHT', 'weeklyVolumeNT'];
|
|
1876
|
-
const hntVolumeLabels = {
|
|
1877
|
-
weeklyVolumeHT: 'Wochenverbrauch Gesamt Haupttarif (HT) (m³)',
|
|
1878
|
-
weeklyVolumeNT: 'Wochenverbrauch Gesamt Nebentarif (NT) (m³)',
|
|
1879
|
-
};
|
|
1880
|
-
|
|
1881
|
-
for (const state of hntVolumeStates) {
|
|
1882
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.${state}`, {
|
|
1883
|
-
type: 'state',
|
|
1884
|
-
common: {
|
|
1885
|
-
name: hntVolumeLabels[state],
|
|
1886
|
-
type: 'number',
|
|
1887
|
-
role: STATE_ROLES.consumption,
|
|
1888
|
-
read: true,
|
|
1889
|
-
write: false,
|
|
1890
|
-
unit: 'm³',
|
|
1891
|
-
def: 0,
|
|
1892
|
-
},
|
|
1893
|
-
native: {},
|
|
1894
|
-
});
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption.weekly`, {
|
|
1900
|
-
type: 'state',
|
|
1901
|
-
common: {
|
|
1902
|
-
name: `Wochenverbrauch Gesamt (${label.unit})`,
|
|
1903
|
-
type: 'number',
|
|
1904
|
-
role: STATE_ROLES.consumption,
|
|
1905
|
-
read: true,
|
|
1906
|
-
write: false,
|
|
1907
|
-
unit: label.unit,
|
|
1908
|
-
def: 0,
|
|
1909
|
-
},
|
|
1910
|
-
native: {},
|
|
1911
|
-
});
|
|
1912
|
-
|
|
1913
|
-
// COST STATES (totals)
|
|
1914
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs`, {
|
|
1915
|
-
type: 'channel',
|
|
1916
|
-
common: {
|
|
1917
|
-
name: 'Gesamtkosten',
|
|
1918
|
-
},
|
|
1919
|
-
native: {},
|
|
1920
|
-
});
|
|
1921
|
-
|
|
1922
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.daily`, {
|
|
1923
|
-
type: 'state',
|
|
1924
|
-
common: {
|
|
1925
|
-
name: 'Tageskosten Gesamt (€)',
|
|
1926
|
-
type: 'number',
|
|
1927
|
-
role: STATE_ROLES.cost,
|
|
1928
|
-
read: true,
|
|
1929
|
-
write: false,
|
|
1930
|
-
unit: '€',
|
|
1931
|
-
def: 0,
|
|
1932
|
-
},
|
|
1933
|
-
native: {},
|
|
1934
|
-
});
|
|
1935
|
-
|
|
1936
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.monthly`, {
|
|
1937
|
-
type: 'state',
|
|
1938
|
-
common: {
|
|
1939
|
-
name: 'Monatskosten Gesamt (€)',
|
|
1940
|
-
type: 'number',
|
|
1941
|
-
role: STATE_ROLES.cost,
|
|
1942
|
-
read: true,
|
|
1943
|
-
write: false,
|
|
1944
|
-
unit: '€',
|
|
1945
|
-
def: 0,
|
|
1946
|
-
},
|
|
1947
|
-
native: {},
|
|
1948
|
-
});
|
|
1949
|
-
|
|
1950
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.weekly`, {
|
|
1951
|
-
type: 'state',
|
|
1952
|
-
common: {
|
|
1953
|
-
name: 'Wochenkosten Gesamt (€)',
|
|
1954
|
-
type: 'number',
|
|
1955
|
-
role: STATE_ROLES.cost,
|
|
1956
|
-
read: true,
|
|
1957
|
-
write: false,
|
|
1958
|
-
unit: '€',
|
|
1959
|
-
def: 0,
|
|
1960
|
-
},
|
|
1961
|
-
native: {},
|
|
1962
|
-
});
|
|
1963
|
-
|
|
1964
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.costs.totalYearly`, {
|
|
1965
|
-
type: 'state',
|
|
1966
|
-
common: {
|
|
1967
|
-
name: 'Jahreskosten Gesamt (€)',
|
|
1968
|
-
type: 'number',
|
|
1969
|
-
role: STATE_ROLES.cost,
|
|
1970
|
-
read: true,
|
|
1971
|
-
write: false,
|
|
1972
|
-
unit: '€',
|
|
1973
|
-
def: 0,
|
|
1974
|
-
},
|
|
1975
|
-
native: {},
|
|
1976
|
-
});
|
|
1977
|
-
|
|
1978
|
-
adapter.log.debug(`Totals state structure created for ${type}`);
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
/**
|
|
1982
|
-
* Creates history structure for a specific year
|
|
1983
|
-
*
|
|
1984
|
-
* @param {object} adapter - The adapter instance
|
|
1985
|
-
* @param {string} type - 'gas', 'water', 'electricity', 'pv'
|
|
1986
|
-
* @param {string} meterName - Meter name
|
|
1987
|
-
* @param {number|string} year - Year (YYYY)
|
|
1988
|
-
* @returns {Promise<void>}
|
|
4
|
+
* Manages the creation and structure of all adapter states
|
|
5
|
+
* This file acts as a facade for the modularized state structures in ./state/
|
|
1989
6
|
*/
|
|
1990
|
-
async function createHistoryStructure(adapter, type, meterName, year) {
|
|
1991
|
-
const basePath = `${type}.${meterName}.history.${year}`;
|
|
1992
|
-
|
|
1993
|
-
await adapter.setObjectNotExistsAsync(`${type}.${meterName}.history`, {
|
|
1994
|
-
type: 'channel',
|
|
1995
|
-
common: { name: 'Historie' },
|
|
1996
|
-
native: {},
|
|
1997
|
-
});
|
|
1998
|
-
|
|
1999
|
-
await adapter.setObjectNotExistsAsync(basePath, {
|
|
2000
|
-
type: 'channel',
|
|
2001
|
-
common: { name: `Jahr ${year}` },
|
|
2002
|
-
native: { year },
|
|
2003
|
-
});
|
|
2004
|
-
|
|
2005
|
-
const unit = type === 'water' ? 'm³' : 'kWh';
|
|
2006
|
-
|
|
2007
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.consumption`, {
|
|
2008
|
-
type: 'state',
|
|
2009
|
-
common: {
|
|
2010
|
-
name: `Jahresverbrauch ${year} (${unit})`,
|
|
2011
|
-
type: 'number',
|
|
2012
|
-
role: STATE_ROLES.consumption,
|
|
2013
|
-
read: true,
|
|
2014
|
-
write: false,
|
|
2015
|
-
unit: unit,
|
|
2016
|
-
def: 0,
|
|
2017
|
-
},
|
|
2018
|
-
native: {},
|
|
2019
|
-
});
|
|
2020
|
-
|
|
2021
|
-
if (type === 'gas') {
|
|
2022
|
-
await adapter.setObjectNotExistsAsync(`${basePath}.volume`, {
|
|
2023
|
-
type: 'state',
|
|
2024
|
-
common: {
|
|
2025
|
-
name: `Jahresverbrauch ${year} (m³)`,
|
|
2026
|
-
type: 'number',
|
|
2027
|
-
role: STATE_ROLES.consumption,
|
|
2028
|
-
read: true,
|
|
2029
|
-
write: false,
|
|
2030
|
-
unit: 'm³',
|
|
2031
|
-
def: 0,
|
|
2032
|
-
},
|
|
2033
|
-
native: {},
|
|
2034
|
-
});
|
|
2035
|
-
}
|
|
2036
7
|
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
role: STATE_ROLES.cost,
|
|
2043
|
-
read: true,
|
|
2044
|
-
write: false,
|
|
2045
|
-
unit: '€',
|
|
2046
|
-
def: 0,
|
|
2047
|
-
},
|
|
2048
|
-
native: {},
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
8
|
+
const STATE_ROLES = require('./state/roles');
|
|
9
|
+
const { createUtilityStateStructure, deleteUtilityStateStructure } = require('./state/utility');
|
|
10
|
+
const createMeterStructure = require('./state/meter');
|
|
11
|
+
const createTotalsStructure = require('./state/totals');
|
|
12
|
+
const createHistoryStructure = require('./state/history');
|
|
2051
13
|
|
|
2052
14
|
module.exports = {
|
|
2053
15
|
createUtilityStateStructure,
|