iobroker.faikout 0.0.7 → 0.0.8
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 +1 -1
- package/README.md +15 -22
- package/io-package.json +34 -3
- package/lib/broker.js +35 -8
- package/lib/fields.js +349 -69
- package/lib/namen.js +932 -0
- package/lib/verbrauch.js +91 -38
- package/main.js +171 -58
- package/package.json +8 -5
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -65,6 +65,19 @@ module's **Extra** settings makes it report immediately.
|
|
|
65
65
|
|
|
66
66
|
## Changelog
|
|
67
67
|
|
|
68
|
+
<!--
|
|
69
|
+
Placeholder for the next version (at the beginning of the line):
|
|
70
|
+
### **WORK IN PROGRESS**
|
|
71
|
+
-->
|
|
72
|
+
|
|
73
|
+
### 0.0.8
|
|
74
|
+
- Object structure fixed for the repository check: all datapoint names now in eleven languages
|
|
75
|
+
(`lib/namen.js`), invalid roles corrected (`info` → `info.name`/`info.address`/`text`,
|
|
76
|
+
`level.mode.*` → `state`), instance objects translated as well. New test `test/namen.js`.
|
|
77
|
+
- Shared `@iobroker/eslint-config` and `@alcalzone/release-script` adopted, older changelog
|
|
78
|
+
entries moved to `CHANGELOG_OLD.md`, `.vscode/settings.json` added, contact address in the
|
|
79
|
+
copyright line.
|
|
80
|
+
|
|
68
81
|
### 0.0.7
|
|
69
82
|
- Maintenance release: `@iobroker/adapter-core` 3.4.3 and `@iobroker/testing` 6.2.1, tests also on
|
|
70
83
|
Node.js 26, `testing-action-check` v2, admin translations in the short format
|
|
@@ -80,27 +93,7 @@ module's **Extra** settings makes it report immediately.
|
|
|
80
93
|
`common.main`, fixed responsive column widths, and translated the admin texts into the nine
|
|
81
94
|
remaining languages.
|
|
82
95
|
|
|
83
|
-
|
|
84
|
-
- Fix: the admin rejected the whole configuration with "invalid jsonConfig". `instance` fields
|
|
85
|
-
do not allow `visible` (their schema sets `additionalProperties: false`); the condition
|
|
86
|
-
belongs in `hidden`. The configuration is now validated against the official schema.
|
|
87
|
-
|
|
88
|
-
### 0.0.3
|
|
89
|
-
- Fix: consumption tracking crashed on every meter reading after updating from 0.0.1
|
|
90
|
-
("Cannot read properties of undefined") because the stored state predates the day and month
|
|
91
|
-
buffers. Stored state is merged into a fresh default now.
|
|
92
|
-
- Fix: with no month recorded yet, the month rollover booked the whole meter reading as last
|
|
93
|
-
month's consumption (3783 kWh instead of the difference).
|
|
94
|
-
- `npm test` only ran the package checks; the unit tests now run with it.
|
|
95
|
-
|
|
96
|
-
### 0.0.2
|
|
97
|
-
- New VIS widget **Energy history**: bar chart switchable between day, month and year, with
|
|
98
|
-
cooling and heating shown separately.
|
|
99
|
-
- Consumption now also covers the current and previous month, and keeps three series ready for
|
|
100
|
-
charting: `stundenJson` (48 hours), `tageJson` (62 days) and `monateJson` (24 months).
|
|
101
|
-
|
|
102
|
-
### 0.0.1
|
|
103
|
-
- Initial version: own MQTT broker, dynamically created data points, writable controls.
|
|
96
|
+
[Older changelog entries can be found here](CHANGELOG_OLD.md)
|
|
104
97
|
|
|
105
98
|
## Trademark and relationship to the hardware project
|
|
106
99
|
|
|
@@ -118,7 +111,7 @@ the protocol prescribes. The hardware project is licensed under the GPL, this ad
|
|
|
118
111
|
|
|
119
112
|
MIT License
|
|
120
113
|
|
|
121
|
-
Copyright (c) 2026 Immanuel
|
|
114
|
+
Copyright (c) 2026 Immanuel <github@freitag.online>
|
|
122
115
|
|
|
123
116
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
124
117
|
of this software and associated documentation files (the "Software"), to deal
|
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "faikout",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "Faikout",
|
|
7
7
|
"de": "Faikout",
|
|
@@ -68,6 +68,19 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"news": {
|
|
71
|
+
"0.0.8": {
|
|
72
|
+
"en": "Object structure fixed for the repository check: all datapoint names in eleven languages, invalid roles corrected (info, level.mode.*). Shared ESLint config and release script adopted.",
|
|
73
|
+
"de": "Objektstruktur für die Repository-Prüfung berichtigt: alle Datenpunktnamen in elf Sprachen, ungültige Rollen korrigiert (info, level.mode.*). Gemeinsame ESLint-Konfiguration und Release-Skript übernommen.",
|
|
74
|
+
"ru": "Структура объектов исправлена для проверки репозитория: все имена точек данных на одиннадцати языках, исправлены недопустимые роли (info, level.mode.*). Внедрены общая конфигурация ESLint и скрипт выпуска.",
|
|
75
|
+
"pt": "Estrutura de objetos corrigida para a verificação do repositório: todos os nomes de pontos de dados em onze idiomas, funções inválidas corrigidas (info, level.mode.*). Adotada a configuração ESLint partilhada e o script de lançamento.",
|
|
76
|
+
"nl": "Objectstructuur gecorrigeerd voor de repositorycontrole: alle datapuntnamen in elf talen, ongeldige rollen gecorrigeerd (info, level.mode.*). Gedeelde ESLint-configuratie en releasescript overgenomen.",
|
|
77
|
+
"fr": "Structure des objets corrigée pour la vérification du dépôt : tous les noms de points de données en onze langues, rôles invalides corrigés (info, level.mode.*). Configuration ESLint partagée et script de publication adoptés.",
|
|
78
|
+
"it": "Struttura degli oggetti corretta per il controllo del repository: tutti i nomi dei punti dati in undici lingue, ruoli non validi corretti (info, level.mode.*). Adottati la configurazione ESLint condivisa e lo script di rilascio.",
|
|
79
|
+
"es": "Estructura de objetos corregida para la comprobación del repositorio: todos los nombres de puntos de datos en once idiomas, roles no válidos corregidos (info, level.mode.*). Adoptada la configuración ESLint compartida y el script de publicación.",
|
|
80
|
+
"pl": "Poprawiono strukturę obiektów na potrzeby kontroli repozytorium: wszystkie nazwy punktów danych w jedenastu językach, poprawiono nieprawidłowe role (info, level.mode.*). Przyjęto wspólną konfigurację ESLint i skrypt wydania.",
|
|
81
|
+
"uk": "Структуру об'єктів виправлено для перевірки репозиторію: усі назви точок даних одинадцятьма мовами, виправлено недійсні ролі (info, level.mode.*). Запроваджено спільну конфігурацію ESLint і скрипт випуску.",
|
|
82
|
+
"zh-cn": "为仓库检查修正了对象结构:所有数据点名称提供十一种语言,更正了无效角色(info、level.mode.*)。采用共享 ESLint 配置和发布脚本。"
|
|
83
|
+
},
|
|
71
84
|
"0.0.7": {
|
|
72
85
|
"en": "Maintenance release: dependencies updated, tests now also run on Node.js 26, admin translations moved to the short file format. Published through GitHub Actions with provenance.",
|
|
73
86
|
"de": "Wartungsversion: Abhängigkeiten aktualisiert, Tests laufen jetzt auch unter Node.js 26, Admin-Übersetzungen ins kurze Dateiformat umgestellt. Veröffentlicht über GitHub Actions mit Provenance.",
|
|
@@ -134,7 +147,16 @@
|
|
|
134
147
|
"common": {
|
|
135
148
|
"name": {
|
|
136
149
|
"en": "Information",
|
|
137
|
-
"de": "Informationen"
|
|
150
|
+
"de": "Informationen",
|
|
151
|
+
"ru": "Информация",
|
|
152
|
+
"pt": "Informação",
|
|
153
|
+
"nl": "Informatie",
|
|
154
|
+
"fr": "Informations",
|
|
155
|
+
"it": "Informazioni",
|
|
156
|
+
"es": "Información",
|
|
157
|
+
"pl": "Informacje",
|
|
158
|
+
"uk": "Інформація",
|
|
159
|
+
"zh-cn": "信息"
|
|
138
160
|
}
|
|
139
161
|
},
|
|
140
162
|
"native": {}
|
|
@@ -146,7 +168,16 @@
|
|
|
146
168
|
"role": "indicator.connected",
|
|
147
169
|
"name": {
|
|
148
170
|
"en": "At least one faikout module connected",
|
|
149
|
-
"de": "Mindestens ein faikout-Modul verbunden"
|
|
171
|
+
"de": "Mindestens ein faikout-Modul verbunden",
|
|
172
|
+
"ru": "Подключён хотя бы один модуль faikout",
|
|
173
|
+
"pt": "Pelo menos um módulo faikout ligado",
|
|
174
|
+
"nl": "Ten minste één faikout-module verbonden",
|
|
175
|
+
"fr": "Au moins un module faikout connecté",
|
|
176
|
+
"it": "Almeno un modulo faikout connesso",
|
|
177
|
+
"es": "Al menos un módulo faikout conectado",
|
|
178
|
+
"pl": "Co najmniej jeden moduł faikout połączony",
|
|
179
|
+
"uk": "Підключено щонайменше один модуль faikout",
|
|
180
|
+
"zh-cn": "至少已连接一个 faikout 模块"
|
|
150
181
|
},
|
|
151
182
|
"type": "boolean",
|
|
152
183
|
"read": true,
|
package/lib/broker.js
CHANGED
|
@@ -12,15 +12,18 @@ const net = require('node:net');
|
|
|
12
12
|
// aedes 1.x exportiert die Klasse benannt; der Aufruf als Funktion (aedes(...)) faellt weg.
|
|
13
13
|
const { Aedes } = require('aedes');
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Der MQTT-Broker, mit dem sich die faikout-Module verbinden.
|
|
17
|
+
*/
|
|
15
18
|
class FaikoutBroker {
|
|
16
19
|
/**
|
|
17
|
-
* @param {object} opts
|
|
20
|
+
* @param {object} opts Einstellungen des Brokers
|
|
18
21
|
* @param {number} opts.port Port, auf dem gelauscht wird
|
|
19
22
|
* @param {string} [opts.user] Optionaler Benutzername; leer = keine Anmeldung noetig
|
|
20
23
|
* @param {string} [opts.pass] Passwort dazu
|
|
21
24
|
* @param {object} opts.log Logger des Adapters
|
|
22
|
-
* @param {(topic:string, payload:Buffer)=>void} opts.onMessage
|
|
23
|
-
* @param {(clientId:string, verbunden:boolean)=>void} [opts.onClient]
|
|
25
|
+
* @param {(topic:string, payload:Buffer)=>void} opts.onMessage je eingehender Nachricht
|
|
26
|
+
* @param {(clientId:string, verbunden:boolean)=>void} [opts.onClient] bei An- und Abmeldung eines Moduls
|
|
24
27
|
*/
|
|
25
28
|
constructor(opts) {
|
|
26
29
|
this.port = opts.port;
|
|
@@ -33,6 +36,11 @@ class FaikoutBroker {
|
|
|
33
36
|
this.server = null;
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Den Broker starten und auf dem eingestellten Port lauschen.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<void>} erfuellt, sobald der Port angenommen wird
|
|
43
|
+
*/
|
|
36
44
|
async start() {
|
|
37
45
|
// aedes 1.x wird ueber eine asynchrone Fabrik erzeugt. Ein blosses `new Aedes()`
|
|
38
46
|
// liefert zwar eine Instanz, deren `handle` aber nie antwortet - der Client laeuft
|
|
@@ -43,7 +51,9 @@ class FaikoutBroker {
|
|
|
43
51
|
// Ohne Benutzer bleibt der Broker offen - im eigenen LAN der uebliche Fall, und
|
|
44
52
|
// die faikout-Module koennen ohne Anmeldung senden.
|
|
45
53
|
authenticate: (client, username, password, done) => {
|
|
46
|
-
if (!this.user)
|
|
54
|
+
if (!this.user) {
|
|
55
|
+
return done(null, true);
|
|
56
|
+
}
|
|
47
57
|
const u = username ? String(username) : '';
|
|
48
58
|
const p = password ? password.toString() : '';
|
|
49
59
|
if (u !== this.user || p !== this.pass) {
|
|
@@ -70,7 +80,9 @@ class FaikoutBroker {
|
|
|
70
80
|
});
|
|
71
81
|
this.broker.on('publish', (packet, client) => {
|
|
72
82
|
// Ohne client sind es die internen $SYS-Nachrichten des Brokers.
|
|
73
|
-
if (!client || !packet || !packet.topic)
|
|
83
|
+
if (!client || !packet || !packet.topic) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
74
86
|
try {
|
|
75
87
|
this.onMessage(packet.topic, packet.payload);
|
|
76
88
|
} catch (e) {
|
|
@@ -92,20 +104,35 @@ class FaikoutBroker {
|
|
|
92
104
|
});
|
|
93
105
|
}
|
|
94
106
|
|
|
95
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Veroeffentlicht ein Kommando an ein Geraet.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} topic Zieltopic des Moduls
|
|
111
|
+
* @param {string|Buffer} payload Nutzlast
|
|
112
|
+
* @returns {Promise<void>} erfuellt, sobald der Broker die Nachricht angenommen hat
|
|
113
|
+
*/
|
|
96
114
|
publish(topic, payload) {
|
|
97
115
|
return new Promise(resolve => {
|
|
98
|
-
if (!this.broker)
|
|
116
|
+
if (!this.broker) {
|
|
117
|
+
return resolve(false);
|
|
118
|
+
}
|
|
99
119
|
this.broker.publish(
|
|
100
120
|
{ topic, payload: Buffer.from(String(payload)), qos: 0, retain: false, cmd: 'publish' },
|
|
101
121
|
err => {
|
|
102
|
-
if (err)
|
|
122
|
+
if (err) {
|
|
123
|
+
this.log.warn(`Senden an "${topic}" fehlgeschlagen: ${err.message}`);
|
|
124
|
+
}
|
|
103
125
|
resolve(!err);
|
|
104
126
|
},
|
|
105
127
|
);
|
|
106
128
|
});
|
|
107
129
|
}
|
|
108
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Den Broker beenden und alle Verbindungen schliessen.
|
|
133
|
+
*
|
|
134
|
+
* @returns {Promise<void>} erfuellt, wenn der Port wieder frei ist
|
|
135
|
+
*/
|
|
109
136
|
stop() {
|
|
110
137
|
return new Promise(resolve => {
|
|
111
138
|
const fertig = () => {
|