iobroker.faikout 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,12 @@ Objects are grouped per device:
42
42
  econo, powerful, comfort, streamer, sensor, LED, quiet, humidify. `selectedMode` is the operating mode
43
43
  without "off": while the unit runs it equals `mode`, while it is off it keeps the mode set last (taken
44
44
  from the module's native status). Writing it sends the mode and switches the unit on.
45
+ - `mode`, `fan`, `swing` and `preset` are text, as the module speaks them. Each has a numeric twin
46
+ (`modeNum`, `fanNum`, `swingNum`, `presetNum`) with `common.states` such as
47
+ `{0: "off", 1: "heat_cool", 2: "cool", 3: "heat", 4: "dry", 5: "fan_only"}` for Lovelace and other
48
+ tools that expect numbers. Both are writable and mean the same: a command on either sends exactly one
49
+ command to the module (as text); both are set with `ack=true` when the module confirms. The numbers
50
+ are fixed; new values of a future firmware are appended.
45
51
  - `<device>.status.*` — readings: temperatures, humidity, energy, power, compressor and fan speed
46
52
  - `<device>.info.*` — device diagnostics: IP, WiFi signal, uptime, firmware
47
53
 
@@ -108,6 +114,25 @@ reporting 100 % — seen on units that still have Daikin's own WiFi adapter fitt
108
114
  pass on the percentage; the modes of Daikin's app (off / automatic / fixed) are not part of what is
109
115
  known about the S21 interface. Econo is only taken over while the unit is running.
110
116
 
117
+ ### Lovelace, type detector and other tools that expect numbers
118
+
119
+ The module speaks text (`mode` = `"cool"`), and the text states stay the main form for scripts, vis and
120
+ the device cards. Lovelace, however, converts the keys of `common.states` to numbers when it writes a
121
+ climate entity; with text keys this gives `NaN` and the command is lost. Use the numeric twins in
122
+ `<device>.control.*` for such tools:
123
+
124
+ | State | Role | Values |
125
+ | ----------- | --------------------------- | ------------------------------------------------------------------- |
126
+ | `modeNum` | `level.mode.airconditioner` | 0 off, 1 heat_cool, 2 cool, 3 heat, 4 dry, 5 fan_only |
127
+ | `fanNum` | `level.mode.fan` | 0 auto, 1 night, 2 low, 3 lowMedium, 4 medium, 5 mediumHigh, 6 high |
128
+ | `swingNum` | `level.mode.swing` | 0 off, 1 on, 2 vertical, 3 horizontal, 4 both, 5 comfort |
129
+ | `presetNum` | `level.mode` | 0 home, 1 eco, 2 boost |
130
+
131
+ The roles let the type detector find them as part of an air conditioner. Writing `2`, `"2"` or the label
132
+ `"cool"` to `modeNum` sends one command `cool` to the module; `modeNum` and `mode` are both set with
133
+ `ack=true` when the module confirms. A value outside the list is discarded with a warning in the log.
134
+ The twins are created with the first report of a module after the update.
135
+
111
136
  ## Visualisation (vis templates)
112
137
 
113
138
  The folder [`vis-templates/`](vis-templates/) contains ready-made **vis 1** views for two units: overview,
@@ -121,6 +146,13 @@ one detail page per unit with controls, energy history and a phone view. They us
121
146
  Placeholder for the next version (at the beginning of the line):
122
147
  ### **WORK IN PROGRESS**
123
148
  -->
149
+ ### 0.2.0 (2026-11-13)
150
+ - Numeric twins of the text control states: `control.modeNum`, `fanNum`, `swingNum` and `presetNum` with
151
+ `common.states` (`{0: "off", 1: "heat_cool", ...}`) and the roles `level.mode.airconditioner`,
152
+ `level.mode.fan`, `level.mode.swing` and `level.mode`, for Lovelace and the type detector (forum thread
153
+ 85668). Both forms are writable; a command on either sends exactly one command to the module, both are set
154
+ with `ack=true` when the module confirms. Text states, vis widgets and device cards are unchanged.
155
+
124
156
  ### 0.1.0 (2026-11-12)
125
157
  - Device manager support (`@iobroker/dm-utils`): one card per air conditioner in the admin tab "Devices"
126
158
  with the running operation (mode, current action, room/target/outside temperature, fan speed, humidity,
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "faikout",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "titleLang": {
6
6
  "en": "Faikout",
7
7
  "de": "Faikout",
@@ -71,6 +71,19 @@
71
71
  }
72
72
  ],
73
73
  "news": {
74
+ "0.2.0": {
75
+ "en": "Numeric twins of the text control states (modeNum, fanNum, swingNum, presetNum) with level.mode roles for Lovelace and the type detector; one command per write, ack only with the module confirmation",
76
+ "de": "Zahl-Datenpunkte neben den Text-Steuerfeldern (modeNum, fanNum, swingNum, presetNum) mit level.mode-Rollen für Lovelace und den Type-Detector; ein Befehl pro Schreibvorgang, ack erst mit der Bestätigung des Moduls",
77
+ "ru": "Числовые аналоги текстовых управляющих состояний (modeNum, fanNum, swingNum, presetNum) с ролями level.mode для Lovelace и детектора типов; одна команда на каждую запись, ack только после подтверждения модуля",
78
+ "pt": "Estados numéricos ao lado dos estados de controlo em texto (modeNum, fanNum, swingNum, presetNum) com funções level.mode para o Lovelace e o detetor de tipos; um comando por escrita, ack apenas com a confirmação do módulo",
79
+ "nl": "Numerieke tegenhangers van de tekstuele besturingsdatapunten (modeNum, fanNum, swingNum, presetNum) met level.mode-rollen voor Lovelace en de typedetector; één commando per schrijfactie, ack pas na bevestiging door de module",
80
+ "fr": "Équivalents numériques des états de commande textuels (modeNum, fanNum, swingNum, presetNum) avec les rôles level.mode pour Lovelace et le détecteur de type ; une seule commande par écriture, ack uniquement après confirmation du module",
81
+ "it": "Stati numerici accanto agli stati di controllo testuali (modeNum, fanNum, swingNum, presetNum) con ruoli level.mode per Lovelace e il rilevatore di tipo; un solo comando per scrittura, ack solo con la conferma del modulo",
82
+ "es": "Estados numéricos junto a los estados de control de texto (modeNum, fanNum, swingNum, presetNum) con roles level.mode para Lovelace y el detector de tipos; un solo comando por escritura, ack solo con la confirmación del módulo",
83
+ "pl": "Liczbowe odpowiedniki tekstowych stanów sterujących (modeNum, fanNum, swingNum, presetNum) z rolami level.mode dla Lovelace i detektora typów; jedno polecenie na zapis, ack dopiero po potwierdzeniu przez moduł",
84
+ "uk": "Числові відповідники текстових керувальних станів (modeNum, fanNum, swingNum, presetNum) з ролями level.mode для Lovelace і детектора типів; одна команда на кожен запис, ack лише після підтвердження модуля",
85
+ "zh-cn": "为文本控制状态新增数值对应项(modeNum、fanNum、swingNum、presetNum),带 level.mode 角色,适用于 Lovelace 和类型检测器;每次写入只发送一条命令,模块确认后才设置 ack"
86
+ },
74
87
  "0.1.0": {
75
88
  "en": "Device cards in the admin (device manager): on/off with confirmation, operating mode, target temperature and fan speed directly on the card, Wi-Fi signal and live values; new state control.selectedMode",
76
89
  "de": "Gerätekarten im Admin (Geräteverwaltung): Ein/Aus mit Rückfrage, Betriebsart, Solltemperatur und Lüfterstufe direkt auf der Karte, WLAN-Signal und laufende Werte; neuer Datenpunkt control.selectedMode",
@@ -148,19 +161,6 @@
148
161
  "pl": "Limit czasu zamykania brokera MQTT korzysta z timera adaptera (kontrola E5005)",
149
162
  "uk": "Тайм-аут зупинки MQTT-брокера використовує таймер адаптера (перевірка E5005)",
150
163
  "zh-cn": "MQTT 代理的关闭超时使用适配器计时器(检查 E5005)"
151
- },
152
- "0.0.14": {
153
- "en": "Consumption states renamed to English IDs (consumption.total.today ...), existing values are migrated; status.autoe can be written; complete translations of admin and widgets",
154
- "de": "Verbrauchsdatenpunkte auf englische IDs umbenannt (consumption.total.today ...), vorhandene Werte werden übernommen; status.autoe ist beschreibbar; vollständige Übersetzungen von Admin und Widgets",
155
- "ru": "Состояния потребления переименованы в английские ID (consumption.total.today ...), существующие значения переносятся; status.autoe можно записывать; полные переводы админки и виджетов",
156
- "pt": "Estados de consumo renomeados para IDs em inglês (consumption.total.today ...), os valores existentes são migrados; status.autoe pode ser escrito; traduções completas do admin e dos widgets",
157
- "nl": "Verbruiksstatussen hernoemd naar Engelse ID’s (consumption.total.today ...), bestaande waarden worden overgenomen; status.autoe is schrijfbaar; volledige vertalingen van admin en widgets",
158
- "fr": "États de consommation renommés en ID anglais (consumption.total.today ...), les valeurs existantes sont migrées ; status.autoe est modifiable ; traductions complètes de l’admin et des widgets",
159
- "it": "Stati di consumo rinominati con ID inglesi (consumption.total.today ...), i valori esistenti vengono migrati; status.autoe è scrivibile; traduzioni complete di admin e widget",
160
- "es": "Estados de consumo renombrados a ID en inglés (consumption.total.today ...), los valores existentes se migran; status.autoe se puede escribir; traducciones completas del admin y los widgets",
161
- "pl": "Stany zużycia przemianowane na angielskie ID (consumption.total.today ...), istniejące wartości są przenoszone; status.autoe można zapisywać; pełne tłumaczenia panelu i widżetów",
162
- "uk": "Стани споживання перейменовано на англійські ID (consumption.total.today ...), наявні значення переносяться; status.autoe можна записувати; повні переклади адмінки та віджетів",
163
- "zh-cn": "能耗状态改为英文 ID(consumption.total.today 等),现有数值自动迁移;status.autoe 可写入;管理界面和小部件完整翻译"
164
164
  }
165
165
  },
166
166
  "restartAdapters": [
package/lib/fields.js CHANGED
@@ -566,6 +566,125 @@ const FELDER = {
566
566
  },
567
567
  };
568
568
 
569
+ /*
570
+ * ZAHL-ZWILLINGE der Text-Steuerfelder (Forum 85668, FernetMenta 13.11.2026).
571
+ *
572
+ * Das Modul spricht Text: state/<Name> meldet mode "cool", command/<Name>/mode nimmt "cool".
573
+ * Die Text-Datenpunkte bleiben deshalb die Hauptform - App, VIS-Bausteine, Geraetekarten und
574
+ * Skripte der Nutzer haengen daran. Lovelace dagegen rechnet beim Schreiben die Schluessel aus
575
+ * common.states mit parseInt() in Zahlen um (climateEntity.js, iobroker.lovelace 7.4.1) - bei
576
+ * Text-Schluesseln wie "cool" kommt NaN heraus. Der Type-Detector erwartet fuer Luefter und
577
+ * Schwenken ebenfalls Zahlen (level.mode.fan / level.mode.swing).
578
+ *
579
+ * Darum gibt es neben jedem Text-Feld einen Zahl-Datenpunkt `<feld>Num` mit
580
+ * common.states {0: "off", 1: "heat_cool", ...}. Beide sind schreibbar und meinen dasselbe:
581
+ * - Meldung des Moduls -> beide werden mit ack=true gesetzt (zahlZwillingeErgaenzen()).
582
+ * - Befehl auf EINEN der beiden -> genau EIN MQTT-Befehl auf command/<Name>/<feld>, immer als
583
+ * Text. Der andere Datenpunkt wird NICHT angefasst; er zieht mit der Bestaetigung des Moduls
584
+ * nach. So entsteht keine Schleife und kein doppelter Befehl.
585
+ *
586
+ * DIE REIHENFOLGE DER LISTEN IST DIE ZAHL - sie darf sich nie aendern, nur hinten wachsen.
587
+ * Neue Werte einer kuenftigen Firmware werden angehaengt.
588
+ */
589
+ const ZAHL_ZWILLINGE = {
590
+ mode: {
591
+ werte: MODES,
592
+ role: 'level.mode.airconditioner',
593
+ name: { en: 'Operating mode (number)', de: 'Betriebsart (Zahl)' },
594
+ },
595
+ fan: {
596
+ werte: FAN_MODES,
597
+ role: 'level.mode.fan',
598
+ name: { en: 'Fan speed (number)', de: 'Lüfterstufe (Zahl)' },
599
+ },
600
+ swing: {
601
+ werte: ['off', 'on', 'V', 'H', 'H+V', 'C'],
602
+ role: 'level.mode.swing',
603
+ name: { en: 'Swing (number)', de: 'Luftverteilung (Zahl)' },
604
+ },
605
+ preset: {
606
+ werte: ['home', 'eco', 'boost'],
607
+ role: 'level.mode',
608
+ name: { en: 'Preset (number)', de: 'Voreinstellung (Zahl)' },
609
+ },
610
+ };
611
+
612
+ for (const [feld, z] of Object.entries(ZAHL_ZWILLINGE)) {
613
+ const text = FELDER[feld];
614
+ const states = {};
615
+ z.werte.forEach((w, i) => {
616
+ // Beschriftung wie beim Text-Datenpunkt (swing: "V" -> "vertical"), damit Lovelace
617
+ // dieselben Namen anzeigt und beim Schreiben zurueckfindet.
618
+ states[i] = (text.states && text.states[w]) || w;
619
+ });
620
+ FELDER[`${feld}Num`] = {
621
+ kanal: text.kanal,
622
+ type: 'number',
623
+ role: z.role,
624
+ w: true,
625
+ cmd: feld,
626
+ zahlZu: feld,
627
+ states,
628
+ min: 0,
629
+ max: z.werte.length - 1,
630
+ step: 1,
631
+ name: z.name,
632
+ };
633
+ }
634
+
635
+ /**
636
+ * Ergaenzt eine Meldung um die Zahl-Zwillinge (mode "cool" -> modeNum 2). Unbekannte Texte
637
+ * bekommen keinen Zwilling: der Text-Datenpunkt zeigt sie trotzdem, die Zahl bleibt stehen.
638
+ *
639
+ * @param {object} daten gemeldete Felder (Klartext aus state/<Name>)
640
+ * @returns {object} dieselben Felder plus <feld>Num, wo zuordenbar
641
+ */
642
+ function zahlZwillingeErgaenzen(daten) {
643
+ let ergebnis = daten;
644
+ for (const [feld, z] of Object.entries(ZAHL_ZWILLINGE)) {
645
+ if (typeof daten[feld] !== 'string') {
646
+ continue;
647
+ }
648
+ const i = z.werte.indexOf(daten[feld]);
649
+ if (i >= 0) {
650
+ if (ergebnis === daten) {
651
+ ergebnis = { ...daten };
652
+ }
653
+ ergebnis[`${feld}Num`] = i;
654
+ }
655
+ }
656
+ return ergebnis;
657
+ }
658
+
659
+ /**
660
+ * Text fuer das Kommandotopic aus einem geschriebenen Zahl-Datenpunkt. Angenommen werden die
661
+ * Zahl (auch als Text "2", wie manche Oberflaechen sie schicken), die Beschriftung ("vertical")
662
+ * und der Modultext selbst ("V").
663
+ *
664
+ * @param {string} feld Feldname des Zahl-Datenpunkts (z. B. "modeNum")
665
+ * @param {string|number|boolean} wert geschriebener Wert
666
+ * @returns {string|null} Text fuer das Modul oder null, wenn der Wert nicht passt
667
+ */
668
+ function zahlZuText(feld, wert) {
669
+ const def = FELDER[feld];
670
+ const z = def && def.zahlZu && ZAHL_ZWILLINGE[def.zahlZu];
671
+ if (!z) {
672
+ return null;
673
+ }
674
+ if (typeof wert === 'number' || (typeof wert === 'string' && /^\s*\d+\s*$/.test(wert))) {
675
+ const n = Number(wert);
676
+ return Number.isInteger(n) && n >= 0 && n < z.werte.length ? z.werte[n] : null;
677
+ }
678
+ if (typeof wert === 'string') {
679
+ if (z.werte.includes(wert)) {
680
+ return wert;
681
+ }
682
+ const i = Object.values(def.states).indexOf(wert);
683
+ return i >= 0 ? z.werte[i] : null;
684
+ }
685
+ return null;
686
+ }
687
+
569
688
  /** Felder, die der Adapter nie als Datenpunkt anlegt (Struktur statt Wert). */
570
689
  const UEBERSPRINGEN = new Set(['ble']);
571
690
 
@@ -836,4 +955,7 @@ module.exports = {
836
955
  einheitAusWert,
837
956
  ohneHaEnable,
838
957
  abgelehntAuswerten,
958
+ ZAHL_ZWILLINGE,
959
+ zahlZwillingeErgaenzen,
960
+ zahlZuText,
839
961
  };
package/lib/namen.js CHANGED
@@ -1043,6 +1043,51 @@ const UEBERSETZUNGEN = {
1043
1043
  uk: 'Пристрій підключено',
1044
1044
  'zh-cn': '设备已连接',
1045
1045
  },
1046
+ // Zahl-Zwillinge der Text-Steuerfelder (fields.js, ZAHL_ZWILLINGE)
1047
+ 'Operating mode (number)': {
1048
+ ru: 'Режим работы (число)',
1049
+ pt: 'Modo de funcionamento (número)',
1050
+ nl: 'Bedrijfsmodus (getal)',
1051
+ fr: 'Mode de fonctionnement (nombre)',
1052
+ it: 'Modalità operativa (numero)',
1053
+ es: 'Modo de funcionamiento (número)',
1054
+ pl: 'Tryb pracy (liczba)',
1055
+ uk: 'Режим роботи (число)',
1056
+ 'zh-cn': '运行模式(数值)',
1057
+ },
1058
+ 'Fan speed (number)': {
1059
+ ru: 'Скорость вентилятора (число)',
1060
+ pt: 'Velocidade do ventilador (número)',
1061
+ nl: 'Ventilatorstand (getal)',
1062
+ fr: 'Vitesse du ventilateur (nombre)',
1063
+ it: 'Velocità ventola (numero)',
1064
+ es: 'Velocidad del ventilador (número)',
1065
+ pl: 'Prędkość wentylatora (liczba)',
1066
+ uk: 'Швидкість вентилятора (число)',
1067
+ 'zh-cn': '风扇转速(数值)',
1068
+ },
1069
+ 'Swing (number)': {
1070
+ ru: 'Распределение воздуха (число)',
1071
+ pt: 'Distribuição do ar (número)',
1072
+ nl: 'Luchtverdeling (getal)',
1073
+ fr: 'Distribution de l’air (nombre)',
1074
+ it: 'Distribuzione dell’aria (numero)',
1075
+ es: 'Distribución del aire (número)',
1076
+ pl: 'Rozprowadzanie powietrza (liczba)',
1077
+ uk: 'Розподіл повітря (число)',
1078
+ 'zh-cn': '送风摆动(数值)',
1079
+ },
1080
+ 'Preset (number)': {
1081
+ ru: 'Предустановка (число)',
1082
+ pt: 'Predefinição (número)',
1083
+ nl: 'Voorinstelling (getal)',
1084
+ fr: 'Préréglage (nombre)',
1085
+ it: 'Preimpostazione (numero)',
1086
+ es: 'Preajuste (número)',
1087
+ pl: 'Ustawienie wstępne (liczba)',
1088
+ uk: 'Передустановка (число)',
1089
+ 'zh-cn': '预设(数值)',
1090
+ },
1046
1091
  };
1047
1092
 
1048
1093
  /**
package/main.js CHANGED
@@ -293,7 +293,8 @@ class Faikout extends utils.Adapter {
293
293
  }
294
294
  // Die gewaehlte Betriebsart (ohne "off") laeuft als eigenes Feld mit.
295
295
  const gewaehlt = felder.gewaehlteBetriebsart(daten, false);
296
- const werte = gewaehlt ? { ...daten, selectedMode: gewaehlt } : daten;
296
+ // Dazu die Zahl-Zwillinge (modeNum, fanNum ...) fuer Lovelace und Co.
297
+ const werte = felder.zahlZwillingeErgaenzen(gewaehlt ? { ...daten, selectedMode: gewaehlt } : daten);
297
298
  this.werteUebernehmen(t.geraet, werte).catch(e => this.log.warn(`${t.geraet}: ${e.message}`));
298
299
  } else if (t.art === 'state' && t.unter === 'status') {
299
300
  // Aus der nativen Meldung nur die Betriebsart einer AUSGESCHALTETEN Anlage - der Rest
@@ -956,7 +957,21 @@ class Faikout extends utils.Adapter {
956
957
 
957
958
  // Der ECHTE Geraetename gehoert ins Topic, nicht die bereinigte Objekt-ID.
958
959
  const topic = `command/${g.name}/${suffix}`;
959
- const nutzlast = this.nutzlast(feld, state.val);
960
+ let nutzlast;
961
+ if (def && def.zahlZu) {
962
+ // Zahl-Zwilling (modeNum ...): das Modul versteht nur Text. Der Text-Datenpunkt
963
+ // bleibt unberuehrt - beide ziehen mit der Bestaetigung des Moduls nach. Ihn hier
964
+ // mitzuschreiben (ack=false) loeste einen zweiten Befehl aus.
965
+ nutzlast = felder.zahlZuText(feld, state.val);
966
+ if (nutzlast === null) {
967
+ this.log.warn(
968
+ `${g.name}: value ${JSON.stringify(state.val)} for ${feld} is not valid (allowed: ${JSON.stringify(def.states)}) - command discarded.`,
969
+ );
970
+ return;
971
+ }
972
+ } else {
973
+ nutzlast = this.nutzlast(feld, state.val);
974
+ }
960
975
  const ok = await this.broker.publish(topic, nutzlast);
961
976
  if (ok) {
962
977
  this.log.debug(`-> ${topic} = ${nutzlast}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.faikout",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Connect Daikin air conditioners with a faikout module locally via MQTT.",
5
5
  "author": {
6
6
  "name": "Immanuel",
@@ -58,7 +58,7 @@
58
58
  "test:integration": "mocha test/integration --exit",
59
59
  "test": "npm run test:package && npm run test:unit",
60
60
  "lint": "eslint .",
61
- "test:unit": "mocha test/verbrauch test/broker test/namen test/einheiten test/abgelehnt test/schreiblast test/devicemanager --exit",
61
+ "test:unit": "mocha test/verbrauch test/broker test/namen test/einheiten test/abgelehnt test/schreiblast test/devicemanager test/zahlundtext --exit",
62
62
  "release": "release-script"
63
63
  }
64
64
  }