iobroker.alias-workbench 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/admin/js/mqtt.js CHANGED
@@ -24,11 +24,18 @@ import { einst, frischeEinstellungen, oeffneEinstellungen } from './einstellunge
24
24
 
25
25
  var TASMOTA_BEFEHLE = null; /* Geraetewissen, aus einer Datei */
26
26
 
27
+ /* Wer einen Punkt angelegt hat - fest englisch, nicht in der Sprache der
28
+ Oberflaeche. Bis 0.14.0 kam der Text aus dem Woerterbuch (mq.createdBy), und weil das
29
+ Ergebnis IN DAS OBJEKT geschrieben wird, blieb es dort fuer immer in
30
+ der Sprache dessen, der gerade klickte („von der Alias-Werkbank
31
+ angelegt"). Es ist eine Herkunftsmarke, kein Text zum Lesen. */
32
+ var ANGELEGT_VON = 'created by the Alias Workbench';
33
+
27
34
  export function ladeBefehlswissen(fertig) {
28
35
  fetch('./geraetewissen/tasmota-befehle.json')
29
36
  .then(function (r) { return r.json(); })
30
37
  .then(function (j) { TASMOTA_BEFEHLE = j; fertig(); })
31
- .catch(function () { TASMOTA_BEFEHLE = { befehle: {}, keineBefehle: [] }; fertig(); });
38
+ .catch(function () { TASMOTA_BEFEHLE = { commands: {}, notCommands: [] }; fertig(); });
32
39
  }
33
40
 
34
41
  /* Die MQTT-Einstellung eines Objekts — sie sitzt je Objekt, nicht an der
@@ -157,7 +164,7 @@ export function tasmotaBefehle(kanal) {
157
164
  });
158
165
  if (!aus) { return null; }
159
166
 
160
- var weg = (TASMOTA_BEFEHLE && TASMOTA_BEFEHLE.keineBefehle) || [];
167
+ var weg = (TASMOTA_BEFEHLE && TASMOTA_BEFEHLE.notCommands) || [];
161
168
  var liste = [];
162
169
  Object.keys(aus).forEach(function (f) {
163
170
  if (weg.indexOf(f) > -1) { return; }
@@ -175,11 +182,17 @@ export function tasmotaBefehle(kanal) {
175
182
 
176
183
  /* Was das Geraetewissen zu einem Befehl sagt — mit %N% fuer POWER1..n. */
177
184
  export function befehlsWissen(name) {
178
- var b = (TASMOTA_BEFEHLE && TASMOTA_BEFEHLE.befehle) || {};
179
- if (b[name]) { return b[name]; }
185
+ var b = (TASMOTA_BEFEHLE && TASMOTA_BEFEHLE.commands) || {};
186
+ var schluessel = b[name] ? name : null;
180
187
  var m = /^([A-Za-z_]+?)(\d{1,2})$/.exec(name);
181
- if (m && b[m[1] + '%N%']) { return b[m[1] + '%N%']; }
182
- return null;
188
+ if (!schluessel && m && b[m[1] + '%N%']) { schluessel = m[1] + '%N%'; }
189
+ if (!schluessel) { return null; }
190
+ /* Die Beschreibung steht nicht in der Datei, sondern in admin/i18n -
191
+ sie wird nur angezeigt und soll der Sprache der Oberflaeche folgen.
192
+ Schluessel `cmd.<Befehl>`, `%N%` als `N`. Fehlt er, bleibt sie leer. */
193
+ var k = 'cmd.' + schluessel.replace('%N%', 'N');
194
+ var text = tr(k);
195
+ return Object.assign({}, b[schluessel], { description: text !== k ? text : '' });
183
196
  }
184
197
 
185
198
  /* Welche Zeilen haengen ueberhaupt am Telemetrietakt?
@@ -841,7 +854,7 @@ function so59Los(kanal, knopf, wert) {
841
854
  var obj = {
842
855
  type: 'state',
843
856
  common: { name: 'SetOption59', type: 'mixed', read: true, write: true, role: 'text',
844
- desc: tr('mq.createdBy'), custom: mqttCustom(g, thema) },
857
+ desc: ANGELEGT_VON, custom: mqttCustom(g, thema) },
845
858
  native: { topic: thema }
846
859
  };
847
860
  socket.emit('setObject', id, obj, function (err) {
@@ -895,7 +908,7 @@ function mqttFragenLos(kanal, _knopf) {
895
908
  type: 'state',
896
909
  common: {
897
910
  name: 'Status', type: 'mixed', read: true, write: true, role: 'text',
898
- desc: tr('mq.createdBy'),
911
+ desc: ANGELEGT_VON,
899
912
  custom: mqttCustom(g, thema)
900
913
  },
901
914
  native: { topic: thema }
@@ -994,7 +1007,7 @@ function frageTakt(kanal, g) {
994
1007
  var obj = {
995
1008
  type: 'state',
996
1009
  common: { name: 'TelePeriod', type: 'mixed', read: true, write: true, role: 'level',
997
- unit: 's', desc: tr('mq.createdBy'), custom: mqttCustom(g, thema) },
1010
+ unit: 's', desc: ANGELEGT_VON, custom: mqttCustom(g, thema) },
998
1011
  /* Einen schon gemerkten Takt nicht wegwerfen, nur weil erneut
999
1012
  gefragt wird. */
1000
1013
  native: { topic: thema,
@@ -1082,7 +1095,7 @@ function mqttCustom(g, thema) {
1082
1095
  Formel steht, bleibt der genaue Typ: aus `number` zieht der Admin
1083
1096
  Min, Max und Einheit. */
1084
1097
  function punktTyp(befehl) {
1085
- return befehl.schreibformel ? 'mixed' : (befehl.typ || 'mixed');
1098
+ return befehl.writeFormula ? 'mixed' : (befehl.type || 'mixed');
1086
1099
  }
1087
1100
 
1088
1101
  export function mqttEinzelnStill(kanal, name, fertig) {
@@ -1127,14 +1140,14 @@ function mqttPunktBauen(kanal, name, was) {
1127
1140
  id = punktKennung(kanal, 'cmnd.' + name);
1128
1141
  var common0 = {
1129
1142
  name: name,
1130
- role: befehl0.rolle || 'state',
1143
+ role: befehl0.role || 'state',
1131
1144
  type: punktTyp(befehl0),
1132
1145
  read: true, write: true,
1133
- desc: tr('mq.createdBy'),
1146
+ desc: ANGELEGT_VON,
1134
1147
  custom: mqttCustom(g, thema0)
1135
1148
  };
1136
- if (befehl0.einheit) { common0.unit = befehl0.einheit; }
1137
- if (befehl0.werteliste) { common0.states = befehl0.werteliste; }
1149
+ if (befehl0.unit) { common0.unit = befehl0.unit; }
1150
+ if (befehl0.states) { common0.states = befehl0.states; }
1138
1151
  obj = { type: 'state', common: common0, native: { topic: thema0 } };
1139
1152
  }
1140
1153
  return { id: id, obj: obj };
@@ -1166,14 +1179,14 @@ function mqttEinzelnLos(kanal, name, was, knopf) {
1166
1179
  id = punktKennung(kanal, 'cmnd.' + name);
1167
1180
  var common = {
1168
1181
  name: name,
1169
- role: befehl.rolle || 'state',
1182
+ role: befehl.role || 'state',
1170
1183
  type: punktTyp(befehl),
1171
1184
  read: true, write: true,
1172
- desc: tr('mq.createdBy'),
1185
+ desc: ANGELEGT_VON,
1173
1186
  custom: mqttCustom(g, thema)
1174
1187
  };
1175
- if (befehl.einheit) { common.unit = befehl.einheit; }
1176
- if (befehl.werteliste) { common.states = befehl.werteliste; }
1188
+ if (befehl.unit) { common.unit = befehl.unit; }
1189
+ if (befehl.states) { common.states = befehl.states; }
1177
1190
  obj = { type: 'state', common: common, native: { topic: thema } };
1178
1191
  }
1179
1192
 
@@ -1206,7 +1219,7 @@ function zeigeMqttDialogLos(kanal) {
1206
1219
  var befehl = befehlsWissen(x.name);
1207
1220
  /* Vorgehakt nur, was eine Geraetefunktion ist: bekannt, keine
1208
1221
  Dopplung und keine blosse Einstellung des Geraets. */
1209
- mqttAuswahl['neu:' + x.name] = !!befehl && !befehl.vorgabeAus && !istDopplung(x.name, l);
1222
+ mqttAuswahl['neu:' + x.name] = !!befehl && !befehl.offByDefault && !istDopplung(x.name, l);
1210
1223
  });
1211
1224
  l.stumm.forEach(function (x) { mqttAuswahl['fix:' + x.name] = true; });
1212
1225
  zeichneMqttDialog();
@@ -1217,9 +1230,9 @@ function zeigeMqttDialogLos(kanal) {
1217
1230
  anzulegen ergibt drei Punkte, die sich gegenseitig ueberschreiben. */
1218
1231
  function istDopplung(name, l) {
1219
1232
  var befehl = befehlsWissen(name);
1220
- if (!befehl || !befehl.dopplung) { return false; }
1221
- return l.fehlen.some(function (x) { return x.name === befehl.dopplung; }) ||
1222
- l.da.indexOf(befehl.dopplung) > -1;
1233
+ if (!befehl || !befehl.duplicateOf) { return false; }
1234
+ return l.fehlen.some(function (x) { return x.name === befehl.duplicateOf; }) ||
1235
+ l.da.indexOf(befehl.duplicateOf) > -1;
1223
1236
  }
1224
1237
 
1225
1238
  function zeichneMqttDialog() {
@@ -1264,9 +1277,9 @@ function zeichneMqttDialog() {
1264
1277
  var nm = el('span', 'sn', 'cmnd.' + x.name);
1265
1278
  nm.style.fontFamily = 'var(--mono)';
1266
1279
  r.appendChild(nm);
1267
- r.appendChild(el('span', 'rx', befehl ? (befehl.rolle || '—') + (befehl.einheit ? ' ' + befehl.einheit : '') : tr('mq.unknownCommand')));
1268
- var wz = el('span', 'rx', befehl && befehl.was ? befehl.was : (tr('mq.nowValue') + ' ' + JSON.stringify(x.wert)));
1269
- if (befehl && befehl.dopplung) { wz.appendChild(el('span', 'chip warn', tr('mq.duplicate', befehl.dopplung))); }
1280
+ r.appendChild(el('span', 'rx', befehl ? (befehl.role || '—') + (befehl.unit ? ' ' + befehl.unit : '') : tr('mq.unknownCommand')));
1281
+ var wz = el('span', 'rx', befehl && befehl.description ? befehl.description : (tr('mq.nowValue') + ' ' + JSON.stringify(x.wert)));
1282
+ if (befehl && befehl.duplicateOf) { wz.appendChild(el('span', 'chip warn', tr('mq.duplicate', befehl.duplicateOf))); }
1270
1283
  r.appendChild(wz);
1271
1284
  nk.appendChild(r);
1272
1285
  });
@@ -1348,14 +1361,14 @@ function mqttZuSchreiben() {
1348
1361
  auf der Leitung stand `true` statt `ON` (H18, gemessen 20.09.2026). */
1349
1362
  var common = {
1350
1363
  name: x.name,
1351
- role: befehl.rolle || 'state',
1364
+ role: befehl.role || 'state',
1352
1365
  type: punktTyp(befehl),
1353
1366
  read: true, write: true,
1354
- desc: tr('mq.createdBy'),
1367
+ desc: ANGELEGT_VON,
1355
1368
  custom: mqttCustom(l.geraet, thema)
1356
1369
  };
1357
- if (befehl.einheit) { common.unit = befehl.einheit; }
1358
- if (befehl.werteliste) { common.states = befehl.werteliste; }
1370
+ if (befehl.unit) { common.unit = befehl.unit; }
1371
+ if (befehl.states) { common.states = befehl.states; }
1359
1372
  raus.push({ id: punktKennung(kanal, 'cmnd.' + x.name), obj: { type: 'state', common: common, native: { topic: thema } }, neu: true });
1360
1373
  });
1361
1374
  l.stumm.forEach(function (x) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "tasmota-rgb",
3
- "version": 6,
3
+ "version": 7,
4
4
  "priority": 25,
5
5
  "name": {
6
6
  "de": "Tasmota-Farblampe",
@@ -83,11 +83,11 @@
83
83
  "write": "cmnd.Scheme",
84
84
  "optional": true,
85
85
  "valueList": {
86
- "0": "einfarbig",
87
- "1": "Aufwachen",
88
- "2": "Farben vorwärts",
89
- "3": "Farben rückwärts",
90
- "4": "zufällig"
86
+ "0": "single colour",
87
+ "1": "wake up",
88
+ "2": "cycle colours up",
89
+ "3": "cycle colours down",
90
+ "4": "random"
91
91
  },
92
92
  "note": {
93
93
  "de": "Der Platz EFFECT verlangt eine Werteliste — ohne common.states erkennt der type-detector ihn nicht. Liest aus tele.STATE und schreibt nach cmnd — die Rückmeldung kommt deshalb erst mit der nächsten Telemetrie, bei TelePeriod 300 also bis zu fünf Minuten später. Tasmota antwortet zwar sofort auf stat/RESULT, aber dort steht nur der eine geänderte Schlüssel; als Lesequelle wäre das unbrauchbar. Abhilfe am Gerät: SetOption59 1 — dann schickt Tasmota tele/STATE bei jeder Änderung mit.",