iobroker.assistant 1.15.1 → 1.15.2

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
@@ -81,7 +81,7 @@ mosquitto_pub -h <broker-ip> -t hannah/server -r -m '{"host":"<iobroker-ip>","po
81
81
  --mic 0 --speaker 0 --sample-rate 16000 --tts-rate 48000
82
82
  ```
83
83
 
84
- Success looks like `Registrierung bestätigt (ACK empfangen)` in the satellite log and
84
+ Success looks like the satellite logging that its registration was acknowledged (ACK) and
85
85
  `Satellite registered: wohnzimmer` in the adapter log. Then say the wake word → speak → the answer
86
86
  is spoken back.
87
87
 
@@ -237,6 +237,12 @@ train it twice.
237
237
  Placeholder for the next version (at the beginning of the line):
238
238
  ### **WORK IN PROGRESS**
239
239
  -->
240
+ ### 1.15.2 (2026-11-28)
241
+ * (@sadam6752-tech) Measurement and window questions are answered by the rules only when they ask nothing more: "how much does the temperature vary in deserts?" or a place that is no room of the house goes to the LLM instead of getting the values of every room. Common room words find a room named in another language (the Russian word for kitchen finds the room named in German), in their own forms only
242
+ * (@sadam6752-tech) A Russian answer with German device names is spoken by the Russian voice, an English sentence with a Russian name by the English one
243
+ * (@GermanBluefox) Announcements: `tts.text` and `satellites.<id>.tts` are acknowledged (`ack: true`) once a satellite got the text; an announcement nobody received stays unacknowledged
244
+ * MCP tools (`@iobroker/mcp-server` 1.10.1): `set_object` no longer deletes the protected settings of an instance (e.g. the login and password of cloud and iot) and stores a new password (`encryptedNative`) encrypted
245
+
240
246
  ### 1.15.1 (2026-11-26)
241
247
  * Added detection of volume commands
242
248
 
@@ -244,20 +250,15 @@ train it twice.
244
250
  * (@GermanBluefox) A wake word for free questions: the table of the wake words has a purpose, and with "Free questions only" a wake word ("Hey Bro, how old can cats get?") skips the commands of the house and asks the cloud tier without device list and tools, in a conversation of its own; its follow-ups and dialog mode keep it. Instructions of its own: `freeTalkPrompt`
245
251
 
246
252
  ### 1.14.0 (2026-11-23)
247
- * (@GermanBluefox) Commands of other adapters by the shared catalog (`HELP.md`): the assistant asks the `help` of every instance and understands "ruf Anna an" (`phone.call`), "schick mir ein Bild der Haustür" (`camera.snapshot` → `message.send`), "zeige die Einfahrt auf dem Fernseher" (`screen.show`: camera, view, text) and plays music on the players of other adapters (`media.getPlayers`/`search`/`play`); message `getStandards`
253
+ * (@GermanBluefox) Commands of other adapters by the shared catalog (`HELP.md`): the assistant asks the `help` of every instance and understands "call Anna" (`phone.call`), "send me a picture of the front door" (`camera.snapshot` → `message.send`), "show the driveway on the TV" (`screen.show`: camera, view, text), also in German and Russian, and plays music on the players of other adapters (`media.getPlayers`/`search`/`play`); message `getStandards`
248
254
  * (@GermanBluefox) The cloud tier (LLM or pi-agent) gets "answer in <language>" after a question whose language is clear (its letters, the wake word or its words): pi-agent answered a Russian question in German after German turns
249
255
  * (@GermanBluefox) Music and YouTube on the players of their tables are understood also with the rule-based commands switched off (pi-agent has no tools for them)
250
- * (@GermanBluefox) Music without a named player plays on the device that was spoken to (new column "Satellite" in the table, now "Music players", which also takes players of other adapters); "spiel die Piano Guys" works without a kind word and plays only something named like it
251
- * (@GermanBluefox) 3D plan: "zeig Unterdeck", "show the galley", "покажи кухню", "zeig das ganze Haus" make every open 3D view of home3d fly there (writes `home3d.N.show`); only names the plan knows (`home3d.N.places`) are taken, everything else goes on as before
256
+ * (@GermanBluefox) Music without a named player plays on the device that was spoken to (new column "Satellite" in the table, now "Music players", which also takes players of other adapters); "play the Piano Guys" works without a kind word and plays only something named like it
257
+ * (@GermanBluefox) 3D plan: "show the lower deck", "show the galley", "show the whole house" (also in German and Russian) make every open 3D view of home3d fly there (writes `home3d.N.show`); only names the plan knows (`home3d.N.places`) are taken, everything else goes on as before
252
258
 
253
259
  ### 1.13.0 (2026-11-20)
254
- * (@GermanBluefox) Music from Spotify: "play Bohemian Rhapsody by Queen", "spiel das Album … in der Küche", "spiel meine Playlist …" find the song, album, artist or playlist and play it on a Spotify Connect device (table "Spotify players" on the Services tab, needs spotify-premium 3.3.0 or newer); LLM tools `play_music` and `music_player`, message `playMusic`
255
- * (@GermanBluefox) Music clips on the TV: "spiel den Clip Bohemian Rhapsody von Queen", "play the music video … by …", "включи клип …" search the clip on YouTube and play it on the YouTube player; so does a song for a TV
256
-
257
- ### 1.12.1 (2026-11-19)
258
- * (@GermanBluefox) Voice per answer language: the language is a drop-down now. A language picked from the suggestions was saved as its label (e.g. "de – Deutsch") and the row was never used; such rows get the language code on the first start
259
- * (@GermanBluefox) Spoken requests: the speech recognition no longer waits for the device names it gets as hints (up to 3 s on large installations each time a minute had passed since the last request); the last list is used while a new one is built
260
- * (@GermanBluefox) Request details: the speech recognition step shows the language it really got (that of the wake word) and the ioBroker.voice instance instead of the unrelated Vosk model; the speech synthesis step shows the voice, model and language that really spoke (a row of "voice per answer language" or the reserve) instead of the main voice of the settings
260
+ * (@GermanBluefox) Music from Spotify: "play Bohemian Rhapsody by Queen", "play the album … in the kitchen", "play my playlist …" (also in German and Russian) find the song, album, artist or playlist and play it on a Spotify Connect device (table "Spotify players" on the Services tab, needs spotify-premium 3.3.0 or newer); LLM tools `play_music` and `music_player`, message `playMusic`
261
+ * (@GermanBluefox) Music clips on the TV: "play the clip Bohemian Rhapsody by Queen", "play the music video … by …" (also in German and Russian) search the clip on YouTube and play it on the YouTube player; so does a song for a TV
261
262
 
262
263
  [Older changelogs can be found there](CHANGELOG_OLD.md)
263
264
 
package/build/lib/nlu.js CHANGED
@@ -185,11 +185,179 @@ const CATEGORY_WORDS = [
185
185
  {
186
186
  // Last: 'warm'/'temperatur' are the words people use most, so a more specific category above wins
187
187
  // when both appear ("wie warm und wie feucht ist es" is answered about the humidity).
188
- words: ['temperatur', 'warm', 'kalt', 'grad', 'temperature', 'cold', 'температур', 'тепло', 'холодно'],
188
+ words: [
189
+ 'temperatur',
190
+ 'warm',
191
+ 'kalt',
192
+ 'grad',
193
+ 'temperature',
194
+ 'cold',
195
+ 'температур',
196
+ 'градус',
197
+ 'тепло',
198
+ 'холодно',
199
+ ],
189
200
  category: 'temperature',
190
201
  types: ['temperature', 'thermostat'],
191
202
  },
192
203
  ];
204
+ /**
205
+ * Small words a pure measurement question may carry besides the query word, the measurement word, the room and
206
+ * "everywhere" (whole tokens, after the filler is gone). Anything else — "Какие бывают перепады температуры в
207
+ * пустынях?", a room the house does not have — is a question the sensors cannot answer: it goes to the LLM.
208
+ */
209
+ const CATEGORY_SMALL_WORDS = new Set([
210
+ // de
211
+ 'es',
212
+ 'gerade',
213
+ 'grade',
214
+ 'jetzt',
215
+ 'aktuell',
216
+ 'momentan',
217
+ 'hier',
218
+ 'drinnen',
219
+ 'drin',
220
+ 'haus',
221
+ 'hause',
222
+ 'wohnung',
223
+ 'viel',
224
+ 'hoch',
225
+ 'gibt',
226
+ 'zimmer',
227
+ 'raum',
228
+ 'welchem',
229
+ 'welchen',
230
+ 'grad',
231
+ 'sag',
232
+ 'sage',
233
+ 'mir',
234
+ 'bei',
235
+ 'uns',
236
+ 'hat',
237
+ 'haben',
238
+ // en
239
+ 'tell',
240
+ 'me',
241
+ 'us',
242
+ 'it',
243
+ "it's",
244
+ 'its',
245
+ "what's",
246
+ 'whats',
247
+ 'current',
248
+ 'currently',
249
+ 'now',
250
+ 'right',
251
+ 'here',
252
+ 'inside',
253
+ 'indoors',
254
+ 'house',
255
+ 'home',
256
+ 'level',
257
+ 'much',
258
+ 'degrees',
259
+ 'room',
260
+ 'rooms',
261
+ 'of',
262
+ 'at',
263
+ 'on',
264
+ // ru
265
+ 'скажи',
266
+ 'подскажи',
267
+ 'какие',
268
+ 'сейчас',
269
+ 'здесь',
270
+ 'тут',
271
+ 'дома',
272
+ 'доме',
273
+ 'квартире',
274
+ 'у',
275
+ 'нас',
276
+ 'во',
277
+ 'по',
278
+ 'всех',
279
+ 'комнате',
280
+ 'комнатах',
281
+ 'градусов',
282
+ 'градуса',
283
+ 'показывает',
284
+ ]);
285
+ /**
286
+ * Small words of a pure "which windows are open" question, on top of {@link CATEGORY_SMALL_WORDS} ("gibt es",
287
+ * "у нас", "дома").
288
+ */
289
+ const WINDOW_SMALL_WORDS = new Set([
290
+ 'ein',
291
+ 'eine',
292
+ 'irgendein',
293
+ 'irgendwelche',
294
+ 'irgendwo',
295
+ 'noch',
296
+ 'gerade',
297
+ 'wo',
298
+ 'a',
299
+ 'an',
300
+ 'any',
301
+ 'there',
302
+ 'still',
303
+ 'where',
304
+ 'which',
305
+ 'some',
306
+ 'какие',
307
+ 'какое',
308
+ 'ли',
309
+ 'есть',
310
+ 'где',
311
+ 'где-нибудь',
312
+ 'где-то',
313
+ 'еще',
314
+ 'сейчас',
315
+ ]);
316
+ /**
317
+ * Common room words in de/en/ru: a room named in one language is also found by these words in the others
318
+ * ("на кухне" → "Küche", "в спальне" → "Schlafzimmer"). Matched in their own forms only (кухня/кухне/кухню, see
319
+ * {@link roomWordInText}). Anything else needs an nluAliases row.
320
+ */
321
+ const ROOM_WORDS = [
322
+ ['kueche', 'kitchen', 'кухня'],
323
+ ['schlafzimmer', 'bedroom', 'спальня'],
324
+ ['badezimmer', 'bad', 'bathroom', 'ванная', 'ванна'],
325
+ ['wohnzimmer', 'living room', 'livingroom', 'lounge', 'гостиная', 'зал'],
326
+ ['flur', 'diele', 'korridor', 'corridor', 'hallway', 'коридор', 'прихожая'],
327
+ ['buero', 'arbeitszimmer', 'office', 'study', 'кабинет', 'офис'],
328
+ ['kinderzimmer', 'nursery', 'kids room', 'детская'],
329
+ ['gaestezimmer', 'guest room', 'гостевая'],
330
+ ['esszimmer', 'dining room', 'столовая'],
331
+ ['toilette', 'wc', 'toilet', 'туалет'],
332
+ ['keller', 'basement', 'cellar', 'подвал'],
333
+ ['dachboden', 'attic', 'чердак'],
334
+ ['garage', 'гараж'],
335
+ ['garten', 'garden', 'сад'],
336
+ ['balkon', 'balcony', 'балкон'],
337
+ ['terrasse', 'terrace', 'терраса'],
338
+ ['waschkueche', 'laundry', 'прачечная'],
339
+ ];
340
+ /** German room words that are everyday English words: "how bad is the air" asks nothing about the bathroom. */
341
+ const ENGLISH_LOOKALIKES = new Set(['bad']);
342
+ /** Words only an English sentence has (for {@link ENGLISH_LOOKALIKES}). */
343
+ const ENGLISH_MARKERS = new Set([
344
+ 'how',
345
+ 'what',
346
+ "what's",
347
+ 'whats',
348
+ 'is',
349
+ 'are',
350
+ 'it',
351
+ "it's",
352
+ 'which',
353
+ 'there',
354
+ 'does',
355
+ ]);
356
+ /** The room-word groups a (normalized) room name belongs to: a group word is the name or one of its words. */
357
+ function roomWordGroups(normName) {
358
+ const words = normName.split(/\s+/);
359
+ return ROOM_WORDS.filter(g => g.some(w => w === normName || words.includes(w)));
360
+ }
193
361
  /** Words that ask about every room at once ("wie warm ist es überall"). */
194
362
  const EVERYWHERE_WORDS = ['ueberall', 'alle', 'allen', 'everywhere', 'all', 'везде', 'всюду'];
195
363
  /** Words (stemmed) that make a question a weather question on their own. */
@@ -859,13 +1027,17 @@ function normalize(s) {
859
1027
  }
860
1028
  const STRIP = /[.,!?;:()[\]]/g;
861
1029
  const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1030
+ /** The start of a word its inflected forms share: longer words drop more trailing characters. */
1031
+ function stemOf(word) {
1032
+ return word.length >= 6 ? word.slice(0, word.length - 2) : word.length >= 5 ? word.slice(0, word.length - 1) : word;
1033
+ }
862
1034
  /**
863
1035
  * Does a name word appear in the text? Matches on a Unicode word boundary and allows a differing
864
1036
  * suffix (crude stemming) so inflected forms match too — essential for Russian ("подсветку" for
865
1037
  * "подсветка", "кокпита" for "кокпит"). Longer words drop more trailing characters.
866
1038
  */
867
1039
  function wordInText(word, text) {
868
- const stem = word.length >= 6 ? word.slice(0, word.length - 2) : word.length >= 5 ? word.slice(0, word.length - 1) : word;
1040
+ const stem = stemOf(word);
869
1041
  try {
870
1042
  return new RegExp(`(?<![\\p{L}\\p{N}])${escapeRe(stem)}`, 'u').test(text);
871
1043
  }
@@ -914,6 +1086,25 @@ const CYRILLIC_TO_LATIN = {
914
1086
  function cyrillicToLatin(text) {
915
1087
  return text.replace(/[а-я]/gu, c => CYRILLIC_TO_LATIN[c] ?? c);
916
1088
  }
1089
+ /**
1090
+ * Is a common room word ({@link ROOM_WORDS}) in the text? Stricter than {@link wordInText}, which takes every word
1091
+ * that begins like it: a word of another language counts in its own forms only ("кухне", "зале", "kitchens"), not
1092
+ * as the start of another word ("заливе", "official", "cellphone"), and a German word that is also an English one
1093
+ * not in an English sentence.
1094
+ */
1095
+ function roomWordInText(word, text) {
1096
+ const tokens = text.split(/\s+/);
1097
+ if (ENGLISH_LOOKALIKES.has(word) && tokens.some(t => ENGLISH_MARKERS.has(t))) {
1098
+ return false;
1099
+ }
1100
+ if (word.includes(' ')) {
1101
+ return wordInText(word, text); // "living room": the words in a row
1102
+ }
1103
+ const stem = stemOf(word);
1104
+ // Russian cases and plurals add up to two letters ("гаражах"), German and English one ("Küchen", "kitchens")
1105
+ const longest = word.length + (CYRILLIC_RE.test(word) ? 2 : 1);
1106
+ return tokens.some(t => t.startsWith(stem) && t.length <= longest);
1107
+ }
917
1108
  /** A word of a room name in a token: stem-tolerant either way, and a Latin name in Cyrillic letters. */
918
1109
  function roomWordFits(word, token) {
919
1110
  return (wordInText(word, token) ||
@@ -1115,7 +1306,7 @@ class Nlu {
1115
1306
  return timeQuery;
1116
1307
  }
1117
1308
  // Aggregate query first ("which windows are open") — before single-device matching.
1118
- const windowsQuery = this.parseWindowsOpen(p.joined);
1309
+ const windowsQuery = this.parseWindowsOpen(p);
1119
1310
  if (windowsQuery) {
1120
1311
  return windowsQuery;
1121
1312
  }
@@ -1399,6 +1590,13 @@ class Nlu {
1399
1590
  return null;
1400
1591
  }
1401
1592
  const roomName = this.findRoom(p.joined);
1593
+ const known = (t) => QUERY_WORDS.has(t) ||
1594
+ CATEGORY_SMALL_WORDS.has(t) ||
1595
+ CATEGORY_WORDS.some(c => c.words.some(w => wordInText(w, t))) ||
1596
+ EVERYWHERE_WORDS.some(w => wordInText(w, t));
1597
+ if (!this.onlyKnownWords(p, roomName, known)) {
1598
+ return null; // more than "temperature [in room]", or a place that is no room here → the LLM
1599
+ }
1402
1600
  const everywhere = EVERYWHERE_WORDS.some(w => wordInText(w, p.joined));
1403
1601
  const room = everywhere ? '' : roomName;
1404
1602
  const devices = this.devices.filter(d => match.types.includes(d.type) && (!room || d.room === room));
@@ -1502,7 +1700,7 @@ class Nlu {
1502
1700
  * громкостью сорок процентов"): answering only its volume part would drop the rest, so it goes to the LLM.
1503
1701
  */
1504
1702
  volumeOnly(p, room) {
1505
- const roomWords = room ? normalize(room).split(/\s+/).filter(Boolean) : [];
1703
+ const roomWords = this.roomWords(room);
1506
1704
  return spelledNumbersToDigits(p.tokens.join(' '))
1507
1705
  .split(' ')
1508
1706
  .filter(Boolean)
@@ -1520,11 +1718,21 @@ class Nlu {
1520
1718
  [...NEUTRAL_VERBS].some(v => wordInText(v, t)) ||
1521
1719
  roomWords.some(w => roomWordFits(w, t)));
1522
1720
  }
1523
- parseWindowsOpen(text) {
1721
+ parseWindowsOpen(p) {
1722
+ const text = p.joined;
1524
1723
  if (!WINDOW_WORDS.some(w => wordInText(w, text)) || !OPEN_WORDS.some(w => wordInText(w, text))) {
1525
1724
  return null;
1526
1725
  }
1527
1726
  const roomName = this.findRoom(text);
1727
+ const known = (t) => QUERY_WORDS.has(t) ||
1728
+ WINDOW_SMALL_WORDS.has(t) ||
1729
+ CATEGORY_SMALL_WORDS.has(t) ||
1730
+ WINDOW_WORDS.some(w => wordInText(w, t)) ||
1731
+ OPEN_WORDS.some(w => wordInText(w, t)) ||
1732
+ EVERYWHERE_WORDS.some(w => wordInText(w, t));
1733
+ if (!this.onlyKnownWords(p, roomName, known)) {
1734
+ return null; // "welche Fenster sind in Berlin offen": not a question about this house's windows
1735
+ }
1528
1736
  const windows = this.devices.filter(d => WINDOW_TYPES.has(d.type) && (!roomName || d.room === roomName));
1529
1737
  if (!windows.length) {
1530
1738
  return null; // no window devices known → let the LLM handle it
@@ -1560,7 +1768,35 @@ class Nlu {
1560
1768
  bestLen = n.length;
1561
1769
  }
1562
1770
  }
1563
- return best;
1771
+ if (best) {
1772
+ return best;
1773
+ }
1774
+ // No name in the text: a common room word of another language ("на кухне" for "Küche"). Two rooms of the
1775
+ // same kind ("Bad oben", "Bad unten") are no answer — the word then stays unmatched and the rules step back.
1776
+ const byWord = this.rooms.filter(name => roomWordGroups(normalize(name)).some(g => g.some(w => roomWordInText(w, text))));
1777
+ return byWord.length === 1 ? byWord[0] : '';
1778
+ }
1779
+ /** The words that may name a room in a command: its own words and the common room words of its kind. */
1780
+ roomWords(room) {
1781
+ if (!room) {
1782
+ return [];
1783
+ }
1784
+ const n = normalize(room);
1785
+ return [
1786
+ ...n.split(/\s+/).filter(Boolean),
1787
+ ...roomWordGroups(n)
1788
+ .flat()
1789
+ .flatMap(w => w.split(' ')),
1790
+ ];
1791
+ }
1792
+ /**
1793
+ * True when every word of the command is a known one (`known`) or names the room: a question that says more
1794
+ * ("Какие бывают перепады температуры в пустынях?") or names a place the house does not have is not one the
1795
+ * rules can answer, and it must never be answered for all rooms instead.
1796
+ */
1797
+ onlyKnownWords(p, room, known) {
1798
+ const roomWords = this.roomWords(room);
1799
+ return p.tokens.every(t => known(t) || roomWords.some(w => roomWordFits(w, t)));
1564
1800
  }
1565
1801
  /**
1566
1802
  * Device whose significant name words all appear in the text (stem-tolerant for inflection).