iobroker.faikout 0.0.17 → 0.0.19
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 +42 -55
- package/io-package.json +27 -27
- package/lib/fields.js +64 -0
- package/lib/namen.js +11 -0
- package/lib/verbrauch.js +24 -0
- package/main.js +131 -11
- package/package.json +2 -2
- package/widgets/faikout/js/faikout.js +56 -15
- package/widgets/faikout.html +12 -36
package/README.md
CHANGED
|
@@ -89,12 +89,54 @@ Out of the box a module reports its state every 60 seconds (`reporting` setting)
|
|
|
89
89
|
is only confirmed with the next report — expect up to a minute. Enabling `livestatus` in the
|
|
90
90
|
module's **Extra** settings makes it report immediately.
|
|
91
91
|
|
|
92
|
+
### Settings the air conditioner does not accept
|
|
93
|
+
|
|
94
|
+
A module sends a setting to the air conditioner and reads it back. If the unit still reports its old
|
|
95
|
+
value after several rounds (`s21.tries`, 10 by default), the module drops the change, shows the value
|
|
96
|
+
of the unit again and publishes the rejected fields on `error/<name>/failed-set`. Until then the module
|
|
97
|
+
already shows the requested value, so it looks as if something had reset it.
|
|
98
|
+
|
|
99
|
+
The adapter logs this as a warning (`… the air conditioner did not accept demand=90 …`) and stores the
|
|
100
|
+
last rejection in `<device>.info.failedSet` as JSON with the requested values and the time:
|
|
101
|
+
`{"time":"2026-11-05T14:40:51.085Z","settings":{"demand":90}}`. The adapter itself does not send
|
|
102
|
+
anything in this situation.
|
|
103
|
+
|
|
104
|
+
Known case: **demand control** (`control.demand`). Some units acknowledge the command but keep
|
|
105
|
+
reporting 100 % — seen on units that still have Daikin's own WiFi adapter fitted. The module can only
|
|
106
|
+
pass on the percentage; the modes of Daikin's app (off / automatic / fixed) are not part of what is
|
|
107
|
+
known about the S21 interface. Econo is only taken over while the unit is running.
|
|
108
|
+
|
|
109
|
+
## Visualisation (vis templates)
|
|
110
|
+
|
|
111
|
+
The folder [`vis-templates/`](vis-templates/) contains ready-made **vis 1** views for two units: overview,
|
|
112
|
+
one detail page per unit with controls, energy history and a phone view. They use only data points of
|
|
113
|
+
`faikout.0` and the widgets of this adapter – no scripts, no other adapters. Import instructions:
|
|
114
|
+
[vis-templates/README.md](vis-templates/README.md).
|
|
115
|
+
|
|
92
116
|
## Changelog
|
|
93
117
|
|
|
94
118
|
<!--
|
|
95
119
|
Placeholder for the next version (at the beginning of the line):
|
|
96
120
|
### **WORK IN PROGRESS**
|
|
97
121
|
-->
|
|
122
|
+
### 0.0.19 (2026-11-10)
|
|
123
|
+
- A setting the air conditioner does not accept (module message `error/<name>/failed-set`, e.g. demand control) is
|
|
124
|
+
logged as a clear warning instead of the bare payload, and the last rejection is stored in the new state
|
|
125
|
+
`info.failedSet` (requested values and time). Other module errors are logged with their topic (`comms`, …).
|
|
126
|
+
- Much lower CPU and database load (issue #5): states are only written when their value changes (unchanged values are
|
|
127
|
+
refreshed every 5 minutes so their timestamp stays current), the hourly JSON series only at the change of hour, the
|
|
128
|
+
daily/monthly series only when their content changes, and the meter readings in the device object at the change of
|
|
129
|
+
hour, after a rebase, every 10 minutes at most and on shutdown – instead of everything on every module message.
|
|
130
|
+
|
|
131
|
+
### 0.0.18 (2026-10-25)
|
|
132
|
+
- VIS widgets: fixed rendering in the vis runtime – the widgets showed nothing and logged `missing ) after argument list`.
|
|
133
|
+
They now subscribe the data points of their device themselves (vis only subscribed the device object), so values
|
|
134
|
+
and states are shown and kept up to date. Energy history: works with vis 1 (`getStates`), shows a fixed range
|
|
135
|
+
(last 24 hours / 31 days / 12 months) and formats numbers in the VIS language.
|
|
136
|
+
- VIS widgets: the accent colour follows the mode again (heating orange, cooling blue, off grey) – jQuery 1.11 in vis 1
|
|
137
|
+
cannot set CSS custom properties with `.css()`, so it always stayed blue.
|
|
138
|
+
- New: vis templates (`vis-templates/`) – overview, detail page per unit, energy and phone view.
|
|
139
|
+
|
|
98
140
|
### 0.0.17
|
|
99
141
|
- Fixed units of `status.comp` and `status.fanfreq`: the module sends Hz by default and rpm only with `ha.comprpm`/`ha.fanrpm`.
|
|
100
142
|
The adapter now takes the unit from the module's Home Assistant discovery (a fractional fan value is always Hz),
|
|
@@ -112,61 +154,6 @@ module's **Extra** settings makes it report immediately.
|
|
|
112
154
|
### 0.0.15
|
|
113
155
|
- The MQTT broker's shutdown timeout uses the adapter's `setTimeout` (repository checker E5005).
|
|
114
156
|
|
|
115
|
-
### 0.0.14
|
|
116
|
-
- **Breaking:** the consumption subtree uses English IDs: `consumption.{total|heating|cooling}.{currentHour|lastHour|today|yesterday|thisMonth|lastMonth}`
|
|
117
|
-
and `hoursJson`/`daysJson`/`monthsJson` (entries keyed `hour`/`day`/`month`). On start the adapter copies the last values of the
|
|
118
|
-
old `verbrauch.*` states to the new IDs and deletes the old objects. Data recorded by the history adapter stays under the old IDs.
|
|
119
|
-
- Config keys renamed to `historyRegister` / `historyInstance`; an existing configuration keeps working until it is saved again.
|
|
120
|
-
- `status.autoe` is now subscribed - writes were silently dropped before.
|
|
121
|
-
- Admin texts translated into all eleven languages; VIS widgets: English names, English select values (`light`/`dark`,
|
|
122
|
-
`day`/`month`/`year`, reading keys) and a dictionary for all eleven languages. Values saved by older views are still understood.
|
|
123
|
-
- Names of states for unknown fields carry all eleven languages.
|
|
124
|
-
|
|
125
|
-
### 0.0.13
|
|
126
|
-
- On start, names and roles of existing states are updated to the current field description. Objects are only created
|
|
127
|
-
when a value arrives, so rarely reported fields (like `status.reason`) kept their old description after an update.
|
|
128
|
-
|
|
129
|
-
### 0.0.12
|
|
130
|
-
- New state `status.reason`: the disconnect reason the broker publishes from the module's MQTT last will (value `LWT`),
|
|
131
|
-
now described with role and names in all eleven languages (it was created as an unknown field before).
|
|
132
|
-
|
|
133
|
-
### 0.0.11
|
|
134
|
-
- Remaining log messages in English (hour change, client disconnect/error, failed command).
|
|
135
|
-
- Stopping the adapter no longer hangs while faikout modules stay connected: open MQTT connections are closed actively,
|
|
136
|
-
with a 2 s upper limit (previously the js-controller killed the process after its stop timeout). New test.
|
|
137
|
-
|
|
138
|
-
### 0.0.10
|
|
139
|
-
- Review findings (PR #6700): all log messages and error texts in English (`main.js`, `lib/broker.js`, `lib/verbrauch.js`).
|
|
140
|
-
- `control.swing`: state labels in English (`off`, `on`, `vertical`, `horizontal`, `both`, `comfort`).
|
|
141
|
-
- VIS widgets: every visible text goes through a small translation helper – German for a German VIS, English for all other languages; decimal separator and month names follow the VIS language.
|
|
142
|
-
|
|
143
|
-
### 0.0.9
|
|
144
|
-
- Maintenance: `@iobroker/testing` updated to 6.3 (W0037).
|
|
145
|
-
- `.gitignore` uses `.vscode/*` so the tracked `.vscode/settings.json` is no longer covered by an ignore rule (W9008).
|
|
146
|
-
|
|
147
|
-
### 0.0.8
|
|
148
|
-
- Object structure fixed for the repository check: all datapoint names now in eleven languages
|
|
149
|
-
(`lib/namen.js`), invalid roles corrected (`info` → `info.name`/`info.address`/`text`,
|
|
150
|
-
`level.mode.*` → `state`), instance objects translated as well. New test `test/namen.js`.
|
|
151
|
-
- Shared `@iobroker/eslint-config` and `@alcalzone/release-script` adopted, older changelog
|
|
152
|
-
entries moved to `CHANGELOG_OLD.md`, `.vscode/settings.json` added, contact address in the
|
|
153
|
-
copyright line.
|
|
154
|
-
|
|
155
|
-
### 0.0.7
|
|
156
|
-
- Maintenance release: `@iobroker/adapter-core` 3.4.3 and `@iobroker/testing` 6.2.1, tests also on
|
|
157
|
-
Node.js 26, `testing-action-check` v2, admin translations in the short format
|
|
158
|
-
(`admin/i18n/<lang>.json`), `tsconfig.json` and JSON schemas for VS Code.
|
|
159
|
-
- Published through GitHub Actions with provenance (0.0.6 had been published manually).
|
|
160
|
-
|
|
161
|
-
### 0.0.6
|
|
162
|
-
- Released through GitHub Actions with npm provenance (trusted publishing). No functional
|
|
163
|
-
changes; 0.0.5 was published manually and therefore carries no provenance attestation.
|
|
164
|
-
|
|
165
|
-
### 0.0.5
|
|
166
|
-
- Meet the ioBroker repository requirements: updated dev dependencies, removed the deprecated
|
|
167
|
-
`common.main`, fixed responsive column widths, and translated the admin texts into the nine
|
|
168
|
-
remaining languages.
|
|
169
|
-
|
|
170
157
|
[Older changelog entries can be found here](CHANGELOG_OLD.md)
|
|
171
158
|
|
|
172
159
|
## Trademark and relationship to the hardware project
|
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.19",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "Faikout",
|
|
7
7
|
"de": "Faikout",
|
|
@@ -68,6 +68,32 @@
|
|
|
68
68
|
}
|
|
69
69
|
],
|
|
70
70
|
"news": {
|
|
71
|
+
"0.0.19": {
|
|
72
|
+
"en": "Much lower CPU and database load: states are only written when they change; rejected settings (failed-set) are logged clearly and stored in info.failedSet",
|
|
73
|
+
"de": "Deutlich weniger CPU- und Datenbanklast: Datenpunkte werden nur bei Änderung geschrieben; abgelehnte Einstellungen (failed-set) im Klartext geloggt und in info.failedSet abgelegt",
|
|
74
|
+
"ru": "Значительно меньшая нагрузка на ЦП и базу данных: состояния записываются только при изменении; отклонённые настройки (failed-set) понятно записываются в журнал и сохраняются в info.failedSet",
|
|
75
|
+
"pt": "Carga de CPU e base de dados muito menor: os estados só são escritos quando mudam; definições rejeitadas (failed-set) são registadas de forma clara e guardadas em info.failedSet",
|
|
76
|
+
"nl": "Veel minder CPU- en databasebelasting: states worden alleen bij wijziging geschreven; geweigerde instellingen (failed-set) worden duidelijk gelogd en opgeslagen in info.failedSet",
|
|
77
|
+
"fr": "Charge CPU et base de données nettement réduite : les états ne sont écrits que lorsqu’ils changent ; les réglages refusés (failed-set) sont journalisés clairement et enregistrés dans info.failedSet",
|
|
78
|
+
"it": "Carico di CPU e database molto inferiore: gli stati vengono scritti solo quando cambiano; le impostazioni rifiutate (failed-set) vengono registrate chiaramente e salvate in info.failedSet",
|
|
79
|
+
"es": "Mucha menos carga de CPU y de base de datos: los estados solo se escriben cuando cambian; los ajustes rechazados (failed-set) se registran con claridad y se guardan en info.failedSet",
|
|
80
|
+
"pl": "Znacznie mniejsze obciążenie CPU i bazy danych: stany są zapisywane tylko przy zmianie; odrzucone ustawienia (failed-set) są czytelnie logowane i zapisywane w info.failedSet",
|
|
81
|
+
"uk": "Значно менше навантаження на ЦП і базу даних: стани записуються лише при зміні; відхилені налаштування (failed-set) зрозуміло записуються в журнал і зберігаються в info.failedSet",
|
|
82
|
+
"zh-cn": "大幅降低 CPU 和数据库负载:状态仅在变化时写入;被拒绝的设置(failed-set)以清晰的日志记录并保存在 info.failedSet 中"
|
|
83
|
+
},
|
|
84
|
+
"0.0.18": {
|
|
85
|
+
"en": "VIS widgets render again in the vis runtime and show live values; mode colour on all widgets; energy history with fixed ranges; new vis templates",
|
|
86
|
+
"de": "VIS-Widgets werden in der vis-Laufzeit wieder gezeichnet und zeigen Live-Werte; Farbe der Betriebsart auf allen Widgets; Energieverlauf mit festen Zeiträumen; neue vis-Vorlagen",
|
|
87
|
+
"ru": "Виджеты VIS снова отображаются в среде выполнения vis и показывают текущие значения; цвет режима на всех виджетах; история энергии с фиксированными периодами; новые шаблоны vis",
|
|
88
|
+
"pt": "Os widgets VIS voltam a ser apresentados no runtime do vis e mostram valores em tempo real; cor do modo em todos os widgets; histórico de energia com períodos fixos; novos modelos vis",
|
|
89
|
+
"nl": "VIS-widgets worden weer weergegeven in de vis-runtime en tonen live waarden; kleur van de bedrijfsmodus op alle widgets; energieverloop met vaste perioden; nieuwe vis-sjablonen",
|
|
90
|
+
"fr": "Les widgets VIS s’affichent à nouveau dans le runtime vis et montrent les valeurs en direct ; couleur du mode sur tous les widgets ; historique d’énergie sur des périodes fixes ; nouveaux modèles vis",
|
|
91
|
+
"it": "I widget VIS vengono di nuovo visualizzati nel runtime di vis e mostrano i valori in tempo reale; colore della modalità su tutti i widget; storico energia con periodi fissi; nuovi modelli vis",
|
|
92
|
+
"es": "Los widgets VIS vuelven a mostrarse en el runtime de vis con valores en directo; color del modo en todos los widgets; historial de energía con periodos fijos; nuevas plantillas vis",
|
|
93
|
+
"pl": "Widżety VIS znów renderują się w środowisku vis i pokazują bieżące wartości; kolor trybu pracy na wszystkich widżetach; historia energii ze stałymi okresami; nowe szablony vis",
|
|
94
|
+
"uk": "Віджети VIS знову відображаються в середовищі vis і показують поточні значення; колір режиму на всіх віджетах; історія енергії з фіксованими періодами; нові шаблони vis",
|
|
95
|
+
"zh-cn": "VIS 小部件可在 vis 运行时中重新正常显示并显示实时数值;所有小部件显示运行模式颜色;能耗历史采用固定时间范围;新增 vis 模板"
|
|
96
|
+
},
|
|
71
97
|
"0.0.17": {
|
|
72
98
|
"en": "Units of compressor and fan speed detected from the module (Hz or rpm), all module fields described, new tab \"Module settings\"",
|
|
73
99
|
"de": "Einheit von Verdichter- und Lüfterdrehzahl wird am Modul erkannt (Hz oder rpm), alle Modulfelder beschrieben, neuer Reiter „Moduleinstellungen“",
|
|
@@ -132,32 +158,6 @@
|
|
|
132
158
|
"pl": "Przy starcie nazwy i role istniejących stanów są aktualizowane do bieżącego opisu pól (także dla rzadko przesyłanych pól)",
|
|
133
159
|
"uk": "Під час запуску назви та ролі наявних станів оновлюються до поточного опису полів (також для полів, що надходять рідко)",
|
|
134
160
|
"zh-cn": "启动时,现有状态的名称和角色会更新为当前字段描述(包括很少上报的字段)"
|
|
135
|
-
},
|
|
136
|
-
"0.0.12": {
|
|
137
|
-
"en": "New state status.reason (disconnect reason from the MQTT last will, e.g. \"LWT\") with names in all languages",
|
|
138
|
-
"de": "Neuer Datenpunkt status.reason (Grund der Trennung aus dem MQTT-„Last Will“, z. B. „LWT“) mit Namen in allen Sprachen",
|
|
139
|
-
"ru": "Новое состояние status.reason (причина отключения из MQTT last will, например «LWT») с названиями на всех языках",
|
|
140
|
-
"pt": "Novo estado status.reason (motivo da desconexão do MQTT last will, p. ex. «LWT») com nomes em todos os idiomas",
|
|
141
|
-
"nl": "Nieuwe status status.reason (reden van verbreking uit de MQTT last will, bijv. \"LWT\") met namen in alle talen",
|
|
142
|
-
"fr": "Nouvel état status.reason (cause de la déconnexion issue du last will MQTT, p. ex. « LWT ») avec des noms dans toutes les langues",
|
|
143
|
-
"it": "Nuovo stato status.reason (motivo della disconnessione dal last will MQTT, ad es. \"LWT\") con nomi in tutte le lingue",
|
|
144
|
-
"es": "Nuevo estado status.reason (motivo de la desconexión del last will de MQTT, p. ej. «LWT») con nombres en todos los idiomas",
|
|
145
|
-
"pl": "Nowy stan status.reason (przyczyna rozłączenia z MQTT last will, np. „LWT”) z nazwami we wszystkich językach",
|
|
146
|
-
"uk": "Новий стан status.reason (причина відключення з MQTT last will, напр. «LWT») з назвами всіма мовами",
|
|
147
|
-
"zh-cn": "新状态 status.reason(来自 MQTT 遗嘱消息的断开原因,例如“LWT”),名称支持所有语言"
|
|
148
|
-
},
|
|
149
|
-
"0.0.11": {
|
|
150
|
-
"en": "Remaining log messages in English; the adapter now stops quickly even while faikout modules stay connected (no more forced kill on stop)",
|
|
151
|
-
"de": "Restliche Log-Meldungen auf Englisch; der Adapter beendet sich jetzt schnell, auch wenn faikout-Module verbunden bleiben (kein erzwungener Abbruch mehr beim Stoppen)",
|
|
152
|
-
"ru": "Оставшиеся сообщения журнала на английском; адаптер теперь быстро останавливается, даже если модули faikout остаются подключёнными (больше нет принудительного завершения)",
|
|
153
|
-
"pt": "Restantes mensagens de registo em inglês; o adaptador para agora rapidamente mesmo com módulos faikout ligados (sem encerramento forçado ao parar)",
|
|
154
|
-
"nl": "Resterende logberichten in het Engels; de adapter stopt nu snel, ook als faikout-modules verbonden blijven (geen geforceerde beëindiging meer)",
|
|
155
|
-
"fr": "Messages de journal restants en anglais ; l'adaptateur s'arrête désormais rapidement même si des modules faikout restent connectés (plus d'arrêt forcé)",
|
|
156
|
-
"it": "Messaggi di log rimanenti in inglese; l'adattatore ora si arresta rapidamente anche con moduli faikout connessi (nessuna terminazione forzata)",
|
|
157
|
-
"es": "Mensajes de registro restantes en inglés; el adaptador ahora se detiene rápidamente aunque los módulos faikout sigan conectados (sin cierre forzado)",
|
|
158
|
-
"pl": "Pozostałe komunikaty dziennika po angielsku; adapter zatrzymuje się teraz szybko, nawet gdy moduły faikout pozostają połączone (bez wymuszonego zakończenia)",
|
|
159
|
-
"uk": "Решта повідомлень журналу англійською; адаптер тепер швидко зупиняється, навіть якщо модулі faikout залишаються підключеними (без примусового завершення)",
|
|
160
|
-
"zh-cn": "其余日志消息改为英文;即使 faikout 模块保持连接,适配器现在也能快速停止(停止时不再被强制终止)"
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
163
|
"restartAdapters": [
|
package/lib/fields.js
CHANGED
|
@@ -538,6 +538,19 @@ const FELDER = {
|
|
|
538
538
|
name: { en: 'Module online', de: 'Modul erreichbar' },
|
|
539
539
|
},
|
|
540
540
|
ts: { kanal: 'info', type: 'string', role: 'date', name: { en: 'Last message', de: 'Letzte Meldung' } },
|
|
541
|
+
// KEIN Feld der Statusmeldung: Der Adapter bildet diesen Datenpunkt selbst aus der Meldung
|
|
542
|
+
// error/<Name>/failed-set (siehe abgelehntAuswerten()). Inhalt als JSON:
|
|
543
|
+
// {"time":"<ISO-Zeit>","settings":{"demand":90}} - Feld, verlangter Wert und Zeitpunkt.
|
|
544
|
+
'failed-set': {
|
|
545
|
+
kanal: 'info',
|
|
546
|
+
type: 'string',
|
|
547
|
+
role: 'json',
|
|
548
|
+
id: 'failedSet',
|
|
549
|
+
name: {
|
|
550
|
+
en: 'Last setting rejected by the air conditioner',
|
|
551
|
+
de: 'Zuletzt von der Klimaanlage abgelehnte Einstellung',
|
|
552
|
+
},
|
|
553
|
+
},
|
|
541
554
|
};
|
|
542
555
|
|
|
543
556
|
/** Felder, die der Adapter nie als Datenpunkt anlegt (Struktur statt Wert). */
|
|
@@ -696,6 +709,56 @@ function ohneHaEnable(daten) {
|
|
|
696
709
|
return !!daten && daten.up === true && !Object.prototype.hasOwnProperty.call(daten, 'target');
|
|
697
710
|
}
|
|
698
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Wertet die Meldung `error/<Name>/failed-set` eines Moduls aus.
|
|
714
|
+
*
|
|
715
|
+
* Das Modul schickt eine Einstellung per S21 an die Klimaanlage und liest sie danach zurueck.
|
|
716
|
+
* Meldet die Anlage nach `s21.tries` Runden (ab Werk 10) immer noch ihren alten Wert, gibt das
|
|
717
|
+
* Modul auf, verwirft die Aenderung und veroeffentlicht die nicht uebernommenen Felder mit dem
|
|
718
|
+
* VERLANGTEN Wert als JSON, z. B. {"demand":90} (Faikout.c: revk_error ("failed-set", &j)).
|
|
719
|
+
* Bis dahin zeigt es den verlangten Wert schon an - ohne diese Meldung saehe es so aus, als
|
|
720
|
+
* haette jemand den Wert zurueckgestellt.
|
|
721
|
+
*
|
|
722
|
+
* Gemessen am 05.11.2026 mit `demand` (S21-Mitschnitt): Die Anlage quittiert den Befehl D7,
|
|
723
|
+
* meldet in G7 aber weiter 100 % - nach 12 Versuchen kommt failed-set {"demand":90}. Enum-Felder
|
|
724
|
+
* stehen im nativen Format des Moduls darin (mode "H", fan "3"), nicht im Klartext von state/.
|
|
725
|
+
*
|
|
726
|
+
* Verschachtelte Angaben zaehlen nicht als Einstellung: Sie werden als `details` durchgereicht,
|
|
727
|
+
* falls eine kuenftige Firmware dort Naeheres zur Ablehnung mitgibt.
|
|
728
|
+
*
|
|
729
|
+
* @param {string} unter Unterpfad des Topics hinter dem Geraetenamen ("failed-set")
|
|
730
|
+
* @param {string} text Nutzlast der Meldung (JSON)
|
|
731
|
+
* @returns {{settings: object, text: string, details?: object}|null} abgelehnte Felder und Klartext ("demand=90"), sonst null
|
|
732
|
+
*/
|
|
733
|
+
function abgelehntAuswerten(unter, text) {
|
|
734
|
+
if (unter !== 'failed-set') {
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
737
|
+
let daten;
|
|
738
|
+
try {
|
|
739
|
+
daten = JSON.parse(text);
|
|
740
|
+
} catch {
|
|
741
|
+
return null;
|
|
742
|
+
}
|
|
743
|
+
if (!daten || typeof daten !== 'object' || Array.isArray(daten)) {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
const settings = {};
|
|
747
|
+
const details = {};
|
|
748
|
+
for (const [name, wert] of Object.entries(daten)) {
|
|
749
|
+
(wert !== null && typeof wert === 'object' ? details : settings)[name] = wert;
|
|
750
|
+
}
|
|
751
|
+
const namen = Object.keys(settings);
|
|
752
|
+
if (!namen.length) {
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
const ergebnis = { settings, text: namen.map(n => `${n}=${JSON.stringify(settings[n])}`).join(', ') };
|
|
756
|
+
if (Object.keys(details).length) {
|
|
757
|
+
ergebnis.details = details;
|
|
758
|
+
}
|
|
759
|
+
return ergebnis;
|
|
760
|
+
}
|
|
761
|
+
|
|
699
762
|
module.exports = {
|
|
700
763
|
SPRACHEN,
|
|
701
764
|
FELDER,
|
|
@@ -711,4 +774,5 @@ module.exports = {
|
|
|
711
774
|
haSensorAuswerten,
|
|
712
775
|
einheitAusWert,
|
|
713
776
|
ohneHaEnable,
|
|
777
|
+
abgelehntAuswerten,
|
|
714
778
|
};
|
package/lib/namen.js
CHANGED
|
@@ -720,6 +720,17 @@ const UEBERSETZUNGEN = {
|
|
|
720
720
|
uk: 'Причина відключення або перезапуску',
|
|
721
721
|
'zh-cn': '断开或重启原因',
|
|
722
722
|
},
|
|
723
|
+
'Last setting rejected by the air conditioner': {
|
|
724
|
+
ru: 'Последняя настройка, отклонённая кондиционером',
|
|
725
|
+
pt: 'Última definição rejeitada pelo ar condicionado',
|
|
726
|
+
nl: 'Laatste door de airco geweigerde instelling',
|
|
727
|
+
fr: 'Dernier réglage refusé par le climatiseur',
|
|
728
|
+
it: 'Ultima impostazione rifiutata dal condizionatore',
|
|
729
|
+
es: 'Último ajuste rechazado por el aire acondicionado',
|
|
730
|
+
pl: 'Ostatnie ustawienie odrzucone przez klimatyzator',
|
|
731
|
+
uk: 'Останнє налаштування, відхилене кондиціонером',
|
|
732
|
+
'zh-cn': '空调最近拒绝的设置',
|
|
733
|
+
},
|
|
723
734
|
'Current action': {
|
|
724
735
|
ru: 'Текущее действие',
|
|
725
736
|
pt: 'Ação atual',
|
package/lib/verbrauch.js
CHANGED
|
@@ -216,6 +216,29 @@ function verarbeiten(stand, wert, jetzt = new Date()) {
|
|
|
216
216
|
return { stand: s, werte: ausgabe(s, wert), hinweise };
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Aendert dieser Zaehlerstand nichts? Das ist der Fall, wenn der Rohwert gleich dem zuletzt
|
|
221
|
+
* gesehenen ist und Stunde, Tag und Monat noch dieselben sind - dann kaeme bei verarbeiten()
|
|
222
|
+
* genau der bisherige Zustand heraus. Der Adapter spart sich damit Rechnung und Schreiben bei
|
|
223
|
+
* jeder Statusmeldung einer stehenden Anlage (Issue #5: 27 % CPU bei vier Geraeten).
|
|
224
|
+
*
|
|
225
|
+
* @param {object|null} stand bisheriger Zustand
|
|
226
|
+
* @param {number} wert aktueller Gesamtzaehler in Wh
|
|
227
|
+
* @param {Date} [jetzt] Zeitpunkt (fuer Tests setzbar)
|
|
228
|
+
* @returns {boolean} true, wenn nichts zu tun ist
|
|
229
|
+
*/
|
|
230
|
+
function unveraendert(stand, wert, jetzt = new Date()) {
|
|
231
|
+
return (
|
|
232
|
+
!!stand &&
|
|
233
|
+
stand.letzterWert === wert &&
|
|
234
|
+
stand.basisStunde !== null &&
|
|
235
|
+
stand.basisTag !== null &&
|
|
236
|
+
stand.stunde === stundeVon(jetzt) &&
|
|
237
|
+
stand.tag === tagVon(jetzt) &&
|
|
238
|
+
stand.monat === monatVon(jetzt)
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
219
242
|
/**
|
|
220
243
|
* Stossen ohne neuen Zaehlerstand - fuer den Timer auf die volle Stunde. Meldet einen
|
|
221
244
|
* Stunden- bzw. Tageswechsel auch dann, wenn gerade keine Nachricht hereinkam.
|
|
@@ -272,6 +295,7 @@ function ausgabe(s, wert) {
|
|
|
272
295
|
module.exports = {
|
|
273
296
|
verarbeiten,
|
|
274
297
|
pruefen,
|
|
298
|
+
unveraendert,
|
|
275
299
|
neuerStand,
|
|
276
300
|
stundeVon,
|
|
277
301
|
tagVon,
|
package/main.js
CHANGED
|
@@ -67,6 +67,21 @@ const VERBRAUCH_REIHEN = [
|
|
|
67
67
|
},
|
|
68
68
|
];
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Ein unveraenderter Wert wird nicht bei jeder Nachricht neu geschrieben, aber spaetestens nach
|
|
72
|
+
* dieser Zeit wieder - damit der Zeitstempel (ts) eines Datenpunkts nicht stehen bleibt und
|
|
73
|
+
* Ueberwachungen wie device-watcher ein lebendes Geraet nicht fuer tot halten.
|
|
74
|
+
*/
|
|
75
|
+
const AUFFRISCHEN_MS = 5 * 60 * 1000;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Zaehlerstaende (native.zaehler) werden ausser bei Stundenwechsel, Hinweisen und Beenden
|
|
79
|
+
* hoechstens so oft gesichert. Was nach einem Absturz dazwischen fehlt, faengt verbrauch.js ab:
|
|
80
|
+
* gerechnet wird immer Rohwert minus Basis, der Verbrauch landet also nur spaeter, nicht doppelt
|
|
81
|
+
* und nicht verloren.
|
|
82
|
+
*/
|
|
83
|
+
const SICHERN_MS = 10 * 60 * 1000;
|
|
84
|
+
|
|
70
85
|
class Faikout extends utils.Adapter {
|
|
71
86
|
constructor(options) {
|
|
72
87
|
super({ ...options, name: 'faikout' });
|
|
@@ -90,6 +105,20 @@ class Faikout extends utils.Adapter {
|
|
|
90
105
|
/** Geraete, fuer die schon vor ausgeschaltetem ha.enable gewarnt wurde (einmal je Lauf). */
|
|
91
106
|
this.haWarnung = new Set();
|
|
92
107
|
|
|
108
|
+
/** Letzte Warnung "Einstellung abgelehnt" je Geraet: {text, zeit} - gegen Wiederholungen im Log. */
|
|
109
|
+
this.abgelehntWarnung = new Map();
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Schreib-Zwischenspeicher: stateId -> {val, zeit} des zuletzt geschriebenen Werts.
|
|
113
|
+
* Bis 0.0.18 schrieb der Adapter bei jeder Statusmeldung alle Datenpunkte samt drei
|
|
114
|
+
* JSON-Reihen und dem Zaehlerstand ins Objekt - bei vier Geraeten 27 % CPU (Issue #5).
|
|
115
|
+
* Beim Start leer, der erste Durchlauf schreibt also alles.
|
|
116
|
+
*/
|
|
117
|
+
this.geschrieben = new Map();
|
|
118
|
+
|
|
119
|
+
/** Stunde, fuer die die Stundenreihe (hoursJson) zuletzt geschrieben wurde, je stateId. */
|
|
120
|
+
this.reihenStunde = new Map();
|
|
121
|
+
|
|
93
122
|
this.broker = null;
|
|
94
123
|
this.stopping = false;
|
|
95
124
|
this.stundenTimer = null;
|
|
@@ -224,7 +253,13 @@ class Faikout extends utils.Adapter {
|
|
|
224
253
|
} // command/…, Faikout/… - nicht ausgewertet
|
|
225
254
|
|
|
226
255
|
if (t.art === 'error') {
|
|
227
|
-
|
|
256
|
+
const abgelehnt = felder.abgelehntAuswerten(t.unter, text);
|
|
257
|
+
if (abgelehnt) {
|
|
258
|
+
this.einstellungAbgelehnt(t.geraet, abgelehnt).catch(e => this.log.warn(`${t.geraet}: ${e.message}`));
|
|
259
|
+
} else {
|
|
260
|
+
// Der Unterpfad sagt, WAS schiefging (comms, unsupported, ...) - bis 0.0.18 fehlte er.
|
|
261
|
+
this.log.warn(`${t.geraet}: ${t.unter ? `${t.unter}: ` : ''}${text}`);
|
|
262
|
+
}
|
|
228
263
|
return;
|
|
229
264
|
}
|
|
230
265
|
|
|
@@ -254,6 +289,41 @@ class Faikout extends utils.Adapter {
|
|
|
254
289
|
}
|
|
255
290
|
}
|
|
256
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Die Klimaanlage hat eine Einstellung nicht uebernommen (Meldung error/<Name>/failed-set).
|
|
294
|
+
*
|
|
295
|
+
* Bis 0.0.18 stand dafuer nur die nackte Nutzlast im Log (`Daikin 1OG: {"demand":90}`) - nicht
|
|
296
|
+
* zu erkennen, dass die ANLAGE abgelehnt hat und nicht der Adapter oder ein Skript den Wert
|
|
297
|
+
* zurueckgestellt hat. Jetzt: Klartext-Warnung und der Datenpunkt `info.failedSet` mit Feld,
|
|
298
|
+
* verlangtem Wert und Zeit. Den wirklichen Wert der Anlage liefert das Modul mit seiner
|
|
299
|
+
* naechsten Statusmeldung selbst; `control.*` wird hier deshalb nicht angefasst.
|
|
300
|
+
*
|
|
301
|
+
* Dieselbe Ablehnung kommt bei einem zyklisch schreibenden Skript immer wieder. Als Warnung
|
|
302
|
+
* erscheint sie hoechstens einmal je Stunde, dazwischen auf Debug-Stufe; der Datenpunkt wird
|
|
303
|
+
* jedes Mal aktualisiert.
|
|
304
|
+
*
|
|
305
|
+
* @param {string} geraetName Name des Moduls
|
|
306
|
+
* @param {{settings: object, text: string, details?: object}} abgelehnt Ergebnis von felder.abgelehntAuswerten()
|
|
307
|
+
*/
|
|
308
|
+
async einstellungAbgelehnt(geraetName, abgelehnt) {
|
|
309
|
+
const jetzt = Date.now();
|
|
310
|
+
const letzte = this.abgelehntWarnung.get(geraetName);
|
|
311
|
+
const wiederholt = letzte && letzte.text === abgelehnt.text && jetzt - letzte.zeit < 3600000;
|
|
312
|
+
const stateId = `${this.geraetId(geraetName)}.info.${felder.objektId('failed-set')}`;
|
|
313
|
+
const meldung = `${geraetName}: the air conditioner did not accept ${abgelehnt.text}. The module gave up after several attempts and reports the value of the unit again (data point ${this.namespace}.${stateId}).`;
|
|
314
|
+
if (wiederholt) {
|
|
315
|
+
this.log.debug(meldung);
|
|
316
|
+
} else {
|
|
317
|
+
this.abgelehntWarnung.set(geraetName, { text: abgelehnt.text, zeit: jetzt });
|
|
318
|
+
this.log.warn(meldung);
|
|
319
|
+
}
|
|
320
|
+
const inhalt = { time: new Date(jetzt).toISOString(), settings: abgelehnt.settings };
|
|
321
|
+
if (abgelehnt.details) {
|
|
322
|
+
inhalt.details = abgelehnt.details;
|
|
323
|
+
}
|
|
324
|
+
await this.werteUebernehmen(geraetName, { 'failed-set': JSON.stringify(inhalt) });
|
|
325
|
+
}
|
|
326
|
+
|
|
257
327
|
/**
|
|
258
328
|
* Wertet die HA-Discovery einer Klimaeinheit aus und uebernimmt Bereich und Schrittweite
|
|
259
329
|
* der Solltemperatur ins Objekt `control.target`.
|
|
@@ -378,6 +448,9 @@ class Faikout extends utils.Adapter {
|
|
|
378
448
|
// jede Zaehlung wieder bei null an.
|
|
379
449
|
zaehler: (alt && alt.native && alt.native.zaehler) || {},
|
|
380
450
|
grenzen: (alt && alt.native && alt.native.grenzen) || null,
|
|
451
|
+
// Zeitpunkt der letzten Sicherung von native.zaehler und ob seitdem etwas dazukam.
|
|
452
|
+
gesichert: Date.now(),
|
|
453
|
+
zaehlerGeaendert: false,
|
|
381
454
|
};
|
|
382
455
|
// Gemerkte Einheiten aus einem frueheren Lauf; was die Discovery in diesem Lauf
|
|
383
456
|
// schon geliefert hat, hat Vorrang.
|
|
@@ -439,12 +512,30 @@ class Faikout extends utils.Adapter {
|
|
|
439
512
|
await this.einheitSetzen(id, geraetName, feld, ausWert, 'value');
|
|
440
513
|
}
|
|
441
514
|
}
|
|
442
|
-
await this.
|
|
515
|
+
await this.wertSchreiben(stateId, felder.umrechnen(def, wert));
|
|
443
516
|
}
|
|
444
517
|
|
|
445
518
|
await this.zaehlerVerarbeiten(id, g, daten);
|
|
446
519
|
}
|
|
447
520
|
|
|
521
|
+
/**
|
|
522
|
+
* Schreibt einen Wert mit ack, aber nur, wenn er sich gegenueber dem zuletzt geschriebenen
|
|
523
|
+
* geaendert hat oder dieser aelter als AUFFRISCHEN_MS ist. Bewusst kein setStateChanged -
|
|
524
|
+
* das liest den Wert vorher aus der Datenbank und spart damit nichts.
|
|
525
|
+
*
|
|
526
|
+
* @param {string} stateId Objekt-ID ohne Namensraum
|
|
527
|
+
* @param {string|number|boolean|null} val Wert
|
|
528
|
+
*/
|
|
529
|
+
async wertSchreiben(stateId, val) {
|
|
530
|
+
const jetzt = Date.now();
|
|
531
|
+
const letzt = this.geschrieben.get(stateId);
|
|
532
|
+
if (letzt && letzt.val === val && jetzt - letzt.zeit < AUFFRISCHEN_MS) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
await this.setState(stateId, { val, ack: true });
|
|
536
|
+
this.geschrieben.set(stateId, { val, zeit: jetzt });
|
|
537
|
+
}
|
|
538
|
+
|
|
448
539
|
/**
|
|
449
540
|
* Bildet aus den Lebensdauer-Zaehlern die Stunden- und Tagesverbraeuche.
|
|
450
541
|
*
|
|
@@ -453,19 +544,36 @@ class Faikout extends utils.Adapter {
|
|
|
453
544
|
* @param {object} daten gemeldete Felder mit den Lebensdauer-Zaehlern
|
|
454
545
|
*/
|
|
455
546
|
async zaehlerVerarbeiten(id, g, daten) {
|
|
456
|
-
|
|
547
|
+
const jetzt = new Date();
|
|
548
|
+
let sofortSichern = false;
|
|
457
549
|
for (const z of ZAEHLER) {
|
|
458
550
|
const roh = daten[z.feld];
|
|
459
551
|
if (typeof roh !== 'number') {
|
|
460
552
|
continue;
|
|
461
553
|
}
|
|
462
|
-
const
|
|
554
|
+
const bisher = g.zaehler[z.feld] || null;
|
|
555
|
+
// Frueh abbrechen: gleicher Rohwert in derselben Stunde - es kaeme dasselbe heraus.
|
|
556
|
+
// Erst nachdem der Zweig in diesem Lauf einmal angelegt und geschrieben wurde.
|
|
557
|
+
if (g.angelegt.has(`${id}.${CONSUMPTION}.${z.zweig}`) && verbrauch.unveraendert(bisher, roh, jetzt)) {
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
const ergebnis = verbrauch.verarbeiten(bisher, roh, jetzt);
|
|
463
561
|
g.zaehler[z.feld] = ergebnis.stand;
|
|
464
|
-
|
|
562
|
+
g.zaehlerGeaendert = true;
|
|
563
|
+
// Sofort sichern bei erstem Wert, Stundenwechsel (schliesst Tag und Monat ein) und
|
|
564
|
+
// allem, was einen Hinweis erzeugt (neu basieren, Luecke).
|
|
565
|
+
if (
|
|
566
|
+
!bisher ||
|
|
567
|
+
bisher.letzterWert === null ||
|
|
568
|
+
bisher.stunde !== ergebnis.stand.stunde ||
|
|
569
|
+
ergebnis.hinweise.length
|
|
570
|
+
) {
|
|
571
|
+
sofortSichern = true;
|
|
572
|
+
}
|
|
465
573
|
ergebnis.hinweise.forEach(h => this.log.info(`${g.name} ${z.name.en.toLowerCase()}: ${h}`));
|
|
466
574
|
await this.verbrauchSchreiben(id, g, z, ergebnis.werte);
|
|
467
575
|
}
|
|
468
|
-
if (
|
|
576
|
+
if (sofortSichern || (g.zaehlerGeaendert && Date.now() - g.gesichert >= SICHERN_MS)) {
|
|
469
577
|
await this.zaehlerstandSichern(id, g);
|
|
470
578
|
}
|
|
471
579
|
}
|
|
@@ -482,13 +590,20 @@ class Faikout extends utils.Adapter {
|
|
|
482
590
|
if (wert === null || wert === undefined) {
|
|
483
591
|
continue;
|
|
484
592
|
}
|
|
485
|
-
await this.
|
|
593
|
+
await this.wertSchreiben(`${basis}.${f.id}`, wert);
|
|
486
594
|
}
|
|
595
|
+
// Die Stundenreihe aendert sich nur beim Stundenwechsel; Tages- und Monatsreihe tragen den
|
|
596
|
+
// laufenden Tag/Monat und werden ueber den Textvergleich in wertSchreiben() gefiltert.
|
|
597
|
+
const stunde = g.zaehler[z.feld] && g.zaehler[z.feld].stunde;
|
|
487
598
|
for (const r of VERBRAUCH_REIHEN) {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
599
|
+
const stateId = `${basis}.${r.id}`;
|
|
600
|
+
if (r.quelle === 'hours' && stunde && this.reihenStunde.get(stateId) === stunde) {
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
603
|
+
await this.wertSchreiben(stateId, JSON.stringify(werte[r.quelle] || []));
|
|
604
|
+
if (r.quelle === 'hours') {
|
|
605
|
+
this.reihenStunde.set(stateId, stunde);
|
|
606
|
+
}
|
|
492
607
|
}
|
|
493
608
|
}
|
|
494
609
|
|
|
@@ -695,6 +810,8 @@ class Faikout extends utils.Adapter {
|
|
|
695
810
|
}
|
|
696
811
|
|
|
697
812
|
async zaehlerstandSichern(id, g) {
|
|
813
|
+
g.gesichert = Date.now();
|
|
814
|
+
g.zaehlerGeaendert = false;
|
|
698
815
|
await this.extendObject(id, { native: { zaehler: g.zaehler } });
|
|
699
816
|
}
|
|
700
817
|
|
|
@@ -766,6 +883,9 @@ class Faikout extends utils.Adapter {
|
|
|
766
883
|
if (!obj || !obj.common || !obj.common.write) {
|
|
767
884
|
return;
|
|
768
885
|
}
|
|
886
|
+
// Der Befehl hat den Datenpunkt ueberschrieben. Die naechste Rueckmeldung des Moduls muss
|
|
887
|
+
// ihn wieder mit ack setzen - auch wenn sie den alten Wert bringt (Anlage lehnt ab).
|
|
888
|
+
this.geschrieben.delete(id.slice(this.namespace.length + 1));
|
|
769
889
|
|
|
770
890
|
// faikout.0.<GeraetId>.control.<feld>
|
|
771
891
|
const teile = id.split('.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.faikout",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Connect Daikin air conditioners with a faikout module locally via MQTT.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Immanuel",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"test:integration": "mocha test/integration --exit",
|
|
58
58
|
"test": "npm run test:package && npm run test:unit",
|
|
59
59
|
"lint": "eslint .",
|
|
60
|
-
"test:unit": "mocha test/verbrauch test/broker test/namen test/einheiten --exit",
|
|
60
|
+
"test:unit": "mocha test/verbrauch test/broker test/namen test/einheiten test/abgelehnt test/schreiblast --exit",
|
|
61
61
|
"release": "release-script"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -61,6 +61,9 @@ vis.binds.faikout = {
|
|
|
61
61
|
'Summe': 'Total',
|
|
62
62
|
'Dieser Monat': 'This month',
|
|
63
63
|
'Dieses Jahr': 'This year',
|
|
64
|
+
'Letzte 24 Stunden': 'Last 24 hours',
|
|
65
|
+
'Letzte 31 Tage': 'Last 31 days',
|
|
66
|
+
'Letzte 12 Monate': 'Last 12 months',
|
|
64
67
|
'Tag': 'Day',
|
|
65
68
|
'Monat': 'Month',
|
|
66
69
|
'Jahr': 'Year',
|
|
@@ -242,6 +245,7 @@ vis.binds.faikout = {
|
|
|
242
245
|
return;
|
|
243
246
|
}
|
|
244
247
|
zustaende = zustaende || {};
|
|
248
|
+
b.abonnieren(zustaende);
|
|
245
249
|
var ctx = {
|
|
246
250
|
prefix: prefix,
|
|
247
251
|
einheiten: {},
|
|
@@ -300,6 +304,37 @@ vis.binds.faikout = {
|
|
|
300
304
|
});
|
|
301
305
|
},
|
|
302
306
|
|
|
307
|
+
/**
|
|
308
|
+
* VIS abonniert beim Laden einer Ansicht nur die IDs, die in den Widget-Attributen stehen -
|
|
309
|
+
* hier also nur das Geraeteobjekt, nicht die Datenpunkte darunter. Ohne eigenes Abo blieben
|
|
310
|
+
* vis.states leer und alle Werte zeigten "–". Deshalb: Anfangswerte in vis.states legen
|
|
311
|
+
* (wenn noch keine da sind) und die Datenpunkte selbst abonnieren.
|
|
312
|
+
*/
|
|
313
|
+
abonnieren: function (zustaende) {
|
|
314
|
+
var neu = [];
|
|
315
|
+
var aktiv = (vis.subscribing && vis.subscribing.active) || null;
|
|
316
|
+
Object.keys(zustaende).forEach(function (id) {
|
|
317
|
+
var s = zustaende[id];
|
|
318
|
+
if (s && vis.states.attr(id + '.val') === undefined) vis.updateState(id, s);
|
|
319
|
+
if (!aktiv) {
|
|
320
|
+
neu.push(id);
|
|
321
|
+
} else if (aktiv.indexOf(id) === -1) {
|
|
322
|
+
aktiv.push(id);
|
|
323
|
+
neu.push(id);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
if (neu.length) vis.conn.subscribe(neu);
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Akzentfarbe (Betriebsart) als CSS-Variable setzen. jQuery 1.11 in vis 1 kann mit .css()
|
|
331
|
+
* keine Custom Properties setzen - der Akzent blieb deshalb immer blau.
|
|
332
|
+
*/
|
|
333
|
+
farbe: function ($w, wert) {
|
|
334
|
+
if ($w && $w[0] && $w[0].style) $w[0].style.setProperty('--fk-akzent', wert);
|
|
335
|
+
return $w;
|
|
336
|
+
},
|
|
337
|
+
|
|
303
338
|
/** Hinweis, wenn die Anlage den benoetigten Datenpunkt gar nicht hat. */
|
|
304
339
|
fehlt: function ($wurzel, feld) {
|
|
305
340
|
$wurzel.html('<div class="fk-fehler">' + vis.binds.faikout.t('Dieses Gerät hat keinen Datenpunkt %s.', '<code>' + feld + '</code>') + '</div>');
|
|
@@ -509,7 +544,7 @@ vis.binds.faikout = {
|
|
|
509
544
|
|
|
510
545
|
return function () {
|
|
511
546
|
var an = ctx.hat('control.power') ? !!ctx.wert('control.power') : true;
|
|
512
|
-
$wurzel
|
|
547
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent()).toggleClass('fk-aus', !an);
|
|
513
548
|
$wurzel.find('.fk-schalter').toggleClass('fk-an', an);
|
|
514
549
|
zeichneBogen();
|
|
515
550
|
var erreichbar = ctx.hat('info.online') ? !!ctx.wert('info.online') : true;
|
|
@@ -549,7 +584,7 @@ vis.binds.faikout = {
|
|
|
549
584
|
return function () {
|
|
550
585
|
var an = ctx.hat('control.power') ? !!ctx.wert('control.power') : true;
|
|
551
586
|
var m = ctx.wert('control.mode');
|
|
552
|
-
$wurzel
|
|
587
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent()).toggleClass('fk-aus', !an);
|
|
553
588
|
$wurzel.find('.fk-schalter').toggleClass('fk-an', an);
|
|
554
589
|
$wurzel.find('.fk-pille').each(function () {
|
|
555
590
|
$(this).toggleClass('fk-gewaehlt', $(this).attr('data-wert') === m && an);
|
|
@@ -584,7 +619,7 @@ vis.binds.faikout = {
|
|
|
584
619
|
|
|
585
620
|
return function () {
|
|
586
621
|
var f = ctx.wert('control.fan');
|
|
587
|
-
$wurzel
|
|
622
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent());
|
|
588
623
|
$wurzel.find('.fk-pille').each(function () {
|
|
589
624
|
$(this).toggleClass('fk-gewaehlt', $(this).attr('data-wert') === f);
|
|
590
625
|
});
|
|
@@ -623,7 +658,7 @@ vis.binds.faikout = {
|
|
|
623
658
|
|
|
624
659
|
return function () {
|
|
625
660
|
var w = parseInt(ctx.wert('control.demand'), 10);
|
|
626
|
-
$wurzel
|
|
661
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent());
|
|
627
662
|
if (!isNaN(w)) {
|
|
628
663
|
if (!$s.is(':active')) $s.val(w);
|
|
629
664
|
$wurzel.find('.fk-leistung-zahl').text(w);
|
|
@@ -675,7 +710,7 @@ vis.binds.faikout = {
|
|
|
675
710
|
b.fuss($wurzel, ctx, data);
|
|
676
711
|
|
|
677
712
|
return function () {
|
|
678
|
-
$wurzel
|
|
713
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent());
|
|
679
714
|
$wurzel.find('.fk-schalt').each(function () {
|
|
680
715
|
var f = $(this).attr('data-feld');
|
|
681
716
|
var v = ctx.wert(f);
|
|
@@ -721,7 +756,7 @@ vis.binds.faikout = {
|
|
|
721
756
|
'<div class="fk-mw-wert">' + v + '<small>' + b.einheit(ctx, m) + '</small></div></div>';
|
|
722
757
|
});
|
|
723
758
|
$wurzel.find('.fk-messwerte').html(html);
|
|
724
|
-
$wurzel
|
|
759
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent());
|
|
725
760
|
};
|
|
726
761
|
});
|
|
727
762
|
},
|
|
@@ -749,7 +784,7 @@ vis.binds.faikout = {
|
|
|
749
784
|
return function () {
|
|
750
785
|
var v = b.zahl(ctx.wert(m.feld), b.stellen(ctx, m));
|
|
751
786
|
$wurzel.find('.fk-einzel-wert').html((v === null ? '–' : v) + '<small>' + b.einheit(ctx, m) + '</small>');
|
|
752
|
-
$wurzel
|
|
787
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent());
|
|
753
788
|
};
|
|
754
789
|
});
|
|
755
790
|
},
|
|
@@ -785,7 +820,10 @@ vis.binds.faikout = {
|
|
|
785
820
|
return;
|
|
786
821
|
}
|
|
787
822
|
gefunden = true;
|
|
788
|
-
vis
|
|
823
|
+
// vis 1 kennt kein conn.getState, nur getStates (Liste oder Muster).
|
|
824
|
+
var oid = ctx.oid(pfad);
|
|
825
|
+
vis.conn.getStates([oid], function (err, zustaende) {
|
|
826
|
+
var zustand = zustaende && zustaende[oid];
|
|
789
827
|
if (!err && zustand && zustand.val) {
|
|
790
828
|
try {
|
|
791
829
|
JSON.parse(zustand.val).forEach(function (p) {
|
|
@@ -865,7 +903,7 @@ vis.binds.faikout = {
|
|
|
865
903
|
svg += '</g><g class="fk-v-achse">';
|
|
866
904
|
for (var j = 0; j <= 2; j++) {
|
|
867
905
|
var v = spitze * j / 2;
|
|
868
|
-
var t = v >= 10
|
|
906
|
+
var t = b.zahl(v, v >= 10 || v === 0 ? 0 : (v < 1 ? 2 : 1));
|
|
869
907
|
svg += '<text x="' + (LINKS - 4) + '" y="' + (y(v) + 3).toFixed(1) + '" text-anchor="end">' + t + '</text>';
|
|
870
908
|
}
|
|
871
909
|
// Beschriftung ausduennen, sonst kleben 24 oder 31 Werte aneinander.
|
|
@@ -884,8 +922,8 @@ vis.binds.faikout = {
|
|
|
884
922
|
svg += '<rect x="' + x.toFixed(1) + '" y="' + y(wert).toFixed(1) +
|
|
885
923
|
'" width="' + balkenB.toFixed(1) + '" height="' + h.toFixed(1) +
|
|
886
924
|
'" rx="1" fill="' + b.VERLAUF_FARBEN[r.art] + '">' +
|
|
887
|
-
'<title>' + punkte[k].beschriftung + ' · ' + b.t('Kühlen') + ' ' + punkte[k].cooling
|
|
888
|
-
' kWh · ' + b.t('Heizen') + ' ' + punkte[k].heating
|
|
925
|
+
'<title>' + punkte[k].beschriftung + ' · ' + b.t('Kühlen') + ' ' + b.zahl(punkte[k].cooling, 1) +
|
|
926
|
+
' kWh · ' + b.t('Heizen') + ' ' + b.zahl(punkte[k].heating, 1) + ' kWh</title></rect>';
|
|
889
927
|
});
|
|
890
928
|
});
|
|
891
929
|
svg += '</g></svg>';
|
|
@@ -904,7 +942,9 @@ vis.binds.faikout = {
|
|
|
904
942
|
cooling: b.attr(data, 'show_cooling', 'zeige_kuehlen') !== false,
|
|
905
943
|
heating: b.attr(data, 'show_heating', 'zeige_heizen') !== false
|
|
906
944
|
};
|
|
907
|
-
|
|
945
|
+
// Die Reihen des Adapters reichen weiter zurueck (Tage z. B. 62) - gezeigt wird ein fester Ausschnitt.
|
|
946
|
+
var BESCHRIFTUNG = { day: b.t('Letzte 24 Stunden'), month: b.t('Letzte 31 Tage'), year: b.t('Letzte 12 Monate') };
|
|
947
|
+
var ANZAHL = { day: 24, month: 31, year: 12 };
|
|
908
948
|
|
|
909
949
|
var $box = $('<div class="fk-verlauf"></div>').appendTo($wurzel);
|
|
910
950
|
if (b.attr(data, 'rangeSwitch', 'umschalter') !== false) {
|
|
@@ -954,16 +994,17 @@ vis.binds.faikout = {
|
|
|
954
994
|
$fuss.find('.fk-v-summe').text('');
|
|
955
995
|
return;
|
|
956
996
|
}
|
|
997
|
+
punkte = punkte.slice(-(ANZAHL[bereich] || punkte.length));
|
|
957
998
|
var w = $flaeche.width() || 400;
|
|
958
999
|
b.verlaufZeichnen($flaeche, punkte, arten, w, Math.max(110, Math.round(w * 0.42)));
|
|
959
1000
|
var summe = punkte.reduce(function (a, p) { return a + p.cooling + p.heating; }, 0);
|
|
960
1001
|
$fuss.find('.fk-v-summe').html(b.t('Summe') + ' <b>' +
|
|
961
|
-
(summe >= 100 ?
|
|
1002
|
+
b.zahl(summe, summe >= 100 ? 0 : 1) + ' kWh</b>');
|
|
962
1003
|
});
|
|
963
1004
|
}
|
|
964
1005
|
|
|
965
1006
|
return function () {
|
|
966
|
-
$wurzel
|
|
1007
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent());
|
|
967
1008
|
laden();
|
|
968
1009
|
};
|
|
969
1010
|
});
|
|
@@ -1005,7 +1046,7 @@ vis.binds.faikout = {
|
|
|
1005
1046
|
|
|
1006
1047
|
return function () {
|
|
1007
1048
|
var an = ctx.hat('control.power') ? !!ctx.wert('control.power') : true;
|
|
1008
|
-
$wurzel
|
|
1049
|
+
vis.binds.faikout.farbe($wurzel, ctx.akzent()).toggleClass('fk-aus', !an);
|
|
1009
1050
|
$wurzel.find('.fk-schalter').toggleClass('fk-an', an);
|
|
1010
1051
|
teile.forEach(function (f) { if (f) f(); });
|
|
1011
1052
|
var erreichbar = ctx.hat('info.online') ? !!ctx.wert('info.online') : true;
|
package/widgets/faikout.html
CHANGED
|
@@ -81,9 +81,7 @@
|
|
|
81
81
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;symbole/checkbox;ziehen/checkbox;zusatz/checkbox;beschriftung/checkbox"
|
|
82
82
|
data-vis-attrs0="group.readings;show_outdoor/checkbox;show_power/checkbox;show_today/checkbox;show_compressor/checkbox;show_fan/checkbox;show_refrigerant/checkbox;show_room/checkbox;show_humidity/checkbox;show_energy/checkbox;show_yesterday/checkbox;show_hour/checkbox">
|
|
83
83
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:380px;height:820px">
|
|
84
|
-
|
|
85
|
-
vis.binds.faikout.kachel('<%= this.data.attr('wid') %>', view, data, style);
|
|
86
|
-
<\/script>
|
|
84
|
+
<% vis.binds.faikout.kachel(this.data.wid, this.view, this.data, this.style); %>
|
|
87
85
|
</div>
|
|
88
86
|
</script>
|
|
89
87
|
|
|
@@ -96,9 +94,7 @@
|
|
|
96
94
|
data-vis-name="Set point arc"
|
|
97
95
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;ziehen/checkbox">
|
|
98
96
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:340px;height:350px">
|
|
99
|
-
|
|
100
|
-
vis.binds.faikout.bogen('<%= this.data.attr('wid') %>', view, data, style);
|
|
101
|
-
<\/script>
|
|
97
|
+
<% vis.binds.faikout.bogen(this.data.wid, this.view, this.data, this.style); %>
|
|
102
98
|
</div>
|
|
103
99
|
</script>
|
|
104
100
|
|
|
@@ -111,9 +107,7 @@
|
|
|
111
107
|
data-vis-name="Mode (horizontal)"
|
|
112
108
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox;symbole/checkbox">
|
|
113
109
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:380px;height:135px">
|
|
114
|
-
|
|
115
|
-
vis.binds.faikout.modus('<%= this.data.attr('wid') %>', view, data, false);
|
|
116
|
-
<\/script>
|
|
110
|
+
<% vis.binds.faikout.modus(this.data.wid, this.view, this.data, false); %>
|
|
117
111
|
</div>
|
|
118
112
|
</script>
|
|
119
113
|
|
|
@@ -125,9 +119,7 @@
|
|
|
125
119
|
data-vis-name="Mode (vertical)"
|
|
126
120
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox;symbole/checkbox">
|
|
127
121
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:190px;height:265px">
|
|
128
|
-
|
|
129
|
-
vis.binds.faikout.modus('<%= this.data.attr('wid') %>', view, data, true);
|
|
130
|
-
<\/script>
|
|
122
|
+
<% vis.binds.faikout.modus(this.data.wid, this.view, this.data, true); %>
|
|
131
123
|
</div>
|
|
132
124
|
</script>
|
|
133
125
|
|
|
@@ -140,9 +132,7 @@
|
|
|
140
132
|
data-vis-name="Fan speed (horizontal)"
|
|
141
133
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox">
|
|
142
134
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:420px;height:100px">
|
|
143
|
-
|
|
144
|
-
vis.binds.faikout.luefter('<%= this.data.attr('wid') %>', view, data, false);
|
|
145
|
-
<\/script>
|
|
135
|
+
<% vis.binds.faikout.luefter(this.data.wid, this.view, this.data, false); %>
|
|
146
136
|
</div>
|
|
147
137
|
</script>
|
|
148
138
|
|
|
@@ -154,9 +144,7 @@
|
|
|
154
144
|
data-vis-name="Fan speed (vertical)"
|
|
155
145
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox">
|
|
156
146
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:165px;height:345px">
|
|
157
|
-
|
|
158
|
-
vis.binds.faikout.luefter('<%= this.data.attr('wid') %>', view, data, true);
|
|
159
|
-
<\/script>
|
|
147
|
+
<% vis.binds.faikout.luefter(this.data.wid, this.view, this.data, true); %>
|
|
160
148
|
</div>
|
|
161
149
|
</script>
|
|
162
150
|
|
|
@@ -169,9 +157,7 @@
|
|
|
169
157
|
data-vis-name="Power limit"
|
|
170
158
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox">
|
|
171
159
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:280px;height:150px">
|
|
172
|
-
|
|
173
|
-
vis.binds.faikout.leistung('<%= this.data.attr('wid') %>', view, data, style);
|
|
174
|
-
<\/script>
|
|
160
|
+
<% vis.binds.faikout.leistung(this.data.wid, this.view, this.data, this.style); %>
|
|
175
161
|
</div>
|
|
176
162
|
</script>
|
|
177
163
|
|
|
@@ -184,9 +170,7 @@
|
|
|
184
170
|
data-vis-name="Extra functions (horizontal)"
|
|
185
171
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox;beschriftung/checkbox">
|
|
186
172
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:300px;height:115px">
|
|
187
|
-
|
|
188
|
-
vis.binds.faikout.zusatz('<%= this.data.attr('wid') %>', view, data, false);
|
|
189
|
-
<\/script>
|
|
173
|
+
<% vis.binds.faikout.zusatz(this.data.wid, this.view, this.data, false); %>
|
|
190
174
|
</div>
|
|
191
175
|
</script>
|
|
192
176
|
|
|
@@ -198,9 +182,7 @@
|
|
|
198
182
|
data-vis-name="Extra functions (vertical)"
|
|
199
183
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox;etikett/checkbox">
|
|
200
184
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:230px;height:290px">
|
|
201
|
-
|
|
202
|
-
vis.binds.faikout.zusatz('<%= this.data.attr('wid') %>', view, data, true);
|
|
203
|
-
<\/script>
|
|
185
|
+
<% vis.binds.faikout.zusatz(this.data.wid, this.view, this.data, true); %>
|
|
204
186
|
</div>
|
|
205
187
|
</script>
|
|
206
188
|
|
|
@@ -221,9 +203,7 @@
|
|
|
221
203
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox"
|
|
222
204
|
data-vis-attrs0="group.history;range/select,day,month,year;rangeSwitch/checkbox;seriesSelect/checkbox;show_total/checkbox;show_cooling/checkbox;show_heating/checkbox">
|
|
223
205
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:420px;height:250px">
|
|
224
|
-
|
|
225
|
-
vis.binds.faikout.verlauf('<%= this.data.attr('wid') %>', view, data, style);
|
|
226
|
-
<\/script>
|
|
206
|
+
<% vis.binds.faikout.verlauf(this.data.wid, this.view, this.data, this.style); %>
|
|
227
207
|
</div>
|
|
228
208
|
</script>
|
|
229
209
|
|
|
@@ -236,9 +216,7 @@
|
|
|
236
216
|
data-vis-attrs="deviceOid/id;titel;untertitel;theme/select,light,dark;rahmen/checkbox;kopf/checkbox;schalter/checkbox;fuss/checkbox"
|
|
237
217
|
data-vis-attrs0="group.readings;show_outdoor/checkbox;show_power/checkbox;show_today/checkbox;show_compressor/checkbox;show_fan/checkbox;show_refrigerant/checkbox;show_room/checkbox;show_humidity/checkbox;show_energy/checkbox;show_yesterday/checkbox;show_hour/checkbox">
|
|
238
218
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:380px;height:160px">
|
|
239
|
-
|
|
240
|
-
vis.binds.faikout.messwerte('<%= this.data.attr('wid') %>', view, data, style);
|
|
241
|
-
<\/script>
|
|
219
|
+
<% vis.binds.faikout.messwerte(this.data.wid, this.view, this.data, this.style); %>
|
|
242
220
|
</div>
|
|
243
221
|
</script>
|
|
244
222
|
|
|
@@ -251,8 +229,6 @@
|
|
|
251
229
|
data-vis-name="Reading (single)"
|
|
252
230
|
data-vis-attrs="deviceOid/id;reading/select,outdoor,power,today,compressor,fan,refrigerant,room,humidity,energy,yesterday,hour;titel;theme/select,light,dark;rahmen/checkbox;etikett/checkbox">
|
|
253
231
|
<div id="<%= this.data.attr('wid') %>" class="vis-widget <%== this.data.attr('class') %>" style="width:150px;height:100px">
|
|
254
|
-
|
|
255
|
-
vis.binds.faikout.einzelwert('<%= this.data.attr('wid') %>', view, data, style);
|
|
256
|
-
<\/script>
|
|
232
|
+
<% vis.binds.faikout.einzelwert(this.data.wid, this.view, this.data, this.style); %>
|
|
257
233
|
</div>
|
|
258
234
|
</script>
|