iobroker.faikout 0.0.6 → 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 +21 -22
- package/io-package.json +48 -4
- 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 +15 -8
- /package/admin/i18n/{de/translations.json → de.json} +0 -0
- /package/admin/i18n/{en/translations.json → en.json} +0 -0
- /package/admin/i18n/{es/translations.json → es.json} +0 -0
- /package/admin/i18n/{fr/translations.json → fr.json} +0 -0
- /package/admin/i18n/{it/translations.json → it.json} +0 -0
- /package/admin/i18n/{nl/translations.json → nl.json} +0 -0
- /package/admin/i18n/{pl/translations.json → pl.json} +0 -0
- /package/admin/i18n/{pt/translations.json → pt.json} +0 -0
- /package/admin/i18n/{ru/translations.json → ru.json} +0 -0
- /package/admin/i18n/{uk/translations.json → uk.json} +0 -0
- /package/admin/i18n/{zh-cn/translations.json → zh-cn.json} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -65,6 +65,25 @@ 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
|
+
|
|
81
|
+
### 0.0.7
|
|
82
|
+
- Maintenance release: `@iobroker/adapter-core` 3.4.3 and `@iobroker/testing` 6.2.1, tests also on
|
|
83
|
+
Node.js 26, `testing-action-check` v2, admin translations in the short format
|
|
84
|
+
(`admin/i18n/<lang>.json`), `tsconfig.json` and JSON schemas for VS Code.
|
|
85
|
+
- Published through GitHub Actions with provenance (0.0.6 had been published manually).
|
|
86
|
+
|
|
68
87
|
### 0.0.6
|
|
69
88
|
- Released through GitHub Actions with npm provenance (trusted publishing). No functional
|
|
70
89
|
changes; 0.0.5 was published manually and therefore carries no provenance attestation.
|
|
@@ -74,27 +93,7 @@ module's **Extra** settings makes it report immediately.
|
|
|
74
93
|
`common.main`, fixed responsive column widths, and translated the admin texts into the nine
|
|
75
94
|
remaining languages.
|
|
76
95
|
|
|
77
|
-
|
|
78
|
-
- Fix: the admin rejected the whole configuration with "invalid jsonConfig". `instance` fields
|
|
79
|
-
do not allow `visible` (their schema sets `additionalProperties: false`); the condition
|
|
80
|
-
belongs in `hidden`. The configuration is now validated against the official schema.
|
|
81
|
-
|
|
82
|
-
### 0.0.3
|
|
83
|
-
- Fix: consumption tracking crashed on every meter reading after updating from 0.0.1
|
|
84
|
-
("Cannot read properties of undefined") because the stored state predates the day and month
|
|
85
|
-
buffers. Stored state is merged into a fresh default now.
|
|
86
|
-
- Fix: with no month recorded yet, the month rollover booked the whole meter reading as last
|
|
87
|
-
month's consumption (3783 kWh instead of the difference).
|
|
88
|
-
- `npm test` only ran the package checks; the unit tests now run with it.
|
|
89
|
-
|
|
90
|
-
### 0.0.2
|
|
91
|
-
- New VIS widget **Energy history**: bar chart switchable between day, month and year, with
|
|
92
|
-
cooling and heating shown separately.
|
|
93
|
-
- Consumption now also covers the current and previous month, and keeps three series ready for
|
|
94
|
-
charting: `stundenJson` (48 hours), `tageJson` (62 days) and `monateJson` (24 months).
|
|
95
|
-
|
|
96
|
-
### 0.0.1
|
|
97
|
-
- Initial version: own MQTT broker, dynamically created data points, writable controls.
|
|
96
|
+
[Older changelog entries can be found here](CHANGELOG_OLD.md)
|
|
98
97
|
|
|
99
98
|
## Trademark and relationship to the hardware project
|
|
100
99
|
|
|
@@ -112,7 +111,7 @@ the protocol prescribes. The hardware project is licensed under the GPL, this ad
|
|
|
112
111
|
|
|
113
112
|
MIT License
|
|
114
113
|
|
|
115
|
-
Copyright (c) 2026 Immanuel
|
|
114
|
+
Copyright (c) 2026 Immanuel <github@freitag.online>
|
|
116
115
|
|
|
117
116
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
118
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",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"zh-cn": "通过 MQTT 在本地连接带 faikout 模块的大金空调。"
|
|
30
30
|
},
|
|
31
31
|
"authors": [
|
|
32
|
-
"Immanuel"
|
|
32
|
+
"Immanuel <github@freitag.online>"
|
|
33
33
|
],
|
|
34
34
|
"keywords": [
|
|
35
35
|
"faikout",
|
|
@@ -68,6 +68,32 @@
|
|
|
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
|
+
},
|
|
84
|
+
"0.0.7": {
|
|
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.",
|
|
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.",
|
|
87
|
+
"ru": "Сопровождающий выпуск: зависимости обновлены, тесты теперь выполняются и на Node.js 26, переводы интерфейса администратора переведены в короткий формат файлов. Опубликовано через GitHub Actions с provenance.",
|
|
88
|
+
"pt": "Versão de manutenção: dependências atualizadas, os testes correm agora também no Node.js 26, traduções do admin migradas para o formato curto de ficheiros. Publicado através do GitHub Actions com provenance.",
|
|
89
|
+
"nl": "Onderhoudsversie: afhankelijkheden bijgewerkt, tests draaien nu ook op Node.js 26, admin-vertalingen omgezet naar het korte bestandsformaat. Gepubliceerd via GitHub Actions met provenance.",
|
|
90
|
+
"fr": "Version de maintenance : dépendances mises à jour, les tests s'exécutent désormais aussi sous Node.js 26, traductions de l'admin converties au format de fichier court. Publiée via GitHub Actions avec provenance.",
|
|
91
|
+
"it": "Versione di manutenzione: dipendenze aggiornate, i test ora vengono eseguiti anche su Node.js 26, traduzioni dell'admin convertite nel formato di file breve. Pubblicata tramite GitHub Actions con provenance.",
|
|
92
|
+
"es": "Versión de mantenimiento: dependencias actualizadas, las pruebas ahora también se ejecutan en Node.js 26, traducciones del admin convertidas al formato de archivo corto. Publicada mediante GitHub Actions con provenance.",
|
|
93
|
+
"pl": "Wydanie serwisowe: zaktualizowano zależności, testy działają teraz także na Node.js 26, tłumaczenia panelu admin przeniesiono do krótkiego formatu plików. Opublikowano przez GitHub Actions z provenance.",
|
|
94
|
+
"uk": "Сервісний випуск: залежності оновлено, тести тепер виконуються й на Node.js 26, переклади адмін-панелі переведено в короткий формат файлів. Опубліковано через GitHub Actions з provenance.",
|
|
95
|
+
"zh-cn": "维护版本:更新依赖项,测试现在也在 Node.js 26 上运行,管理界面翻译改为简短文件格式。通过 GitHub Actions 发布并附带来源证明(provenance)。"
|
|
96
|
+
},
|
|
71
97
|
"0.0.6": {
|
|
72
98
|
"en": "Released through GitHub Actions with npm provenance",
|
|
73
99
|
"de": "Veroeffentlichung ueber GitHub Actions mit npm-Provenance",
|
|
@@ -121,7 +147,16 @@
|
|
|
121
147
|
"common": {
|
|
122
148
|
"name": {
|
|
123
149
|
"en": "Information",
|
|
124
|
-
"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": "信息"
|
|
125
160
|
}
|
|
126
161
|
},
|
|
127
162
|
"native": {}
|
|
@@ -133,7 +168,16 @@
|
|
|
133
168
|
"role": "indicator.connected",
|
|
134
169
|
"name": {
|
|
135
170
|
"en": "At least one faikout module connected",
|
|
136
|
-
"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 模块"
|
|
137
181
|
},
|
|
138
182
|
"type": "boolean",
|
|
139
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 = () => {
|